/ 目錄 / 演練場 / GitMCP
● 社群 idosal ⚡ 即開即用

GitMCP

作者 idosal · idosal/git-mcp

將任何公開 GitHub 儲存庫轉為即時 MCP 端點——把 README、原始碼和文件拉進 Claude,不需 clone,也不再幻想不存在的 API。

GitMCP 在 gitmcp.io/{owner}/{repo} 托管遠端 MCP 伺服器。Claude 可透過工具擷取文件、搜尋儲存庫、列出檔案、讀取指定路徑——所有操作都針對最新的 main 分支。從根本解決使用陌生套件時「Claude 捏造了不存在的函式」這類問題。

為什麼要用

核心特性

即時演示

實際使用效果

git-mcp-idosal.replay ▶ 就緒
0/0

安裝

選擇你的客戶端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "git-mcp-idosal": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitmcp.io/{owner}/{repo}"
      ]
    }
  }
}

開啟 Claude Desktop → Settings → Developer → Edit Config。儲存後重啟應用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "git-mcp-idosal": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitmcp.io/{owner}/{repo}"
      ]
    }
  }
}

Cursor 使用與 Claude Desktop 相同的 mcpServers 格式。專案級設定優先於全域。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "git-mcp-idosal": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitmcp.io/{owner}/{repo}"
      ]
    }
  }
}

點擊 Cline 側欄中的 MCP Servers 圖示,然後選 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "git-mcp-idosal": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitmcp.io/{owner}/{repo}"
      ]
    }
  }
}

格式與 Claude Desktop 相同。重啟 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "git-mcp-idosal",
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitmcp.io/{owner}/{repo}"
      ]
    }
  ]
}

Continue 使用伺服器物件陣列,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "git-mcp-idosal": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "mcp-remote",
          "https://gitmcp.io/{owner}/{repo}"
        ]
      }
    }
  }
}

加入 context_servers。Zed 儲存後熱重載。

claude mcp add git-mcp-idosal -- npx -y mcp-remote https://gitmcp.io/{owner}/{repo}

一行命令搞定。用 claude mcp list 驗證,claude mcp remove 移除。

使用場景

實戰用法: GitMCP

如何讓 Claude 停止對半生不熟的套件亂發明 API

👤 使用截止日後的新套件、或冷門 SDK 的開發者 ⏱ ~15 min beginner

何時使用: 你在整合某個套件,Claude 卻一直發明不存在的方法名稱。

前置條件
  • 知道套件的 GitHub 路徑 — 例如 pydantic/pydantic-ai——把 owner/repo 貼到 gitmcp.io
步驟
  1. 加入指向該套件的 GitMCP
    Add the GitMCP server for pydantic/pydantic-ai to my config, then list the top-level docs files.✓ 已複製
    → 工具回傳 README.md 加上 /docs 目錄樹——沒有捏造的路徑
  2. 對真實原始碼提問
    Using the GitMCP for pydantic-ai, show me the actual constructor signature for Agent — quote it from source, don't summarize.✓ 已複製
    → 帶有原始檔案及行號參照的確切簽名
  3. 執行以驗證
    Write a minimal runnable example using only what you saw in the repo. If something is missing, say so — don't guess.✓ 已複製
    → 範例可正常執行;Claude 標記所有缺少的部分

結果: 與套件實際 API 完全吻合的整合成果,而非似是而非的虛構代碼。

注意事項
  • 套件位於 monorepo 子目錄中 — 先用 tree 工具找到正確的套件根目錄,再開始讀取
搭配使用: context7 · github

在 fork 前快速稽核一個不熟悉的開源儲存庫

👤 評估相依套件的工程師 ⏱ ~10 min beginner

何時使用: 你即將採用某個套件,想在不 clone 的情況下先了解它的底細。

步驟
  1. 概覽
    Use GitMCP for owner/repo. Summarize the architecture from README + top-level directories in 8 lines.✓ 已複製
    → 有具體目錄作為依據的摘要,而非行銷話術
  2. 風險掃描
    Pull the package manifest and list every dependency. Flag any that look abandoned or have known CVE history.✓ 已複製
    → 附有各項評估的相依套件清單
  3. 適用性確認
    Is there a plugin/extension API I can use, or would I need to fork? Cite the code.✓ 已複製
    → 附有檔案路徑的代碼佐證回答

結果: 5 分鐘內做出 fork/採用/跳過的決策,且有實際儲存庫內容作為依據。

注意事項
  • 沒有 token 的私有儲存庫 — 使用自架的 Docker 映像檔並設定 GITHUB_TOKEN
搭配使用: github

組合

與其他 MCP 搭配,撬動十倍槓桿

git-mcp-idosal + context7

疊加兩層最新文件——Context7 提供官方 SDK 文件,GitMCP 提供儲存庫原始碼

Compare what context7 says about Foo.bar() with the actual source via GitMCP. Any drift?✓ 已複製
git-mcp-idosal + github

GitMCP 負責唯讀文件,GitHub MCP 負責建立 PR 和 issue

Read the contribution guide via GitMCP, then open a well-formed PR via GitHub MCP.✓ 已複製

工具

此 MCP 暴露的能力

工具輸入參數何時呼叫成本
fetch_documentation owner, repo 探索陌生儲存庫時的第一個呼叫 1 GitHub API call
search_documentation owner, repo, query: str 查找提及特定概念的文件段落 1 API call
fetch_url_content url: str 透過原始 URL 取得特定檔案 free
search_code owner, repo, query: str 尋找某個符號的定義位置或使用處 1 API call

成本與限制

運行它的成本

API 配額
GitHub 未認證:每個 IP 每小時 60 次請求。已認證:每小時 5000 次。
每次呼叫 Token 數
500–5000,視檔案大小而定
費用
免費(托管版)
提示
改用 search_* 工具,而非傾印整個檔案

安全

權限、密鑰、影響範圍

最小權限: public_repo (for private access)
憑證儲存: 自架模式下以環境變數儲存 token
資料出站: gitmcp.io(托管版)或你自己的實例
切勿授予: repo:write

故障排查

常見錯誤與修復

403 rate limit exceeded

以 PAT 自架或等候——未認證限制為每小時 60 次

驗證: Check X-RateLimit-Remaining header
Repo not found

確認 owner/repo 拼寫無誤且儲存庫為公開。若是私有儲存庫,請使用自架映像檔。

Returns truncated content

GitHub API 對原始 blob 有 1MB 上限。大型檔案請改用 search_code。

替代方案

GitMCP 對比其他方案

替代方案何時用它替代權衡
Context7你想要精心整理的套件文件介面,而非原始儲存庫Context7 只索引部分套件;GitMCP 涵蓋所有公開儲存庫
GitHub MCP (official)你也需要 PR、issue 或寫入操作GitHub MCP 有寫入能力(需更嚴格管控);GitMCP 是唯讀的

更多

資源

📖 閱讀 GitHub 上的官方 README

🐙 查看未解決的 issue

🔍 瀏覽全部 400+ MCP 伺服器和 Skills