The GitHub MCP Server provides seamless integration with GitHub APIs through the Model Context Protocol (MCP), enabling advanced automation and interaction capabilities for developers and tools.
For quick installation, you can use the one-click install buttons available in VS Code or VS Code Insiders.
For manual installation, add the following configuration to your VS Code User Settings (JSON):
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "github_token",
"description": "GitHub Personal Access Token",
"password": true
}
],
"servers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
}
}
}
}
}
To access the User Settings in VS Code, press Ctrl + Shift + P
and type Preferences: Open User Settings (JSON)
.
Alternatively, you can add the configuration to .vscode/mcp.json
in your workspace to share with others (omit the mcp
key in this case).
Add the following configuration to Claude Desktop:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>"
}
}
}
}
If you don't have Docker, you can build the binary using Go:
# Navigate to the project directory and build
go build ./cmd/github-mcp-server
# Run the server with your GitHub token
GITHUB_PERSONAL_ACCESS_TOKEN=your_token_here ./github-mcp-server stdio
For GitHub Enterprise Server users:
# Using command line flag
./github-mcp-server --gh-host your-enterprise-server.com
# Or using environment variable
GH_HOST=your-enterprise-server.com ./github-mcp-server
You can override tool descriptions by creating a github-mcp-server-config.json
file:
{
"TOOL_ADD_ISSUE_COMMENT_DESCRIPTION": "an alternative description",
"TOOL_CREATE_BRANCH_DESCRIPTION": "Create a new branch in a GitHub repository"
}
Export current translations:
./github-mcp-server --export-translations
You can also use environment variables with the prefix GITHUB_MCP_
:
export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description"
The server provides access to repository content through resource URLs:
repo://{owner}/{repo}/contents{/path*}
repo://{owner}/{repo}/refs/heads/{branch}/contents{/path*}
repo://{owner}/{repo}/sha/{sha}/contents{/path*}
repo://{owner}/{repo}/refs/tags/{tag}/contents{/path*}
repo://{owner}/{repo}/refs/pull/{prNumber}/head/contents{/path*}
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "github" '{"command":"docker","args":["run","-i","--rm","-e","GITHUB_PERSONAL_ACCESS_TOKEN","ghcr.io/github/github-mcp-server"],"env":{"GITHUB_PERSONAL_ACCESS_TOKEN":"${input:github_token}"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITHUB_PERSONAL_ACCESS_TOKEN",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "${input:github_token}"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect