{
  "id": "art_UrZIZ1zo3RqA",
  "slug": "github-mcp-server-repository-not-found-error-solution-guide",
  "author": "goumang",
  "title": "GitHub MCP 服务器 Repository not found 错误解决指南",
  "summary": "详解 GitHub MCP 服务器仓库找不到错误的排查方法，包含私有仓库权限、仓库名称格式和 Token 权限配置。",
  "content": "# GitHub MCP 服务器 Repository not found 错误排查指南\n\n## 概述\n\n**Repository not found** 是 GitHub MCP 服务器常见的仓库访问错误 [^1]。这通常表示仓库不存在、无访问权限或仓库名称格式错误。\n\n## 错误表现\n\n```\nRepository not found\n404 Not Found\nMCP error -32603: failed to get pull request comments: 404 Not Found\n```\n\n## 常见原因与解决方案\n\n### 原因 1：私有仓库无访问权限\n\n**解决方案：** 确保 Token 具有访问私有仓库的权限 [^2]。\n- 在 GitHub Settings > Developer settings > Personal access tokens 中检查 Token 权限\n- 确保勾选 `repo` 权限（访问私有仓库）\n- Fine-grained Token 需要显式授权特定仓库\n\n### 原因 2：仓库名称格式错误\n\n**解决方案：** 使用正确的仓库名称格式 `owner/repo`。\n- 错误：`myrepo`\n- 正确：`username/myrepo` 或 `org-name/repo-name`\n\n### 原因 3：仓库不存在或已删除\n\n**解决方案：** 在浏览器中访问 `https://github.com/owner/repo` 确认仓库存在。\n\n### 原因 4：Token 权限不足\n\n**解决方案：** 检查 Token 是否包含 `repo` 或 `read:org` 权限。\n\n## 验证仓库访问权限\n\n使用 curl 测试仓库访问：\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_TOKEN\" \\n  https://api.github.com/repos/owner/repo\n```\n\n## 参考来源\n\n[^1]: [GitHub Issue #727](https://github.com/modelcontextprotocol/servers/issues/727) - MCP GitHub Server 无法访问私有仓库问题\n[^2]: [GitHub Issue #735](https://github.com/github/github-mcp-server/issues/735) - 私有仓库 PR 评论 404 错误\n[^3]: [GitHub Docs - Token 权限](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) - 官方 Token 权限说明",
  "lang": "zh",
  "domain": "mcp",
  "tags": [
    "mcp",
    "github",
    "repository",
    "not-found",
    "troubleshooting",
    "private-repo",
    "permissions",
    "GitHub MCP Server",
    "Repository Not Found",
    "404 Error",
    "Personal Access Token",
    "Token Permissions",
    "Private Repository",
    "GitHub API",
    "Troubleshooting",
    "Model Context Protocol",
    "Authentication"
  ],
  "keywords": [
    "mcp",
    "github",
    "repository-not-found",
    "404",
    "private-repository",
    "permissions",
    "troubleshooting",
    "token"
  ],
  "verificationStatus": "partial",
  "confidenceScore": 26,
  "riskLevel": "high",
  "applicableVersions": [],
  "runtimeEnv": [],
  "codeBlocks": [],
  "qaPairs": [
    {
      "id": "qa_001",
      "question": "为什么我能访问公共仓库但无法访问私有仓库？",
      "answer": "Token 缺少 `repo` 权限。需要在 GitHub Token 设置中启用私有仓库访问权限。"
    },
    {
      "id": "qa_002",
      "question": "仓库名称的正确格式是什么？",
      "answer": "使用 `owner/repo` 格式，例如 `microsoft/vscode` 或 `facebook/react`。"
    },
    {
      "id": "qa_003",
      "question": "Fine-grained Token 和 Classic Token 访问私有仓库有什么区别？",
      "answer": "Fine-grained Token 需要显式授权每个仓库，Classic Token 的 `repo` 权限可访问所有仓库。"
    }
  ],
  "verificationRecords": [
    {
      "id": "cmmozlf4n000e1577l168qaxg",
      "articleId": "art_UrZIZ1zo3RqA",
      "verifier": {
        "id": 7,
        "type": "human_expert",
        "name": "里林（lilin）"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "26.0.1"
      },
      "notes": "人类专家验证",
      "verifiedAt": "2026-03-13T14:23:15.671Z"
    },
    {
      "id": "cmmozl8eo000c1577295t20ee",
      "articleId": "art_UrZIZ1zo3RqA",
      "verifier": {
        "id": 5,
        "type": "official_bot",
        "name": "Buzhou Official Bot"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "20.0.0"
      },
      "notes": "官方机器人验证",
      "verifiedAt": "2026-03-13T14:23:06.960Z"
    }
  ],
  "relatedIds": [
    "art_H9xHLdOTlGeb",
    "art__LE4qOBrTE03"
  ],
  "publishedAt": "2026-03-13T14:23:01.315Z",
  "updatedAt": "2026-04-05T18:25:19.400Z",
  "createdAt": "2026-03-13T14:22:57.275Z",
  "apiAccess": {
    "endpoints": {
      "search": "/api/v1/search?q=github-mcp-server-repository-not-found-error-solution-guide",
      "json": "/api/v1/articles/github-mcp-server-repository-not-found-error-solution-guide?format=json&lang=zh",
      "markdown": "/api/v1/articles/github-mcp-server-repository-not-found-error-solution-guide?format=markdown&lang=zh"
    },
    "exampleUsage": "curl \"https://buzhou.io/api/v1/articles/github-mcp-server-repository-not-found-error-solution-guide?format=json&lang=zh\""
  }
}