用途:在拿到 GitHub 仓库 URL 或 owner/repo 路径时,读取该仓库的文档并检索代码,帮助理解项目。
主要能力:通过 gitmcp.io MCP 服务访问仓库文档与代码。URL 转换规则为 github.com/owner/repo 对应 gitmcp.io/owner/repo,例如 https://github.com/karpathy/llm-council 对应 https://gitmcp.io/karpathy/llm-council。
使用方式:scripts/gitmcp.py 提供命令行访问。列出可用工具:python3 scripts/gitmcp.py list-tools owner/repo。获取完整文档(README、docs 等):python3 scripts/gitmcp.py fetch-docs owner/repo。在文档内做语义搜索:python3 scripts/gitmcp.py search-docs owner/repo "query"。用 GitHub Search API 做精确匹配的代码搜索:python3 scripts/gitmcp.py search-code owner/repo "function_name"。抓取文档中提到的 URL 内容:python3 scripts/gitmcp.py fetch-url owner/repo "https://example.com/doc"。直接调用任意 MCP 工具:python3 scripts/gitmcp.py call owner/repo tool_name '{"arg": "value"}'。
工具命名:工具名会按仓库名加下划线前缀动态生成,如 karpathy/llm-council 对应 fetch_llm_council_documentation,facebook/react 对应 fetch_react_documentation,my-org/my-repo 对应 fetch_my_repo_documentation。可用 MCP 工具包括 fetch_{repo}documentation(获取全部文档,一般性问题先调用)、search{repo}documentation(文档内语义搜索)、search{repo}_code(经 GitHub API 精确匹配搜索代码,返回匹配文件)、fetch_generic_url_content(抓取文档中引用的任意 URL,遵守 robots.txt)。
建议流程:先获取文档了解项目,再用 search-docs 查询具体用法或功能,用 search-code 查找实现或函数,用 fetch-url 获取外部引用。
限制:资料未提供鉴权、速率限制、支持平台及错误处理等细节,暂未提供。