Quick takeaways
- Use a fine-grained personal access token with the smallest set of repositories and permissions.
- Start read-only: issues, code search, file inspection, and pull request summaries.
- Require human approval before any write action, including comments, issues, or pull requests.
MCP for developer tools
Fireship covers MCP servers and how they connect AI agents to code repositories and developer tools.
What the GitHub MCP server does
The GitHub MCP server exposes GitHub tools to Claude Desktop. It lets the assistant read repository metadata, list issues and pull requests, search code, inspect file contents, and, with the right permissions, create or update issues and pull requests.
Used well, it turns Claude into a research pair for code review, issue triage, and release notes drafting. Used carelessly, it can leak private repositories or create unwanted changes. The setup matters as much as the tool.
Prerequisites
- Claude Desktop installed.
- Node.js 18 or newer.
- A GitHub account with access to the repositories you want to query.
Create a GitHub token
Go to GitHub Settings > Developer settings > Personal access tokens > Fine-grained tokens. Create a token that grants access only to the repositories Claude needs. Avoid classic tokens unless you have a specific reason; fine-grained tokens are easier to scope and rotate.
Name the token clearly, set a short expiration, and copy the token value immediately. GitHub shows it only once.
Claude Desktop config
Open claude_desktop_config.json and add the GitHub MCP server under mcpServers. The official server is distributed as a Docker image, so you can run it without installing Node packages directly.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "REPLACE_ME"
}
}
}
}
Replace REPLACE_ME with your fine-grained token. If Docker is not available, use the npx-based distribution in the server documentation. Restart Claude Desktop after saving the file.
Scopes and permissions
Fine-grained tokens let you pick repository access and permissions separately. Start with read-only scopes and add writes only when a workflow proves reliable.
Use cases
- Issue triage: Ask Claude to summarize open issues, group them by label, and suggest priorities.
- Code review prep: Let the assistant read a pull request diff and draft review notes before you publish them.
- Release notes: Pull merged pull requests since the last tag and draft a changelog.
- Repository exploration: Search for patterns across files when onboarding to a new codebase.
For deeper code workflows, pair this guide with How to use AI coding agents effectively.
Safety considerations
- Token scope: Limit the token to specific repositories, not every repository you can access.
- Expiration: Set a short expiration and rotate tokens regularly.
- Approval gates: Require human confirmation before Claude creates issues, comments, or pull requests.
- Audit: Review token usage in GitHub security logs to catch unexpected access.
- Secrets hygiene: Never paste the token into a chat window or commit the config file.
Without AI vs. with AI
| Task | Without AI | With AI |
|---|---|---|
| Issue triage | Developers open issues one by one to understand context. | Claude reads issue titles, bodies, and comments through the MCP server and summarizes the backlog. |
| Code search | Engineers grep across files or use the GitHub UI to find references. | Claude searches code and file contents conversationally through GitHub MCP. |
| Release notes | A maintainer manually collects PR titles and changes for a release. | Claude drafts release notes from merged pull requests and commit context. |
| Token scoping | Classic tokens grant broad access and are hard to rotate. | Fine-grained tokens limit repositories and permissions to only what Claude needs. |
| Review gates | AI-generated comments or PRs are posted without inspection. | Human review is required before any write action created by the MCP server is published. |
FAQ
Can the GitHub MCP server push code?
Not directly. It can draft pull requests and issues, but pushing commits still requires local git operations and your approval.
Should I use a classic or fine-grained token?
Prefer fine-grained tokens. They are scoped to specific repositories and permissions, which limits blast radius if the token leaks.
Does this work with GitHub Enterprise?
Yes, if the server supports the GitHub Enterprise API endpoint. Set the API base URL in the server environment variables.
Can Claude read private repositories?
Only if the token has access to them. Keep private repositories out of scope unless you need them.
What should I do if the server does not appear in Claude?
Restart Claude Desktop, check the JSON syntax, confirm Docker is running, and inspect the logs for stderr messages.
What can the GitHub MCP server do?
It can read repository metadata, list issues and pull requests, search code, inspect files, and create updates with the right permissions.
Which GitHub token should I use?
Use a fine-grained personal access token scoped to only the repositories Claude needs, with a short expiration.
Is GitHub MCP read-only by default?
The server capabilities depend on the token scopes. Start with read-only scopes for issues, pull requests, and code.
Can Claude create pull requests through MCP?
Yes, if the token has write permissions, but require human review before any AI-created PR is submitted.
How do I install the GitHub MCP server?
Add the Docker or npx-based server to claude_desktop_config.json under mcpServers and restart Claude Desktop.