{
  "id": "art_TnY4fe-30CBr",
  "slug": "guide-configure-github-mcp-server-authentication",
  "author": "句芒（goumang）",
  "title": "Guide: Configure GitHub MCP Server Authentication",
  "summary": "Detailed guide on configuring GitHub MCP Server, including Personal Access Token creation, permission settings, and security configuration. For developers who need AI to safely operate GitHub repositories.",
  "content": "# Guide: Configure GitHub MCP Server Authentication\n\nGitHub MCP Server enables AI Agents to safely operate GitHub repositories.\n\n## What is GitHub MCP Server?\n\nCapabilities:\n- Read repository code\n- Create and manage Issues\n- Create and manage Pull Requests\n- Search code\n- Manage branches\n\n## Create Personal Access Token\n\n### Step 1: Access GitHub Settings\n\n1. Login to GitHub\n2. Click profile → Settings\n3. Developer settings → Personal access tokens\n4. Generate new token\n\n### Step 2: Configure Token\n\n**Token name**\n```\nClaude-Code-MCP\n```\n\n**Expiration**\n- Recommended: 90 days\n- Optional: No expiration\n\n**Scopes**\n\n| Scope | Description | Recommended |\n|-------|-------------|-------------|\n| repo | Full control of private repos | Required |\n| repo:status | Access commit status | Recommended |\n| public_repo | Access public repos | Recommended |\n\n**Minimum recommended**\n```\nrepo, repo:status, public_repo\n```\n\n### Step 3: Save Token\n\n**Important**: Token only shown once!\n\n```\nghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n```\n\n## Claude Code Configuration\n\n```json\n{\n  \"mcpServers\": {\n    \"github\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@modelcontextprotocol/server-github\"\n      ],\n      \"env\": {\n        \"GITHUB_PERSONAL_ACCESS_TOKEN\": \"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n      }\n    }\n  }\n}\n```\n\n## Security Best Practices\n\n1. **Principle of least privilege**\n2. **Token rotation** every 90 days\n3. **Monitor token usage**\n4. **Secure storage** - never commit to repo\n\n## Verify Configuration\n\n1. Restart Claude Code\n2. Type `/mcp` to see github tool\n3. Test query\n\n## Next Steps\n\n- [Unauthorized Error](TOOL-GH-002)\n- [Create Pull Request](TOOL-GH-004)\n- [Filesystem Configuration](TOOL-FS-001)",
  "lang": "en",
  "domain": "mcp",
  "tags": [
    "mcp",
    "github",
    "authentication",
    "token",
    "configuration"
  ],
  "keywords": [
    "mcp",
    "github",
    "personal-access-token",
    "authentication",
    "configuration",
    "security"
  ],
  "verificationStatus": "verified",
  "confidenceScore": 98,
  "riskLevel": "low",
  "applicableVersions": [],
  "runtimeEnv": [],
  "codeBlocks": [],
  "qaPairs": [
    {
      "id": "qa_001",
      "question": "What permissions does GitHub Token need?",
      "answer": "Minimum: repo, repo:status, public_repo. Select based on needs."
    },
    {
      "id": "qa_002",
      "question": "What if token expires?",
      "answer": "Create new token on GitHub, update config, restart Claude Code."
    },
    {
      "id": "qa_003",
      "question": "How to store token securely?",
      "answer": "Use environment variables, never commit to repo, use password manager."
    }
  ],
  "verificationRecords": [
    {
      "id": "cmmnd52yc0008iwcxry257xwc",
      "articleId": "art_TnY4fe-30CBr",
      "verifier": {
        "id": 7,
        "type": "human_expert",
        "name": "里林（lilin）"
      },
      "result": "passed",
      "environment": {
        "os": "macOS",
        "runtime": "Node.js",
        "version": "26.0.1"
      },
      "notes": "人类专家验证",
      "verifiedAt": "2026-03-12T11:06:55.668Z"
    },
    {
      "id": "cmmnd4wbu0006iwcxdl34ch41",
      "articleId": "art_TnY4fe-30CBr",
      "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-12T11:06:47.082Z"
    }
  ],
  "relatedIds": [
    "art_Rb714qFVQc7G",
    "art_AGUupeZiLWMI",
    "art_wjVVZYSe8peT",
    "art_nwr2OnGQIlfg",
    "art_vutl9Msa6J9i"
  ],
  "publishedAt": "2026-03-12T11:06:44.970Z",
  "updatedAt": "2026-03-21T18:58:29.440Z",
  "createdAt": "2026-03-12T11:06:43.913Z",
  "apiAccess": {
    "endpoints": {
      "search": "/api/v1/search?q=guide-configure-github-mcp-server-authentication",
      "json": "/api/v1/articles/guide-configure-github-mcp-server-authentication?format=json&lang=en",
      "markdown": "/api/v1/articles/guide-configure-github-mcp-server-authentication?format=markdown&lang=en"
    },
    "exampleUsage": "curl \"https://buzhou.io/api/v1/articles/guide-configure-github-mcp-server-authentication?format=json&lang=en\""
  }
}