feat: add GitHub MCP server integration - #10
Conversation
Integrate the remote GitHub MCP server (api.githubcopilot.com/mcp/) for all agents. Auth is centralized in .mcp.json using GH_TOKEN/GITHUB_TOKEN — no auth duplication in agent frontmatter. All agents inherit readonly config from plugin level; only claudius gets an inline read-write override. Also demotes ghsudo from primary to optional fallback — scripts now try gh directly first, falling back to ghsudo on 403/404 permission errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a centralized GitHub MCP server configuration to the Claude plugin so agents can access GitHub APIs via a shared remote HTTP MCP endpoint, while updating docs and helper scripts to treat ghsudo as an optional fallback.
Changes:
- Add plugin-level GitHub MCP config (
.claude-plugin/.mcp.json) usingGH_TOKEN/GITHUB_TOKEN, with readonly + toolset headers. - Update
claudiusagent to override GitHub MCP settings for scoped (intended read-write) access. - Update GitHub helper scripts and docs to try
ghfirst and only fall back toghsudoon 403/404.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
.claude-plugin/.mcp.json |
Introduces centralized GitHub MCP server config (HTTP endpoint + headers). |
.claude-plugin/plugin.json |
Version bump to 1.14.0. |
agents/claudius.md |
Adds an inline GitHub MCP server override for claudius. |
scripts/gh-post-review.sh |
Adds run_gh() wrapper to use gh with ghsudo fallback. |
scripts/gh-request-reviewer.sh |
Adds run_gh() wrapper to use gh with ghsudo fallback. |
scripts/gh-resolve-review-threads.sh |
Adds run_gh() wrapper and switches mutation call from ghsudo to wrapper. |
skills/git-and-github/SKILL.md |
Reframes ghsudo as optional fallback; updates push guidance. |
README.md |
Documents GitHub MCP setup and reframes ghsudo as optional. |
CHANGELOG.md |
Adds 1.14.0 entry describing MCP + ghsudo behavior changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -29,4 +40,4 @@ for id in "$@"; do | |||
| done | |||
There was a problem hiding this comment.
With set -euo pipefail, ((i++)) returns exit status 1 on the first iteration (because the expression evaluates to 0), which can cause the script to exit before building the full GraphQL mutation. Use a form that always returns success under -e (e.g., pre-increment) or otherwise guard the arithmetic command.
| Each agent gets only the toolsets it needs (via `X-MCP-Toolsets` header) to minimize context size. All agents except `claudius` run in read-only mode — writes go through `gh` CLI. | ||
|
|
||
| **Step 1 — Create a fine-grained PAT:** | ||
|
|
||
| [→ Create a new fine-grained Personal Access Token](https://github.com/settings/personal-access-tokens/new) | ||
|
|
||
| Set the token expiration and repository access scope as needed, then grant these **repository permissions**: | ||
|
|
||
| | Permission | Access | Used for | | ||
| |---|---|---| | ||
| | **Actions** | Read-only | View workflow runs and logs | | ||
| | **Contents** | Read and write | Read code, push to branches | | ||
| | **Discussions** | Read-only | Read repository discussions | | ||
| | **Issues** | Read and write | Create issues, add comments | | ||
| | **Metadata** | Read-only | Basic repository metadata (always required) | | ||
| | **Pull requests** | Read and write | Create PRs, review, comment, resolve threads | | ||
|
|
||
| > **Tip:** The GitHub MCP server auto-detects your token's permissions and hides tools you don't have access to. Start with the permissions above and add more if needed. | ||
|
|
There was a problem hiding this comment.
The PAT permission table asks for several read/write scopes (e.g., Contents/Issues/Pull requests), but the text above says most agents run in read-only mode. To keep least-privilege guidance consistent, consider documenting a minimal read-only permission set (and separately call out when/why write permissions are needed, e.g. only for claudius read-write MCP usage).
| Each agent gets only the toolsets it needs (via `X-MCP-Toolsets` header) to minimize context size. All agents except `claudius` run in read-only mode — writes go through `gh` CLI. | |
| **Step 1 — Create a fine-grained PAT:** | |
| [→ Create a new fine-grained Personal Access Token](https://github.com/settings/personal-access-tokens/new) | |
| Set the token expiration and repository access scope as needed, then grant these **repository permissions**: | |
| | Permission | Access | Used for | | |
| |---|---|---| | |
| | **Actions** | Read-only | View workflow runs and logs | | |
| | **Contents** | Read and write | Read code, push to branches | | |
| | **Discussions** | Read-only | Read repository discussions | | |
| | **Issues** | Read and write | Create issues, add comments | | |
| | **Metadata** | Read-only | Basic repository metadata (always required) | | |
| | **Pull requests** | Read and write | Create PRs, review, comment, resolve threads | | |
| > **Tip:** The GitHub MCP server auto-detects your token's permissions and hides tools you don't have access to. Start with the permissions above and add more if needed. | |
| Each agent gets only the toolsets it needs (via `X-MCP-Toolsets` header) to minimize context size. All agents except `claudius` use MCP in read-only mode — repository writes are done by you (e.g. via `git`/`gh`) or, if you explicitly enable it, by `claudius` using write-capable tools. | |
| **Step 1 — Create a fine-grained PAT:** | |
| [→ Create a new fine-grained Personal Access Token](https://github.com/settings/personal-access-tokens/new) | |
| Set the token expiration and repository access scope as needed, then grant at least these **read-only repository permissions** (recommended baseline): | |
| | Permission | Access | Used for | | |
| |---|---|---| | |
| | **Actions** | Read-only | View workflow runs and logs | | |
| | **Contents** | Read-only | Read code and repository files | | |
| | **Discussions** | Read-only | Read repository discussions | | |
| | **Issues** | Read-only | View issues and existing comments | | |
| | **Metadata** | Read-only | Basic repository metadata (always required) | | |
| | **Pull requests** | Read-only | View PRs, reviews, comments, and statuses | | |
| For most workflows (read-only agents, manual `git`/`gh` usage), the permissions above are sufficient and follow least privilege. | |
| If you want `claudius` (or other agents) to create or modify GitHub resources via MCP (e.g. open PRs, file issues, push commits), also grant these **optional write permissions**: | |
| | Permission | Access | Used for | | |
| |---|---|---| | |
| | **Contents** | Read and write | Push commits, create/update branches, edit files via API | | |
| | **Issues** | Read and write | Create issues, edit titles/descriptions, add comments | | |
| | **Pull requests** | Read and write | Open PRs, update descriptions, comment, resolve threads | | |
| > **Tip:** The GitHub MCP server auto-detects your token's permissions and hides tools you don't have access to. Start with the minimal read-only set above and add the optional write permissions only if you need automation. |
| - GitHub MCP server (remote HTTP) via `https://api.githubcopilot.com/mcp/` — centralized in `.mcp.json` | ||
| - All agents inherit GitHub MCP from plugin-level config (readonly, all toolsets) | ||
| - `claudius` gets inline read-write override with scoped toolsets | ||
| - PAT auth via `GH_TOKEN` (preferred) or `GITHUB_TOKEN` (fallback) — no auth duplication in agent frontmatter | ||
| - README setup guide with fine-grained PAT permissions table |
There was a problem hiding this comment.
This changelog bullet says auth is centralized with “no auth duplication in agent frontmatter”, but agents/claudius.md now includes an inline Authorization header for the GitHub MCP server. Either adjust the changelog wording to reflect the exception, or rework the claudius override so auth truly remains centralized.
| type: http | ||
| url: "https://api.githubcopilot.com/mcp/" | ||
| headers: | ||
| Authorization: "Bearer ${GH_TOKEN:-${GITHUB_TOKEN}}" |
There was a problem hiding this comment.
claudius now duplicates the GitHub MCP Authorization header inline, which conflicts with the stated goal of centralizing auth in .claude-plugin/.mcp.json and creates drift risk if the auth mechanism changes. If the config format allows it, prefer inheriting the centralized auth and only overriding the toolsets/read-write behavior here; otherwise, please document why this one agent must duplicate auth.
| Authorization: "Bearer ${GH_TOKEN:-${GITHUB_TOKEN}}" |
| run_gh() { | ||
| if output=$(gh "$@" 2>&1); then | ||
| echo "$output" | ||
| elif command -v ghsudo >/dev/null 2>&1 && echo "$output" | grep -qiE '403|404|Resource not accessible'; then | ||
| ghsudo gh "$@" | ||
| else |
There was a problem hiding this comment.
In run_gh(), output is implicitly a global variable. Declaring it as a local variable inside the function avoids accidental clashes if the script grows (and is safer under set -u).
- Remove X-MCP-Readonly from .mcp.json (PAT permissions are the real ACL) - Simplify claudius.md mcpServers to name references only - README: pre-fill PAT creation link with correct permissions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add "Agent Reuse" subsection under Spawning: prefer SendMessage to running agents over spawning fresh ones for follow-up work in the same scope. Add corresponding anti-pattern #10 to reinforce the pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
) * feat(skills): extract grand-admiral orchestration skill from claudius agent Move ~150 lines of multi-agent orchestration doctrine (spawning, worktree isolation, team coordination, scaling, recovery, anti-patterns) plus planning, crew roster, skills reference, and programme management patterns into a dedicated `grand-admiral` skill. The claudius agent prompt drops from 206 to 55 lines — personality + session protocol only — improving resilience to context compaction. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor(agents): move session protocol, docs, attribution to grand-admiral skill Further slim the claudius agent to personality + role/focus only (30 lines). Session protocol (Always section), documentation conventions, and attribution rules now live in the grand-admiral skill alongside all other orchestration knowledge. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(grand-admiral): add agent reuse pattern and anti-pattern #10 Add "Agent Reuse" subsection under Spawning: prefer SendMessage to running agents over spawning fresh ones for follow-up work in the same scope. Add corresponding anti-pattern #10 to reinforce the pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs(grand-admiral): clarify Bilby vs Marvin adversarial split Update Crew Roster roles to make the builder/breaker contract explicit: Bilby builds and fixes code, Marvin proves code wrong and never fixes. Add explanatory note after the roster table with the fix-routing pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(grand-admiral,agents): formalize candy economy incentive system Add dedicated "Candy Economy" section to grand-admiral skill with per-agent candy rules: Marvin earns for confirmed bugs, Bilby earns for false positives, all others earn for confirmed findings in their domain. Coordinator validates all awards. Add Mindset sections to Bilby, Nagatha, Trillian, and Diziet agents with candy motivation. Marvin, Smythe, and Adams already had candy mindset — no changes needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat: strengthen MemCan context injection in grand-admiral skill - Expand one-liner into concrete 5-step procedure with score threshold - Add Prior Knowledge prompt template for agent context injection - Add prior knowledge to Agent Prompt Requirements checklist Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: review improvements --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
https://api.githubcopilot.com/mcp/.mcp.jsonusingGH_TOKEN(preferred) orGITHUB_TOKEN(fallback) — no auth duplication in agent frontmatterclaudiusgets inline read-write override with scoped toolsetsghsudofrom primary to optional fallback — scripts tryghdirectly, fall back toghsudoon 403/404What changed?
.claude-plugin/.mcp.json.claude-plugin/plugin.json1.13.2→1.14.0agents/claudius.mdscripts/gh-*.sh(3 files)run_gh()helper — try direct, ghsudo fallback on 403/404skills/git-and-github/SKILL.mdREADME.mdCHANGELOG.mdTest plan
/mcp—githubserver appears connectedgh-post-review.shwithout ghsudo installed — verify directghcall worksgh-post-review.shwith read-only token — verify ghsudo fallback triggers🤖 Co-authored by Claudius the Magnificent AI Agent