Short answer: Use a fine-grained token limited to the repos the agent needs, start with
--read-only, turn on --lockdown-mode if the agent reads public repos, choose only the toolsets you need, and pin the Docker image.Facts from the README
| Repository | github/github-mcp-server · MIT · about 35,000 GitHub stars |
|---|---|
| Checked | 26 Nov 2026, README at commit 7edc2dd |
| Default toolsets | context, repos, issues, pull_requests, users: including tools that create, change and delete files, branches, issues and pull requests (for example create_or_update_file, delete_file, merge_pull_request), unless read-only mode is on. |
| Read-only mode | --read-only / GITHUB_READ_ONLY=1: "only offer read-only tools". It "takes priority": write tools are skipped even if requested with --tools. |
| Lockdown mode | --lockdown-mode / GITHUB_LOCKDOWN_MODE=1: hides public-repo content from authors without push access, to "reduce the risk of prompt injection". |
| Docker image in README | ghcr.io/github/github-mcp-server with no tag or digest, so you get whatever is newest (unpinned). |
| Hosted option | Remote server at https://api.githubcopilot.com/mcp/; an "insiders" version adds experimental tools. |
The risks, in plain words
- The agent acts with your token. Whatever the token can do, the agent can be talked into doing. The README's own advice: "Minimum scopes: Only grant necessary permissions", "Separate tokens" per project, "Regular rotation", "Never commit".
- Issues and comments are untrusted input. Anyone can write an issue on a public repo. Text in it can try to steer the agent (prompt injection), for example into copying private code into a public place.
- Lockdown helps, but isn't a wall. The README says lockdown "is a best-effort content filter … It is not an authorization boundary: it does not change what the underlying GitHub credential can read or write." Content from
github-actions[bot]andcopilotis always treated as safe. - Tokens in config files. The README notes some apps (it names Windsurf) "require hardcoded tokens in config files", which then sit in plain text on disk.
Safer setup
docker run -i --rm \
-e GITHUB_PERSONAL_ACCESS_TOKEN \
-e GITHUB_READ_ONLY=1 \
-e GITHUB_LOCKDOWN_MODE=1 \
-e GITHUB_TOOLSETS="repos,issues" \
ghcr.io/github/github-mcp-server@sha256:<digest-you-verified>
- Fine-grained token limited to specific repositories and the least permissions; a separate token per project.
- Start read-only. Turn write tools on only for a task that needs them, then off again.
- Lockdown on whenever the agent reads public repos you don't control.
- Only the toolsets you need (
--toolsetsorGITHUB_TOOLSETS), not the full default set. - Pin the image by digest so an update can't change what runs without you knowing.
- Require approval in your client for any tool that writes, merges or deletes.
Check your MCP config for hard-coded tokens and unpinned servers with the free MCP config checker.
For security reviews
Reviewers ask which third-party tools your AI can call and with what permissions. Name the token type and scope, read-only or not, lockdown, and the approval rule. See how to answer the MCP question.
Sources
- GitHub MCP server README (token best practices, toolsets, read-only mode, lockdown mode): github.com/github/github-mcp-server @ 7edc2dd
Facts copied from the project's own documentation on 26 Nov 2026. This page has no grade: we grade only servers we've hand-checked (methodology). Maintainers: tell us if anything is out of date.