The AI Loadout

How to connect to GitHub with an AI agent

Use GitHub's official MCP server at https://api.githubcopilot.com/mcp/ with a fine-grained personal access token. One command adds it to Claude Code, a config.toml block adds it to Codex, and mcp.json adds it to Cursor. Give the token only the repos and permissions the agent needs.

Grok Bot steps tested by us on Oct 26, 2026 while building this page. Claude Code, Codex and Cursor steps checked against official docs on Oct 26, 2026.

Get the free starter kit. One short email a day when our setups change.

Free starter kit on signup: 2 Claude Code skills and 1 agent persona from our paid packs. By subscribing you agree to get The AI Loadout Daily, one email each morning. No spam, we never sell your email, and every email has a one-click unsubscribe link.

Claude Code

  1. Create a fine-grained token at github.com/settings/personal-access-tokens/new
  2. claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer YOUR_GITHUB_PAT"
  3. Ask: "List open issues labeled bug in this repo."

Codex

  1. Add to ~/.codex/config.toml: [mcp_servers.github] url = "https://api.githubcopilot.com/mcp/" and bearer_token_env_var = "GITHUB_PAT_TOKEN"
  2. export GITHUB_PAT_TOKEN=your token
  3. codex mcp list to confirm

Cursor

  1. Add to .cursor/mcp.json: {"mcpServers":{"github":{"url":"https://api.githubcopilot.com/mcp/","headers":{"Authorization":"Bearer ${env:GITHUB_PAT}"}}}}
  2. Set GITHUB_PAT in your shell, then reload the server

Grok Bot

  1. Connect GitHub to Grok Bot
  2. Ask it to read issues, open a branch or push a commit
  3. It works in its own copy of the repo on its cloud computer

Gotchas

  • A classic token with repo scope can touch every repo you own. Use fine-grained tokens.
  • Keep tokens out of committed config. Use env variables.
  • Agents can open PRs fast. Protect your main branch.

The loadout for this job

FAQ

Is there an official GitHub MCP server?

Yes. github/github-mcp-server, with a hosted endpoint at https://api.githubcopilot.com/mcp/.

Which token should I use?

A fine-grained personal access token limited to the repos the agent needs.

Related how-tos

Sources

Commands change. Check the linked docs before you run anything. All how-to guides

Want tested skills and personas installed in one command? See the AI Loadout packs, from $9.