一行命令探索Claude Code源码:MCP Server完全配置指南(附VS Code/Cursor用法)
一行命令探索Claude Code源码MCP Server完全配置指南附VS Code/Cursor用法【免费下载链接】claude-codeClaude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.项目地址: https://gitcode.com/gh_mirrors/claudecode5/claude-codeClaude Code 是运行在终端里的 Agentic 编程工具它理解你的代码库、执行常规任务、解释复杂代码并处理 Git 流程全部通过自然语言完成。而这份源码仓库自带一个MCP ServerClaude Code Explorer只需一行命令就能让 Claude Desktop、VS Code、Cursor 等客户端直接读遍全部 51 万行源码——本指南带你从零配置到上手提问。为什么需要这个 MCP ServerMCPModel Context Protocol是 AI 客户端与外部工具/数据源之间的标准协议。本仓库在mcp-server/目录内置了一个独立服务把整个代码库变成 AI 可以交互浏览的资料库8 个工具列出全部 40 Agent 工具、50 斜杠命令读取任意工具/命令实现正则搜索整个源码树3 类资源架构总览、工具注册表、命令注册表5 个提示模板explain_tool、explain_command、architecture_overview、how_does_it_work、compare_tools。核心价值不用手动翻 1900 个文件直接问 AIFileEditTool 是怎么实现权限检查的即可。 服务核心逻辑见 mcp-server/src/server.tslist_tools工具注册处。最快安装步骤一行命令服务端已发布到 npm无需克隆仓库在 Claude Code 中直接执行claude mcp add warrioraashuu-codemaster -- npx -y warrioraashuu-codemaster一条命令完成注册客户端重启后即可看到新增的 8 个工具。从源码构建适合想读服务实现的开发者git clone https://gitcode.com/gh_mirrors/claudecode5/claude-code cd claude-code/mcp-server npm install npm run build构建产物在mcp-server/dist/STDIO 入口为 mcp-server/src/index.ts。VS Code 配置方法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 } } } }${workspaceFolder}变量会自动解析为当前工作区路径所以只要仓库克隆在 VS Code 里打开即可无需写死绝对路径。配置细节参考 mcp-server/README.md。Cursor 配置文件写法Cursor 使用全局配置文件~/.cursor/mcp.jsonmacOS/Linux 为~/.cursor/mcp.json{ mcpServers: { claude-code-explorer: { command: node, args: [/你的绝对路径/claude-code/mcp-server/dist/index.js], env: { CLAUDE_CODE_SRC_ROOT: /你的绝对路径/claude-code/src } } } }保存后在 Cursor 的 Settings → MCP 中重启该服务器即可。三个关键环境变量最常踩的坑变量默认值说明CLAUDE_CODE_SRC_ROOTdist/上两级的../src指向 Claude Code 的src/目录路径不对会导致搜索为空PORT3000HTTP 模式端口仅远程部署时需要MCP_API_KEY无HTTP 模式下客户端需携带Authorization: Bearer key默认路径解析逻辑在 mcp-server/src/server.ts源码指向了错误的src/目录时优先检查这里。远程 HTTP 模式与 Docker 部署除了本地 STDIO服务还支持 Streamable HTTP/mcp和旧版 SSE/sse两种远程传输方式入口在 mcp-server/src/http.ts# 本地 HTTP 模式 npm run start:http # 带鉴权 MCP_API_KEYyour-secret-token npm run start:http# Docker 一键部署Railway / Fly.io / Cloud Run 通用 docker build -f mcp-server/Dockerfile -t claude-code-mcp . docker run -p 3000:3000 -e MCP_API_KEYyour-secret claude-code-mcp远程部署后Claude Desktop 只需在配置里填url Bearer Token 即可接入。配置完成后直接问这些问题连接成功后试试这些自然语言提问比翻文件快 10 倍列出 Claude Code 的全部工具给我看 BashTool 的实现搜索权限检查是在哪里执行的bridge 目录里有哪些文件使用explain_tool模板 FileEditTool → 得到输入 Schema、权限模型、执行流程的完整拆解使用how_does_it_work模板 query engine → 理解核心查询管线提示模板注册位置见 mcp-server/src/server.ts。移除与自定义# 自定义源码路径-e 注入环境变量 claude mcp add claude-code-explorer -e CLAUDE_CODE_SRC_ROOT/path/to/src -- node /path/to/mcp-server/dist/index.js # 移除 claude mcp remove claude-code-explorer延伸阅读配合文档快速上手资料说明docs/architecture.md核心管线、启动序列、状态管理docs/tools.md全部约 40 个 Agent 工具目录docs/commands.md全部约 85 个斜杠命令分类docs/exploration-guide.md代码库导航路径与搜索技巧mcp-server/README.mdMCP Server 完整说明小结懒人手速claude mcp add warrioraashuu-codemaster -- npx -y warrioraashuu-codemaster一行搞定VS Code 用户在.vscode/mcp.json里加一段 stdio 配置${workspaceFolder}自动定位源码Cursor 用户改~/.cursor/mcp.json记得填绝对路径遇到搜索结果为空先检查CLAUDE_CODE_SRC_ROOT是否指向正确的src/目录。配置完成后你拥有的不再是一份 51 万行的源码而是一个随问随答的Claude Code 内部专家。✅【免费下载链接】claude-codeClaude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.项目地址: https://gitcode.com/gh_mirrors/claudecode5/claude-code创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考