Claude Code Explorer MCP について
Claude Code Explorer MCP は、MCP クライアントから Claude Code CLI のソースコードを閲覧できる独立した MCP サーバーです。Claude Code のツール、コマンド、アーキテクチャを調べたい開発者を対象とし、STDIO、Streamable HTTP、SSE の各トランスポートに対応しています。
主な機能
- 01エージェントツールとスラッシュコマンドの一覧表示
- 02ツールとコマンドの実装ソースの読み取り
- 03ソースツリーを対象とした正規表現検索
- 04アーキテクチャ概要とディレクトリ内容の表示
- 05ツールやサブシステムを解説するプロンプトテンプレート
- 06任意の Bearer トークンによる認証
活用シーン
- 01Claude Code 内の特定ツールの実装方法の調査
- 02権限チェックなどサブシステムのコード位置の特定
- 03MCP クライアントからの Claude Code アーキテクチャの把握
MCP 対応
本プロジェクトは MCP サーバーであり、Claude Code のソースコードを閲覧するための 8 つのツール、3 つのリソース、5 つのプロンプトを MCP クライアントに公開します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
warrioraashuu Codemaster — MCP サーバー
あらゆる MCP 対応クライアントが Claude Code のソースコードを調べられる、スタンドアロンのModel Context Protocol(MCP)サーバーです。warrioraashuuによってブランド名を変更し、公開されています。STDIO、Streamable HTTP、SSEのトランスポートに対応しています。
概要
約1,900ファイル、512K行超の Claude Code コードベースを調べるための8つのツール、3つのリソース、5つのプロンプトを公開します。これは公式の npm パッケージです:warrioraashuu-codemaster。
トランスポート
| トランスポート | エンドポイント | 最適な用途 |
|---|---|---|
| STDIO | node dist/index.js | Claude Desktop、ローカルの Claude Code、VS Code |
| Streamable HTTP | POST/GET /mcp | 最新の MCP クライアント、リモートホスティング |
| Legacy SSE | GET /sse + POST /messages | 古い MCP クライアント |
ツール
| ツール | 説明 |
|---|---|
list_tools | 40以上のエージェントツール(BashTool、FileEditTool など)を一覧表示します |
list_commands | 50以上のスラッシュコマンド(/commit、/review など)を一覧表示します |
get_tool_source | 特定のツールの実装を読み込みます |
get_command_source | 特定のコマンドの実装を読み込みます |
read_source_file | 相対パスを指定して、src/内の任意のファイルを読み込みます |
search_source | ソースツリー全体を正規表現で検索します |
list_directory | src/配下の任意のディレクトリの内容を一覧表示します |
get_architecture | アーキテクチャの全体像を取得します |
リソース
| URI | 説明 |
|---|---|
claude-code://architecture | README/アーキテクチャの概要 |
claude-code://tools | ツールレジストリ(JSON) |
claude-code://commands | コマンドレジストリ(JSON) |
claude-code://source/{path} | 任意のソースファイル(テンプレート) |
プロンプト
| プロンプト | 説明 |
|---|---|
explain_tool | 特定のツールの目的、スキーマ、権限、処理フローを詳しく説明します |
explain_command | 特定のスラッシュコマンドの動作と実装を説明します |
architecture_overview | Claude Code のアーキテクチャ全体を順に紹介します |
how_does_it_work | 機能やサブシステム(権限、MCP、ブリッジなど)の仕組みを説明します |
compare_tools | 2つのツールを並べて比較します |
セットアップ
cd mcp-server
npm install
npm run build
ローカルで実行(STDIO)
npm start
# or with custom source path:
CLAUDE_CODE_SRC_ROOT=/path/to/src npm start
ローカルで実行(HTTP)
npm run start:http
# Streamable HTTP at http://localhost:3000/mcp
# Legacy SSE at http://localhost:3000/sse
# Health check at http://localhost:3000/health
認証を使用する場合
MCP_API_KEY=your-secret-token npm run start:http
# Clients must include: Authorization: Bearer your-secret-token
設定
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json(macOS)または %APPDATA%\Claude\claude_desktop_config.json(Windows)に追加します:
{
"mcpServers": {
"warrioraashuu-codemaster": {
"command": "node",
"args": ["/absolute/path/to/claude-code/mcp-server/dist/index.js"],
"env": {
"CLAUDE_CODE_SRC_ROOT": "/absolute/path/to/claude-code/src"
}
}
}
}
VS Code(GitHub Copilot)
ワークスペースの.vscode/mcp.jsonに追加します:
{
"servers": {
"claude-code-explorer": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/mcp-server/dist/index.js"],
"env": {
"CLAUDE_CODE_SRC_ROOT": "${workspaceFolder}/src"
}
}
}
}
Cursor
~/.cursor/mcp.jsonに追加します:
{
"mcpServers": {
"claude-code-explorer": {
"command": "node",
"args": ["/absolute/path/to/claude-code/mcp-server/dist/index.js"],
"env": {
"CLAUDE_CODE_SRC_ROOT": "/absolute/path/to/claude-code/src"
}
}
}
}
環境変数
| 変数 | デフォルト | 説明 |
|---|---|---|
CLAUDE_CODE_SRC_ROOT | ../src(dist/からの相対パス) | Claude Code のsrc/ディレクトリへのパス |
PORT | 3000 | HTTP サーバーのポート(HTTP モードのみ) |
MCP_API_KEY | (なし) | HTTP 認証用のベアラートークン(任意) |
リモート HTTP クライアントの設定
リモートサーバーに接続する Claude Desktop の場合:
{
"mcpServers": {
"claude-code-explorer": {
"url": "https://your-deployment.railway.app/mcp",
"headers": {
"Authorization": "Bearer your-secret-key"
}
}
}
}
デプロイ
Railway
- GitHub リポジトリをRailwayに接続します
- Railway が
mcp-server/Dockerfileを自動的に検出します - Railway ダッシュボードで環境変数を設定します:
MCP_API_KEY— シークレットのベアラートークンPORTは Railway によって自動設定されます
- デプロイすると、
your-app.railway.appで利用できます
または CLI で実行します:
railway init
railway up
Vercel
npx vercel
Vercel ダッシュボードで環境変数を設定します:
CLAUDE_CODE_SRC_ROOT— src/ファイルがバンドルされている場所へのパスMCP_API_KEY— ベアラートークン
Note:Vercel の関数はステートレスで、実行時間に制限があります(ホビー:10秒/Pro:60秒)。シンプルなツール呼び出しに最適です。永続的な SSE ストリームには、Railway または Docker を使用してください。
Docker
# From repo root
docker build -f mcp-server/Dockerfile -t claude-code-mcp .
docker run -p 3000:3000 -e MCP_API_KEY=your-secret claude-code-mcp
Fly.io、Render、AWS ECS、Google Cloud Run など、あらゆる Docker ホストで動作します。
プロンプト
サーバーは、ガイド付きの探索に使えるプロンプトテンプレートも公開しています。
| プロンプト | 説明 |
|---|---|
explain_tool | 特定のツールを詳しく解説します(入力スキーマ、権限、実行フロー) |
explain_command | スラッシュコマンドの仕組みを説明します |
architecture_overview | Claude Code のアーキテクチャ全体をガイド付きで紹介します |
how_does_it_work | 機能やサブシステム(例:「権限システム」、「MCP クライアント」、「クエリエンジン」)の仕組みを説明します |
compare_tools | 2 つのツールを並べて比較します |
使用例
接続すると、AI アシスタントに次のような質問をできます。
- 「Claude Code のツールをすべて一覧表示して」
- 「BashTool の実装を見せて」
- 「権限の確認方法を検索して」
- 「bridge ディレクトリにはどのファイルがある?」
- 「QueryEngine.ts の1〜100行目を読んで」
- 「MCP クライアントの接続はどのように動作する?」
explain_toolプロンプトに「FileEditTool」を指定して、詳細な解説を取得するhow_does_it_workに「bridge」を指定して、IDE との連携を理解する
MCP Registry への公開
このサーバーは GitHub Actions を通じて MCP Registry に公開されています。タグ付きリリース(v*)では、ワークフローが次の処理を行います。
- npm パッケージを npmjs.org に公開します
- GitHub OIDC を使用して MCP Registry に認証します
server.jsonメタデータをレジストリに公開します
手動で公開するには:
# Install the MCP Publisher CLI
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
# Authenticate (GitHub OAuth)
./mcp-publisher login github
# Publish
cd mcp-server
../mcp-publisher publish
レジストリ名:warrioraashuu-codemaster
開発
npm install
npm run dev # Watch mode TypeScript compilation
npm run build # Compile TypeScript to dist/
npm start # Run STDIO server
npm run start:http # Run HTTP server
アーキテクチャ
mcp-server/
├── src/
│ ├── server.ts — Shared MCP server (tools, resources, prompts) — transport-agnostic
│ ├── index.ts — STDIO entrypoint (local)
│ └── http.ts — HTTP + SSE entrypoint (remote)
├── api/
│ ├── index.ts — Vercel serverless function
│ └── vercelApp.ts — Express app for Vercel
├── Dockerfile — Docker build (Railway, Fly.io, etc.)
├── railway.json — Railway deployment config
├── package.json
└── tsconfig.json
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。