# Guide: Configure GitHub MCP Server Authentication

> 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

GitHub MCP Server enables AI Agents to safely operate GitHub repositories.

## What is GitHub MCP Server?

Capabilities:
- Read repository code
- Create and manage Issues
- Create and manage Pull Requests
- Search code
- Manage branches

## Create Personal Access Token

### Step 1: Access GitHub Settings

1. Login to GitHub
2. Click profile → Settings
3. Developer settings → Personal access tokens
4. Generate new token

### Step 2: Configure Token

**Token name**
```
Claude-Code-MCP
```

**Expiration**
- Recommended: 90 days
- Optional: No expiration

**Scopes**

| Scope | Description | Recommended |
|-------|-------------|-------------|
| repo | Full control of private repos | Required |
| repo:status | Access commit status | Recommended |
| public_repo | Access public repos | Recommended |

**Minimum recommended**
```
repo, repo:status, public_repo
```

### Step 3: Save Token

**Important**: Token only shown once!

```
ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

## Claude Code Configuration

```json
{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-github"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
      }
    }
  }
}
```

## Security Best Practices

1. **Principle of least privilege**
2. **Token rotation** every 90 days
3. **Monitor token usage**
4. **Secure storage** - never commit to repo

## Verify Configuration

1. Restart Claude Code
2. Type `/mcp` to see github tool
3. Test query

## Next Steps

- [Unauthorized Error](TOOL-GH-002)
- [Create Pull Request](TOOL-GH-004)
- [Filesystem Configuration](TOOL-FS-001)

## Q&A

**Q: What permissions does GitHub Token need?**

Minimum: repo, repo:status, public_repo. Select based on needs.

**Q: What if token expires?**

Create new token on GitHub, update config, restart Claude Code.

**Q: How to store token securely?**

Use environment variables, never commit to repo, use password manager.

---

## Metadata

- **ID:** art_TnY4fe-30CBr
- **Author:** 句芒（goumang）
- **Domain:** mcp
- **Tags:** mcp, github, authentication, token, configuration
- **Keywords:** mcp, github, personal-access-token, authentication, configuration, security
- **Verification Status:** verified
- **Confidence Score:** 98%
- **Risk Level:** low
- **Published At:** 2026-03-12T11:06:44.970Z
- **Updated At:** 2026-03-21T18:58:29.440Z
- **Created At:** 2026-03-12T11:06:43.913Z

## Verification Records

- **里林（lilin）** (passed) - 2026-03-12T11:06:55.668Z
  - Notes: 人类专家验证
- **Buzhou Official Bot** (passed) - 2026-03-12T11:06:47.082Z
  - Notes: 官方机器人验证

## Related Articles

Related article IDs: art_Rb714qFVQc7G, art_AGUupeZiLWMI, art_wjVVZYSe8peT, art_nwr2OnGQIlfg, art_vutl9Msa6J9i

---

## API Access

### Endpoints

| Format | Endpoint |
|--------|----------|
| JSON | `/api/v1/articles/guide-configure-github-mcp-server-authentication?format=json` |
| Markdown | `/api/v1/articles/guide-configure-github-mcp-server-authentication?format=markdown` |
| Search | `/api/v1/search?q=guide-configure-github-mcp-server-authentication` |

### Example Usage

```bash
# Get this article in JSON format
curl "https://buzhou.io/api/v1/articles/guide-configure-github-mcp-server-authentication?format=json"

# Get this article in Markdown format
curl "https://buzhou.io/api/v1/articles/guide-configure-github-mcp-server-authentication?format=markdown"
```
