The official GitHub MCP server lets your AI assistant create issues, open pull requests, search repositories, manage branches, and review code — all from your chat window. It runs as a Docker container with your GitHub Personal Access Token and connects to Claude Desktop, Cursor, or any MCP-compatible host. The npm package was deprecated in April 2025; the Docker image is the current official method.
Manage GitHub Repositories Directly from Your AI Assistant
The official GitHub MCP server (ghcr.io/github/github-mcp-server) gives your AI assistant direct access to the GitHub API. It can create and manage issues, open pull requests, search code across repositories, review diffs, manage branches, and handle file operations — all through natural language prompts. The server runs as a Docker container that authenticates with your Personal Access Token. This is the officially maintained server from GitHub, replacing the earlier npm-based package that was deprecated in April 2025.
Prerequisites
- Docker installed and running on your machine
- A GitHub account with a Personal Access Token (classic or fine-grained)
- Claude Desktop, Cursor, or another MCP-compatible AI host
- Basic familiarity with GitHub concepts (repos, issues, PRs)
Step-by-step guide
Create a GitHub Personal Access Token
Create a GitHub Personal Access Token
Go to github.com > Settings > Developer Settings > Personal Access Tokens. You can create either a classic token or a fine-grained token. For the MCP server, a classic token with repo, read:org, and read:user scopes covers most use cases. For fine-grained tokens, select the specific repositories and permissions you want the AI to access. Copy the token immediately — GitHub will not show it again.
1Required scopes for classic token:2- repo (full repository access)3- read:org (read organization data)4- read:user (read user profile)56Optional scopes:7- delete_repo (if you want AI to delete repos)8- admin:org (for organization management)Expected result: You have a GitHub Personal Access Token starting with ghp_ (classic) or github_pat_ (fine-grained).
Add the GitHub MCP server to your configuration
Add the GitHub MCP server to your configuration
Open your MCP host's configuration file. For Claude Desktop on macOS, that is ~/Library/Application Support/Claude/claude_desktop_config.json. Add a github entry in the mcpServers object that runs the Docker container with your token passed as an environment variable. The -i flag enables interactive mode for stdio transport, and --rm removes the container after it exits.
1{2 "mcpServers": {3 "github": {4 "command": "docker",5 "args": [6 "run", "-i", "--rm",7 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",8 "ghcr.io/github/github-mcp-server"9 ],10 "env": {11 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"12 }13 }14 }15}Expected result: Your configuration file contains the GitHub MCP server entry with your token.
Restart your AI host and verify the connection
Restart your AI host and verify the connection
Fully quit and reopen Claude Desktop, Cursor, or VS Code. The host will pull the Docker image on first run (this may take a minute). Once connected, you should see the GitHub server listed as active. In Claude Desktop, the hammer icon in the chat input indicates tools are available. Click it to see the full list of GitHub tools.
Expected result: The GitHub MCP server shows as connected and its tools appear in the available tools list.
Test by searching repositories or listing issues
Test by searching repositories or listing issues
Send a prompt asking the AI to interact with one of your GitHub repositories. Start with a read-only operation like listing issues or searching code to confirm everything works before trying write operations like creating issues or opening PRs.
1Example prompts:23"List the open issues in my-username/my-repo repository"45"Search for files containing 'TODO' in my-username/my-repo"67"Show me the latest 5 pull requests in my-username/my-repo"Expected result: The AI returns data from your GitHub repository, confirming the server is authenticated and working.
Create issues, branches, and pull requests through chat
Create issues, branches, and pull requests through chat
Once read operations work, try write operations. The AI can create issues with labels and assignees, create branches, push file changes, and open pull requests with descriptions. Each operation goes through the GitHub API using your token's permissions. Claude Desktop will show an approval dialog before executing each action.
1Example prompts:23"Create an issue in my-username/my-repo titled 'Add dark mode support' with labels 'enhancement' and 'ui'"45"Create a new branch called 'feature/dark-mode' from main in my-username/my-repo"67"Open a pull request from feature/dark-mode to main with a description of the dark mode changes"Expected result: The AI creates the requested GitHub resources and returns confirmation with links.
Configure for VS Code with the servers key
Configure for VS Code with the servers key
If you use VS Code with GitHub Copilot, the configuration uses the servers key instead of mcpServers. Create a .vscode/mcp.json file in your workspace root. The Docker command and arguments remain the same — only the top-level key changes.
1{2 "servers": {3 "github": {4 "command": "docker",5 "args": [6 "run", "-i", "--rm",7 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",8 "ghcr.io/github/github-mcp-server"9 ],10 "env": {11 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"12 }13 }14 }15}Expected result: VS Code recognizes the GitHub MCP server and Copilot can interact with your repositories.
Complete working example
1{2 "mcpServers": {3 "github": {4 "command": "docker",5 "args": [6 "run", "-i", "--rm",7 "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",8 "ghcr.io/github/github-mcp-server"9 ],10 "env": {11 "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"12 }13 }14 }15}1617// VS Code variant (.vscode/mcp.json):18// {19// "servers": {20// "github": {21// "command": "docker",22// "args": [23// "run", "-i", "--rm",24// "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",25// "ghcr.io/github/github-mcp-server"26// ],27// "env": {28// "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"29// }30// }31// }32// }3334// Key tools provided:35// - search_repositories: Find repos by keyword36// - get_file_contents: Read files from any repo37// - create_or_update_file: Push file changes38// - create_issue: Open new issues39// - list_issues: List and filter issues40// - create_pull_request: Open PRs41// - create_branch: Create new branches42// - search_code: Search code across repos43// - get_pull_request_diff: View PR changesCommon mistakes when using the GitHub MCP server
Why it's a problem: Using the deprecated npm package @modelcontextprotocol/server-github
How to avoid: The npm package was deprecated in April 2025. Use the official Docker image at ghcr.io/github/github-mcp-server instead. It is maintained directly by GitHub.
Why it's a problem: Forgetting to start Docker before launching the AI host
How to avoid: The GitHub MCP server runs as a Docker container. Make sure Docker Desktop is running before you open Claude Desktop or Cursor, or the server will fail to start.
Why it's a problem: Creating a token without sufficient scopes
How to avoid: If the AI gets permission errors, check your token scopes. The repo scope is required for most operations. Fine-grained tokens need explicit repository access and permissions for contents, issues, and pull requests.
Why it's a problem: Hardcoding the token in a shared or committed config file
How to avoid: Never commit your GitHub token to version control. If your config file is in a git repo, add it to .gitignore. Consider using environment variable references if your host supports them.
Best practices
- Use fine-grained tokens scoped to specific repositories rather than classic tokens with broad access
- Start with read-only operations to verify the connection before trying write operations
- Review the AI's proposed actions in the approval dialog before confirming destructive operations
- Rotate your Personal Access Token periodically and update the MCP config accordingly
- Combine with the Filesystem MCP server so the AI can read local code and push it to GitHub
- Use repository-specific tokens for different projects to limit blast radius
- Set token expiration dates rather than creating tokens that never expire
- Monitor your GitHub API rate limits — the AI can make many API calls in a single conversation
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to set up the GitHub MCP server so my AI assistant can manage my GitHub repositories. I use Claude Desktop on macOS and have Docker installed. Walk me through creating the right Personal Access Token, configuring the server, and testing it with my repo.
List all open issues labeled 'bug' in my-org/my-repo, then create a new branch called 'bugfix/batch-fix' and open a pull request that references each issue number in the description.
Frequently asked questions
Why does the GitHub MCP server use Docker instead of npx?
GitHub deprecated the npm-based MCP server package in April 2025 and moved to an official Docker image maintained at ghcr.io/github/github-mcp-server. The Docker image is the current supported distribution method and receives regular updates from GitHub.
Can the AI delete my repositories through the MCP server?
Only if your Personal Access Token includes the delete_repo scope. With standard repo scope, the AI can read, create, and modify repository contents but cannot delete entire repositories. Always use the minimum scopes necessary.
How do I use this with GitHub Enterprise?
Set the GITHUB_HOST environment variable in your MCP config to point to your GitHub Enterprise instance. Add it to the env object alongside your token: "GITHUB_HOST": "github.your-company.com".
Does the Docker image update automatically?
No. Docker caches the image locally after the first pull. To get updates, run 'docker pull ghcr.io/github/github-mcp-server' periodically. You can also use a specific tag instead of latest for version pinning.
Can I use this server to manage multiple GitHub accounts?
Each server instance uses one token. To access multiple accounts, add multiple github entries in your config with different names (like github-personal and github-work), each with its own token.
What if I need help integrating the GitHub MCP server into a larger CI/CD workflow?
For complex automation that combines GitHub MCP with deployment pipelines, testing, and monitoring, RapidDev can help design and implement the integration. The MCP server works best for interactive AI-assisted development rather than fully automated CI/CD.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation