Configuration

Add the following snippet to your OpenCode config file:

"mcp": {
  "github": {
    "type": "local",
    "command": [
      "docker",
      "run",
      "-i",
      "--rm",
      "-e",
      "GITHUB_PERSONAL_ACCESS_TOKEN",
      "ghcr.io/github/github-mcp-server"
    ],
    "environment": {
      "GITHUB_PERSONAL_ACCESS_TOKEN": "your GitHub token"
    }
  }
}

Two things to note:

  • Docker must be installed and running on your machine
  • The field name is environment, not env

Verifying the connection

First, run:

opencode mcp list

A healthy result should include:

github connected

To make an actual call, drop into opencode and try:

use the github tool and tell me my GitHub login

Or:

use the github tool to list my repositories

If the GitHub tools respond normally, the setup is done.