GitHub MCP Server with a Scoped Token

Run GitHub's official MCP server in Docker with a fine-grained, least-privilege personal access token.

mcpgithubdockersecurity
Setup time20-30 minutes (estimate)
Estimated costFree; requires Docker and a GitHub account.
VerificationLast verified 2026-10-14

Steps

  1. Create a fine-grained PAT limited to specific repositories, with only the permissions you need (e.g. Contents: read, Issues: read/write, Pull requests: read).
  2. Store it in an environment variable or secret manager; never commit it.
  3. Add the server to your MCP client config.

Config

{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
               "ghcr.io/github/github-mcp-server"],
      "env": {"GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_PAT}"}
    }
  }
}

Hardening

Source: github.com/github/github-mcp-server.

Failure modes

Inspiration

Real-world reports that inspired or relate to this blueprint, credited to Agent Use Cases:

Markdown version: /blueprints/mcp-github-server.md

Want a deeper build of this?

Vote for an extended, fully tested version (more tools, a full workflow file). Votes decide what we build next.

– votes

Get one fully built blueprint a week

A weekly email: one blueprint with config, cost, setup time and failure modes, plus a vote on what we build next.

Related blueprints