Table of Contents
GitHub's official MCP server lets Claude Desktop read repository content and, when authorized, work with issues, branches, pull requests and files. The safest beginner setup uses the official Docker image and GitHub's browser-based OAuth flow, then tests read-only tools before approving any write operation.
Important update: the older npm package @modelcontextprotocol/server-github is deprecated. Do not use an old configuration that launches that package with npx. Follow the current official GitHub MCP installation guide and recheck it when the client or server changes.
What you need
- The current Claude Desktop app for Windows, macOS or a supported Linux setup.
- An active GitHub account with access to the repositories you intend to use.
- Docker Desktop or another compatible Docker runtime installed and running.
- Permission to connect the relevant repositories to an AI tool.
- A clean Git working tree or a recoverable branch before approving code changes.
You do not need Node.js for the current Docker-based server. The old article required Node.js only because it used the now-deprecated npm package.
1. Prefer OAuth over a stored personal access token
The official local Docker image can open a GitHub login in your browser. With this method, you do not paste a long-lived token into the Claude configuration file. The login token is kept in memory by the running server rather than hardcoded in JSON.
The screenshots below show the older classic-token workflow. They are retained for orientation, but the broad repo, workflow and admin:org scopes shown in legacy instructions should not be granted by default.



If OAuth is unsuitable and you must use a token, GitHub recommends a fine-grained personal access token when the required API operations support it. Limit the token to the exact owner, repositories and permissions needed, set an expiration, store it as a secret, and revoke it when the connection is retired. Organization policy may require administrator approval.
2. Add the official server to Claude Desktop
Open the configuration file
In Claude Desktop, open Settings, choose Developer, and select Edit Config. Interface labels can move between releases, so use the current Developer or MCP settings if they differ from the screenshots.



The current configuration file is named claude_desktop_config.json. The standard locations documented by GitHub are:
- Windows:
%APPDATA%Claudeclaude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
The older source misspelled the filename as classe_desktop_config.json; that name is incorrect.
Add the Docker and OAuth configuration
Merge the following github entry into the existing mcpServers object. Do not replace other server entries you still use.
{
"mcpServers": {
"github": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-p",
"127.0.0.1:8085:8085",
"-e",
"GITHUB_OAUTH_CALLBACK_PORT",
"ghcr.io/github/github-mcp-server"
],
"env": {
"GITHUB_OAUTH_CALLBACK_PORT": "8085"
}
}
}
}
This launches GitHub's public container image, exposes the OAuth callback only on the local loopback address, and removes the container when it exits. The first tool use should open a GitHub authorization flow in the browser.

Save the JSON, fully quit Claude Desktop and reopen it. Valid JSON requires double quotes, commas between sibling entries and balanced braces. If the file already contains another server, add a comma between the server objects.
3. Authorize and verify the connection
Open a new Claude conversation and find GitHub under the connectors or tools menu. If the server starts correctly, complete the GitHub browser login and review the requested authorization before accepting it.

Start with read-only requests
Use a public repository or a disposable private test repository first:
List the repositories I can access and do not change anything.Read README.md in owner/repository and summarize its setup steps with file links.Show the open issues in owner/repository. Do not create, edit or close any issue.
Confirm that Claude identifies the right owner and repository. If a request could write data, inspect the proposed target, branch and content before approving the tool call.
4. Set conservative tool permissions
Keep write-capable operations in an approval-required mode. Repository reads are lower risk, but even read tools can expose private source code to the connected AI service, so follow your organization's data policy.

- Read: repository search, file reads, issue and pull-request inspection.
- Write: create or update files, push commits, create branches, issues or pull requests.
- Administrative: repository or organization changes; do not enable unless a specific approved workflow needs them.
Never allow a model to push directly to a protected or production branch. Prefer a new branch and pull request, review the diff locally, and run the project's tests independently.
Useful workflows
Review code without changing it
Read src/auth/login.js in owner/repository. Identify possible defects and security concerns. Cite the relevant lines. Do not edit files or create issues.
Draft an issue for review
Based on the confirmed defect, draft an issue title, reproduction steps, expected behavior and acceptance criteria. Show me the draft without creating the issue.
Only after reviewing the draft should you explicitly authorize creation in the exact repository.
Prepare a change on a branch
Propose a minimal patch and list the files and tests it would affect. Do not push. Wait for approval after showing the plan.
For an actual change, work in a dedicated branch, inspect the diff and use the normal review and CI process.
Troubleshooting
The GitHub server does not appear
- Confirm you edited
claude_desktop_config.jsonin the correct location. - Validate the JSON and check for a missing comma or brace.
- Make sure Docker is installed, running and available as
dockerin the app's environment. - Fully quit and reopen Claude Desktop.
The server starts but authentication fails
- Repeat the browser login and confirm that the OAuth callback uses
127.0.0.1:8085. - Check whether a firewall, VPN or organization policy blocks the local callback or GitHub authorization.
- If using a PAT, confirm it is active, approved when required and limited to the correct repositories and permissions.
Tools return permission errors
- Verify the GitHub account can perform the requested action without MCP.
- Check branch protection and organization policies.
- Confirm the request targets the exact repository you authorized.
- Grant only the missing permission; do not solve one error by adding broad organization access.
Docker cannot start the image
docker pull ghcr.io/github/github-mcp-server
If pulling fails after an old registry login, the official guide suggests signing out of that registry and retrying. Review Claude Desktop's MCP logs for the specific startup message before changing the configuration.
Security checklist
- Use GitHub's official server and current installation documentation.
- Prefer OAuth; otherwise use a narrow, expiring fine-grained token where supported.
- Never commit a token, secret-bearing config or
.envfile. - Keep write and administrative tools approval-gated.
- Test in a disposable repository before connecting important code.
- Review every diff, issue and pull request before it is created or pushed.
- Revoke tokens and remove the server configuration when no longer needed.
MCP is an open standard for connecting AI applications to tools and data, but each connection expands what the model can read or change. The official MCP introduction explains that boundary. For broader product tradeoffs, see Claude Pro vs. the API; for another example of a coding agent with MCP access, review MiMo Code's security checklist.
Reader Comments 0
Sign in with email or Google to join the discussion.