Skip to main content
There are two ways to explore the Claude Code source: install the MCP Explorer npm package for immediate interactive access, or clone the repository to browse the files directly.
The MCP Explorer server is the fastest path. You can start asking questions about the codebase within seconds — no clone required.
Install the claude-code-explorer-mcp package with a single command. No repository clone needed.
claude mcp add claude-code-explorer -- npx -y claude-code-explorer-mcp
Once installed, restart your Claude Code session and ask questions like:
  • “How does the BashTool work?”
  • “Search for where permissions are checked”
  • “Show me the /review command source”
  • “Give me an architecture overview”
See the MCP Explorer Server page for all available tools, prompts, and client configurations.

Option 2: Clone and explore locally

1

Install prerequisites

You need Bun and Git.
# Install Bun (if not already installed)
curl -fsSL https://bun.sh/install | bash
2

Clone the repository

git clone https://github.com/nirholas/claude-code.git
cd claude-code
3

Install dependencies

The main package uses Bun. The MCP server uses npm.
# Install main package dependencies (for type checking and linting)
bun install

# Install and build the MCP server
cd mcp-server && npm install && npm run build
cd ..
4

Register the MCP Explorer with Claude Code

Point the MCP server at the local source:
claude mcp add claude-code-explorer -- node ~/claude-code/mcp-server/dist/index.js
Replace ~/claude-code with the absolute path to your clone.
5

Explore the source

Open the src/ directory in your editor to browse the codebase, or use the MCP Explorer to navigate interactively.
# Type check the source
bun run typecheck

# Lint the source
bun run lint

Directory structure

The leaked src/ directory contains ~1,900 files organized as follows:
src/
├── main.tsx                 # Entrypoint — Commander.js CLI parser + React/Ink renderer
├── QueryEngine.ts           # Core LLM API caller (~46K lines)
├── Tool.ts                  # Tool type definitions (~29K lines)
├── commands.ts              # Command registry (~25K lines)
├── tools.ts                 # Tool registry
├── context.ts               # System/user context collection
├── cost-tracker.ts          # Token cost tracking

├── tools/                   # Agent tool implementations (~40)
├── commands/                # Slash command implementations (~50)
├── components/              # Ink UI components (~140)
├── services/                # External service integrations
├── hooks/                   # React hooks (incl. permission checks)
├── types/                   # TypeScript type definitions
├── utils/                   # Utility functions
├── screens/                 # Full-screen UIs (Doctor, REPL, Resume)

├── bridge/                  # IDE integration (VS Code, JetBrains)
├── coordinator/             # Multi-agent orchestration
├── plugins/                 # Plugin system
├── skills/                  # Skill system
├── server/                  # Server mode
├── remote/                  # Remote sessions
├── memdir/                  # Persistent memory directory
├── tasks/                   # Task management
├── state/                   # State management

├── voice/                   # Voice input
├── vim/                     # Vim mode
├── keybindings/             # Keybinding configuration
├── schemas/                 # Config schemas (Zod)
├── migrations/              # Config migrations
├── entrypoints/             # Initialization logic
├── query/                   # Query pipeline
└── ink/                     # Ink renderer wrapper

Key files to start with

FileLinesDescription
src/main.tsxCLI entrypoint. Commander.js parser + React/Ink renderer startup
src/QueryEngine.ts~46KCore LLM API engine — streaming, tool loops, thinking mode, retries
src/Tool.ts~29KBase types and interfaces for all tools — schemas, permissions, progress
src/commands.ts~25KCommand registration and execution
src/tools.tsTool registry and loader
The src/ directory is the original leaked source. It should not be modified. Contributions to documentation, the MCP server, and exploration tooling are welcome — see the contributing guide.

Next steps

MCP Explorer Server

Full reference for the interactive source explorer — tools, prompts, and all client configs

Architecture overview

Core pipeline, startup sequence, state management, rendering, and data flow

Tools reference

Complete catalog of all 40+ agent tools with permissions and usage

Commands reference

All 85+ slash commands organized by category

Build docs developers (and LLMs) love