GitHub MCP — Repository Management for AI Agents
Official GitHub MCP server that gives AI agents access to repos, issues, PRs, code search, and Actions. Create branches, review PRs, and manage projects via natural language. 5,000+ stars.
What it is
The GitHub MCP server is the official Model Context Protocol integration for GitHub. It gives AI agents access to repositories, issues, pull requests, code search, GitHub Actions, and project management through natural language commands.
The server exposes GitHub's API as MCP tools, allowing AI coding assistants like Claude Code to create branches, open pull requests, review code changes, manage issues, and trigger workflows without the developer switching to the GitHub UI.
How it saves time or tokens
GitHub operations like creating a PR, adding reviewers, and linking issues involve multiple UI steps or API calls. The MCP server wraps these into single tool invocations that AI agents can execute as part of their workflow.
For AI-assisted development, the GitHub MCP server enables end-to-end workflows: an agent writes code, creates a branch, opens a PR, and links related issues, all in one session.
How to use
- Configure the GitHub MCP server in Claude Code:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
}
}
}
}
- Use natural language commands in Claude Code:
> Create a new branch called 'feature/auth' and open a PR with these changes
> List all open issues labeled 'bug' in the repository
> Review the latest PR and suggest improvements
- The agent uses GitHub MCP tools to execute these operations.
Example
# Example MCP tool calls the agent makes:
# 1. create_branch(repo='myorg/myapp', branch='feature/auth')
# 2. create_pull_request(
# repo='myorg/myapp',
# title='Add user authentication',
# body='Implements JWT-based auth...',
# head='feature/auth',
# base='main'
# )
# 3. add_labels(repo='myorg/myapp', issue_number=42, labels=['enhancement'])
Related on TokRepo
- MCP GitHub Integration — Detailed GitHub MCP server documentation
- AI Tools for Coding — AI development tools with GitHub integration
Common pitfalls
- Using a personal access token with too broad permissions. Create a fine-grained token with only the permissions the agent needs (repo, issues, pull requests).
- Not reviewing agent-created PRs before merging. The agent can open PRs automatically, but human review is still essential for code quality and correctness.
- Forgetting rate limits. GitHub API has rate limits (5,000 requests/hour for authenticated users). Heavy agent usage can hit these limits. Monitor usage and implement caching.
- Failing to review community discussions and changelogs before upgrading. Breaking changes in major versions can disrupt existing workflows. Pin versions in production and test upgrades in staging first.
Frequently Asked Questions
The server supports repository browsing, file reading, branch creation, commit creation, pull request management, issue management, code search, and GitHub Actions workflow triggering. It covers most GitHub API operations that developers use regularly.
Yes. The GitHub MCP server is maintained in the official Model Context Protocol organization on GitHub. It uses the standard GitHub API and requires a personal access token for authentication.
Yes. The agent can read PR diffs, file changes, and comments. It can add review comments, approve or request changes, and suggest code modifications. Human review should still be the final gate before merging.
Yes. The MCP server can list, trigger, and check the status of GitHub Actions workflows. An agent can trigger a CI pipeline, wait for results, and report back within a single conversation.
For most operations, the token needs repo (full repository access), issues (read/write), and pull requests (read/write) scopes. For GitHub Actions, add the workflow scope. Use fine-grained tokens to limit access to specific repositories.
Citations (3)
- GitHub MCP Server— Official GitHub MCP server for AI agent repository management
- GitHub API Docs— GitHub REST API documentation
- MCP Specification— Model Context Protocol specification
Related on TokRepo
Source & Thanks
Created by Anthropic and GitHub. Licensed under MIT.
server-github — ⭐ 5,000+
Thanks for making GitHub a first-class MCP integration.