GitHub MCP server: Use cases, setup, and integration guide
TL;DR:
The GitHub MCP server acts as a translator between your AI assistant and the GitHub API, letting tools like Claude read files, review pull requests, and search your codebase without copy-pasting code.
Local setup requires Docker (or a compiled Go binary) and a Personal Access Token, but managing token expiry and rate limits creates ongoing maintenance work that compounds fast across multiple machines.
GitHub limits authenticated personal accounts to 5,000 requests per hour, and a recursive agent with a poorly designed polling loop can burn through that budget fast.
Composio gives agents access to 1,000+ pre-built integrations, routed through the MCP Gateway's per-team endpoint, with sandboxed execution and automatic retries for recoverable failures, and self-learning distilled from 300M+ monthly calls that makes repeat tasks 30% more accurate on 2× fewer tokens: token custody and SOC 2 Type II and ISO 27001-certified credential management are included.
The free tier gives you 100,000 tool calls per month with no credit card required.
Expired GitHub Personal Access Tokens sitting in plain-text config files can cause workflow failures that are hard to diagnose. This guide walks through the native local setup step by step, shows exactly where the maintenance burden accumulates, and explains how Composio's managed MCP Gateway handles that overhead automatically.
Core concepts of GitHub MCP integration
Enabling AI access to GitHub data
Model Context Protocol (MCP) is a universal connector that lets AI assistants read data from external tools and write data back to them. Think of it as a translation layer: your AI client sends a natural language request, the MCP server converts it into a precise GitHub API call, and the result comes back as structured data the model can reason about.
Here's what happens at each step:
Client request: You ask Claude to "summarize the open pull requests in this repo."
MCP translation: The GitHub MCP server converts your request into a
GET /repos/{owner}/{repo}/pullsAPI call with the correct parameters.API response: GitHub returns JSON, and the MCP server formats it into LLM-friendly output.
Model output: Claude presents a readable summary without you touching a single API header.
This flow works with MCP-compatible clients, including Claude Desktop, Cursor, VS Code with GitHub Copilot, Windsurf, and Zed.
Standard GitHub MCP server features
The official GitHub MCP server exposes toolsets grouped by function: repositories, issues, pull requests, discussions, code search, GitHub Actions workflows, and organization management. You can enable or disable specific groups using the --toolsets flag, which keeps the tool list focused for the workflows you're actually running.
That local control is useful for single-machine setups, but the native server stops well short of the full GitHub API surface. Our GitHub toolkit on Composio gives agents access to 800+ GitHub methods across the same surface area. Because we build and maintain the underlying tools rather than proxying another MCP server, the schemas stay formatted for LLM consumption and keep pace with GitHub API changes without requiring you to update npm packages manually.
Feature | Local setup (native MCP) | Remote setup (Composio MCP Gateway) |
|---|---|---|
Setup time | Requires Node.js, config files | One-click OAuth, no config file editing |
Token custody | Stored locally in plain text config files | Encrypted at rest (SOC 2 Type II certified) |
Maintenance | Manual token refreshes, rate limit handling | Automated refreshes, managed auth layer |
Execution & recovery | Manual error handling, no retry logic | Sandboxed execution and automatic retries for recoverable failures |
Tool coverage | Standard GitHub API methods | 800+ GitHub methods |
Practical ways to use GitHub data
Automated code reviews and PR summaries
An agent connected to the GitHub MCP server can pull a pull request diff, read the changed files, and generate a structured review summary from a single prompt. You can prompt the agent to review a PR and highlight security concerns, and it can return a summary with code references. This keeps review documentation consistent without making reviewers write boilerplate comments by hand.
Enable repository access for AI tools
Pasting entire files into Claude is a fast way to blow through your context window. With the MCP server running, Claude Desktop and Cursor can read code directly from your repository, letting the model reference specific files, search across the codebase, and answer questions about structure without you manually copying anything.
Manage GitHub issues via MCP
Through Composio's integration toolkit, agents can create, label, and assign issues based on chat context. If your AI assistant identifies a bug or a follow-up task during a conversation, it can open the issue directly rather than asking you to do it manually. The native GitHub MCP server also supports creating, updating, and managing issues including labeling and assignment operations.
Auto-generate docs from your codebase
An agent with repository access can read code structure and write markdown documentation that reflects the current state of your codebase. You can prompt the agent to read a specific module and generate documentation explaining the logic, and it can create docs that match your implementation. This keeps docs in sync with code changes without a separate documentation sprint.
Required accounts and tokens for successful setup
Set up GitHub authentication scopes
Personal Access Tokens come in two forms. Classic PATs grant broad permissions across all your repositories and can be set to never expire, making them convenient but risky. Fine-grained PATs let you specify over 50 granular permissions across repository, organization, and user APIs, which is the right choice for MCP server auth.
For standard MCP use cases covering pull request access and code reading, the minimum scopes you need on a classic PAT are repo (full repository access) and read:org if you need organization-level data. For fine-grained tokens, grant only the repository permissions required for the specific workflows you're running.
Storing a PAT in a plain text config file carries real risk. If an attacker gains access to your machine, they inherit your full GitHub permissions, including the ability to push malicious code, clone private repositories, and access credentials stored in repo files. We recommend fine-grained tokens with repository-specific scope to limit the blast radius if a token is ever compromised.
Select an MCP-ready host app
The clients that support GitHub MCP connections include Claude Desktop, Cursor, VS Code with GitHub Copilot, Windsurf, Zed, Replit, and Continue.dev. Any MCP-compatible client can connect to any MCP server, and remote hosted endpoints are now the default for most 2026 workflows. This guide uses Claude Desktop for the configuration examples below.
Install Docker or the Go binary
GitHub's official MCP server (github/github-mcp-server) is written in Go and distributed as a Docker image (ghcr.io/github/github-mcp-server) or pre-compiled binary, not as an npm package. The quickest path is to verify Docker is installed:
The GitHub MCP server package requires Node.js version 18 or later and npm. Check your version before starting:
node --version
npmdocker --versionIf Docker isn't installed, download it from docker.com. If you prefer not to use Docker, download the appropriate pre-compiled binary for your platform from the GitHub releases page at github.com/github/github-mcp-server/releases.
Deploying the GitHub MCP server locally
Configure the server with Docker
The official GitHub MCP server npxruns as a Docker container. Pull and run it with:
npx -y @modelcontextprotocol/server-github@modelcontextprotocol/server-githubdocker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-server
To wire this into Claude Desktop, open the config file at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.jsonOn macOS, open this directly from Claude Desktop by going to Settings > Developer > Edit Config. This creates the file if it doesn't exist and opens it in your default editor.
Add the following block inside the mcpServers object:
{
"mcpServers": {
"github": {
"command": "npx""docker",
"args": ["-y"[
"run", "@modelcontextprotocol/server-github"]"-i", "--rm",
"-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}Replace <YOUR_TOKEN> with your PAT. A single missing comma or mismatched bracket in this file silently disables every server, so validate your JSON syntax with a tool like jsonlint.com before restarting Claude.
Run a diagnostic connectivity test
After saving the config file, restart Claude Desktop. Use the /mcp slash command inside a Claude session to force a reconnect and confirm the server appears in the available tools list. If the tools don't appear, run claude mcp get github in your terminal to check whether the server started correctly and declared its tool list.
Refining your GitHub MCP server settings
Define the server path for your client
If npxusing the pre-compiled binary rather than Docker, replace "command": "npx""docker" and the args array with the absolute path to npxthe downloaded binary and its flags. Find the binary path by running which npxgithub-mcp-server on macOS/Linux or where npxgithub-mcp-server on Windows.
Generate your GitHub personal access token
Sign in to github.com and go to Settings (your avatar, top-right).
Scroll to Developer settings at the bottom of the left sidebar.
Select Personal access tokens and choose Fine-grained tokens for the more secure option, or Tokens (classic) for broader access.
Click Generate new token, set an expiration date, and select the required scopes.
Copy the token immediately. GitHub shows it only once, so store it securely before leaving the page.
For multi-device setups, avoid storing the token in .bashrc or .env files without encryption. Store tokens in a secrets manager (GitHub Secrets, AWS Secrets Manager, or HashiCorp Vault) and rotate them every 30-90 days to stay ahead of expiration. For a headless system like a CI/CD platform, provide tokens via secure environment variables rather than static config files.
Finalize the integration setup
After updating your config and saving your token, restart Claude Desktop one final time. The GitHub tools should now appear in the tool panel. Test the connection by asking Claude a specific repository question to confirm the auth flow is working end to end.
Verify your connection is live
Verify access with a sample query
Ask Claude a specific repository question, such as asking about open issues in a named repo, rather than a generic prompt. A specific query triggers a real API call and helps confirm that authentication is working correctly.
If the response fails, check the error message. A 401 Unauthorized means your token is invalid or expired. A 403 Forbidden typically means the token's scopes don't cover what the agent tried to access, or you've hit GitHub's rate limit. You can check remaining capacity by inspecting the X-RateLimit-Remaining and X-RateLimit-Reset headers in API responses, though these headers aren't directly visible in Claude Desktop's interface.
Verify your GitHub MCP connections
In Claude Desktop, check Settings > Developer to see which MCP servers are loaded and their connection status. An active indicator next to the GitHub server confirms the connection is running. An error or missing indicator typically means the server process isn't starting, usually because of a config file error or a missing Node.js binary.
Resolving GitHub connection errors
Error code | Common cause | Specific fix |
|---|---|---|
401 Unauthorized | Expired or invalid PAT | Generate a new PAT in GitHub developer settings and update your config file |
403 Forbidden | Insufficient token scopes or rate limit exceeded | Verify token scopes (such as |
ENOENT | Incorrect path to the MCP server executable | Confirm Docker is running ( |
JSON parse error | Malformed config file | Validate the JSON at jsonlint.com and check for missing commas or brackets |
The rate limit issue deserves specific attention. A recursive AI agent that traverses repository files or writes automated pull request comments can burn through the 5,000-request hourly budget quickly if a polling loop has a bug. When rate limits hit, GitHub returns a 429 Too Many Requests or a 403 Forbidden, and your workflow pauses until the window resets.
Connecting GitHub Enterprise and scaling to production
Connecting GitHub Enterprise servers
For self-hosted GitHub Enterprise instances, add the GITHUB_HOST environment variable pointing to your enterprise domain to the env block in claude_desktop_config.json. The rest of the configuration is identical to the standard setup. You'll also need to update network isolation settings to allow access to the enterprise domain from the machine running the MCP server.
How to scope private repo access
When generating a fine-grained PAT, select "Only select repositories" during the token creation flow on GitHub. This limits the AI assistant's access to specific codebases rather than your entire account. It's the right default for any AI tool that reads repository content, and it limits the blast radius if a token is ever compromised.
When local setup stops working
The operational burden of a local GitHub MCP server shows up at the maintenance stage. You need to:
Rotate tokens every 30-90 days before they expire and break your workflow mid-task
Keep packages current as the GitHub MCP server receives fixes and updates
Watch rate limits when agent workflows start making frequent API calls
Replicate the config across every machine where you run the agent.
For solo operators and small teams, this maintenance surface compounds fast. Composio gives agents access to 1,000+ pre-built integrations beyond GitHub, routed through the MCP Gateway's per-team endpoint, and the Tool Router inspects incoming requests to route them to the appropriate toolkit based on your connected accounts. When an agent needs to send an email, Router determines whether to use Gmail, Outlook, or SMTP based on which services you've connected, eliminating conditional logic in your agent code.
The Gateway also applies self-learning distilled from 300M+ monthly calls: repeat tasks become 30% more accurate on 2× fewer tokens as the agent builds on prior execution patterns. Token custody and automatic refresh are handled with SOC 2 Type II and ISO 27001 certification, and each team gets a unique MCP endpoint that drops into Claude Desktop, Cursor, or ChatGPT without additional configuration.
Because we build and maintain the underlying tools rather than proxying third-party MCP servers, our governance policies apply at the execution layer rather than as metadata wrappers around external tools. That distinction matters for teams that need audit trails or tool-level access controls.
The free tier includes 100,000 tool calls per month with no credit card required. To get started, follow the GitHub toolkit quickstart on Composio: it walks through connecting your account and running your first agent call against the GitHub API.
FAQs
Which MCP clients support GitHub?
Claude Desktop, Cursor, VS Code with GitHub Copilot, Windsurf, Zed, Replit, and Continue.dev all support GitHub MCP connections. You connect them by adding the server configuration block to your client's settings file.
How do I scope private repo access?
Select "Only select repositories" when generating your fine-grained Personal Access Token on GitHub. This limits the AI assistant's read and write access to specific repositories rather than your entire account.
What are the rate limits for the GitHub MCP server?
GitHub limits authenticated personal accounts to 5,000 requests per hour. Unauthenticated requests are capped at 60 per hour per IP, and GitHub Enterprise Cloud org-owned GitHub Apps get up to 15,000 requests per hour.
How do I fix a 401 Unauthorized error on the GitHub MCP server?
A 401 error means your Personal Access Token is expired or invalid. Generate a new PAT in GitHub developer settings, update the token in your claude_desktop_config.json, and restart your MCP client.
Is it safe to store a GitHub PAT in a local config file?
No. A compromised token gives an attacker the same access as your GitHub account, including the ability to push malicious code and clone private repositories. Store tokens in a secrets manager and rotate them every 30-90 days.
What's the difference between using the native GitHub MCP server and Composio?
The native server requires local Node.js setup, manual token management, and plain text credential storage. Composio provides access to 1,000+ pre-built integrations including GitHub, with an execution layer that includes sandboxed execution and automatic retries for recoverable failures. The Gateway applies self-learning distilled from 300M+ monthly calls, making repeat tasks 30% more accurate on 2× fewer tokens as your agent builds on prior execution patterns. Token custody is handled with SOC 2 Type II and ISO 27001 certification, and requests route automatically to the appropriate integration based on your connected accounts. Tool Router is a platform-wide feature available across all of Composio's connected apps, not specific to the GitHub integration.
Key terms glossary
Model Context Protocol (MCP): A universal connector that allows AI assistants to read data from external tools and write data back to them using a standardized client-server protocol.
Personal Access Token (PAT): A secure string used to authenticate your AI assistant with the GitHub API. Fine-grained PATs allow per-repository, per-permission access control and are the more secure option compared to classic PATs.
Tool Router: A Composio workflow mechanism for tool discovery and execution that helps agents determine which tools to use based on the context and task being requested.
MCP Gateway: Our centralized control layer that gives IT teams per-team endpoint URLs, whitelist and blacklist controls, audit logs of every tool call, and SSO integration. Each endpoint drops directly into Claude, Cursor, or ChatGPT without additional configuration.
Rate limit: GitHub's per-hour cap on API requests, set at 5,000 requests per hour for authenticated personal accounts. Exceeding this returns a 429 or 403 error and pauses the workflow until the window resets.
Zero Data Retention (ZDR): A Composio paid add-on that stops us from retaining your request and response payloads. See the Composio pricing page for current tier availability, as this is billed at $0.0001 per tool call and $0.0005 per trigger event.