Connect GitHub MCP to OpenCode
GitHub's official MCP server. Agents can read code, issues and pull requests, open PRs and leave reviews, so a design change can go from canvas to merged code.
MCP serverOfficialChecked 2026-11-16
Before you start
- OpenCode installed (see its MCP documentation (opens in a new tab)).
- GitHub MCP is available on macOS, Windows and Linux.
- This setup runs GitHub's Docker image, so Docker must be installed and running. Create a fine-grained personal access token with only the repositories and permissions you need, and set it as
GITHUB_PERSONAL_ACCESS_TOKENin your environment. To skip Docker, use GitHub MCP (remote), the hosted version.
Step 1: Add GitHub MCP to OpenCode
Add it from the terminal
Run this in your project folder. It saves the server to the project's
opencode.json.Terminal opencode mcp add github --env 'GITHUB_PERSONAL_ACCESS_TOKEN={env:GITHUB_PERSONAL_ACCESS_TOKEN}' -- docker run -i --rm -e GITHUB_PERSONAL_ACCESS_TOKEN ghcr.io/github/github-mcp-serverOr edit the config file
Add this to
opencode.jsonat the project root.opencode.json { "$schema": "https://opencode.ai/config.json", "mcp": { "github": { "type": "local", "command": [ "docker", "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "enabled": true, "environment": { "GITHUB_PERSONAL_ACCESS_TOKEN": "{env:GITHUB_PERSONAL_ACCESS_TOKEN}" } } } }Step 2: Check it's connected
Terminal opencode mcp listStart OpenCode in the project; the server's tools are available to the agent straight away.
Step 3: Try a first request
Ask OpenCode something that only works with GitHub MCP connected:
Say to OpenCode List the open pull requests in this repository and summarise what the newest one changes.
If it doesn't work
- OpenCode reads
opencode.jsonfrom the project root, or~/.config/opencode/opencode.jsonfor every project. - Environment variables use the
{env:NAME}syntax inside the config file. - Servers that need a sign-in: run
opencode mcp auth <name>.





