Skip to content

feat(toolhive): serve GitHub over its hosted MCP endpoint - #4239

Merged
Tanguille merged 1 commit into
mainfrom
feat/github-remote-mcp
Jul 28, 2026
Merged

feat(toolhive): serve GitHub over its hosted MCP endpoint#4239
Tanguille merged 1 commit into
mainfrom
feat/github-remote-mcp

Conversation

@Tanguille

@Tanguille Tanguille commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Replaces the self-run github-mcp-server container with GitHub's hosted remote MCP server, re-enabling GitHub tools for the resources and unified gateways.

Why the container stays dead

Transport Blocker
stdio vMCP health check re-sends initialize; backend rejects with duplicate "initialize" received and gets marked unhealthy (#5890, still open in 0.41.0)
streamable-http server http takes no server-side token; MCPExternalAuthConfig.bearerToken never projects the Secret into the proxy pod (#4220)

MCPServerEntry.headerForward injects the header server-side, which is exactly the capability bearerToken failed to provide, and a remote has no pod for the health check to re-initialize. Same shape context7 has run since 2026-04.

Verification

Auth format, against https://api.githubcopilot.com/mcp/:

Authorization: value Result
Bearer <pat> 200
<pat> bare 200
token <pat> 400

A bare PAT works, so GITHUB_PERSONAL_ACCESS_TOKEN is reused unmodified — no sops change.

No Copilot entitlement despite the hostname: a probe token whose scopes are repo, workflow, gist, read:org, *:packages (no copilot) listed all 46 tools. They are plain GitHub operations — create_pull_request, merge_pull_request, issue_write, create_branch, push_files, search_code. One tool of 46 mentions Copilot (request_copilot_review).

kubectl apply --dry-run=server passes for both entries; kustomize builds clean.

Summary by CodeRabbit

  • New Features
    • Added remote GitHub MCP server configurations using streamable HTTP transport.
    • Enabled secure forwarding of GitHub authorization credentials from the existing deployment secret.
    • Added both standard and optimized GitHub server entries.

The self-run container is unusable on both transports: stdio gets marked
unhealthy when the vMCP health check re-sends `initialize` (#5890, still
open in 0.41.0), and `server http` accepts no server-side token, with the
MCPExternalAuthConfig bearerToken path a no-op (#4220).

MCPServerEntry sidesteps both. headerForward injects the PAT server-side,
which is the capability bearerToken failed to provide, and the remote has
no pod for the health check to re-initialize. Same shape as context7.

The endpoint accepts a bare PAT, so GITHUB_PERSONAL_ACCESS_TOKEN is reused
as-is. No Copilot entitlement: a token with no `copilot` scope lists all 46
repo/issue/PR tools.
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

GitHub ToolHive configuration now uses hosted remote MCP entries with streamable HTTP transport and server-side Authorization forwarding from the existing Kubernetes secret. A second entry exposes the same server configuration to all groups.

Changes

GitHub MCP remote integration

Layer / File(s) Summary
Configure hosted GitHub MCP server
kubernetes/apps/ai/toolhive/config/github.yaml
Replaces the previous tool configuration with a remote GitHub MCP entry using streamable-http and secret-backed Authorization header forwarding.
Add all-group GitHub variant
kubernetes/apps/ai/toolhive/config/github.yaml
Adds github-opt with the same endpoint, transport, and secret while setting its group reference to all.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: switching ToolHive GitHub access to the hosted MCP endpoint.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/github-remote-mcp

Comment @coderabbitai help to get the list of available commands.

@tanguille-cluster

Copy link
Copy Markdown
@@ (root level) @@
# toolhive.stacklok.dev/v1beta1/MCPToolConfig/ai/github
! - one document removed:
- apiVersion: toolhive.stacklok.dev/v1beta1
- kind: MCPToolConfig
- metadata:
-   name: github
-   namespace: ai
-   labels:
-     app.kubernetes.io/name: toolhive
-     kustomize.toolkit.fluxcd.io/name: toolhive
-     kustomize.toolkit.fluxcd.io/namespace: ai
- spec:
-   toolsFilter: []

@@ (root level) @@
# toolhive.stacklok.dev/v1beta1/MCPServerEntry/ai/github
! + one document added:
+ apiVersion: toolhive.stacklok.dev/v1beta1
+ kind: MCPServerEntry
+ metadata:
+   name: github
+   namespace: ai
+   labels:
+     app.kubernetes.io/name: toolhive
+     kustomize.toolkit.fluxcd.io/name: toolhive
+     kustomize.toolkit.fluxcd.io/namespace: ai
+ spec:
+   groupRef:
+     name: resources
+   headerForward:
+     addHeadersFromSecret:
+     - headerName: Authorization
+       valueSecretRef:
+         name: toolhive-secrets
+         key: GITHUB_PERSONAL_ACCESS_TOKEN
+   remoteUrl: "https://api.githubcopilot.com/mcp/"
+   transport: streamable-http

@@ (root level) @@
# toolhive.stacklok.dev/v1beta1/MCPServerEntry/ai/github-opt
! + one document added:
+ apiVersion: toolhive.stacklok.dev/v1beta1
+ kind: MCPServerEntry
+ metadata:
+   name: github-opt
+   namespace: ai
+   labels:
+     app.kubernetes.io/name: toolhive
+     kustomize.toolkit.fluxcd.io/name: toolhive
+     kustomize.toolkit.fluxcd.io/namespace: ai
+ spec:
+   groupRef:
+     name: all
+   headerForward:
+     addHeadersFromSecret:
+     - headerName: Authorization
+       valueSecretRef:
+         name: toolhive-secrets
+         key: GITHUB_PERSONAL_ACCESS_TOKEN
+   remoteUrl: "https://api.githubcopilot.com/mcp/"
+   transport: streamable-http

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
kubernetes/apps/ai/toolhive/config/github.yaml (1)

33-40: 🔒 Security & Privacy | 🔵 Trivial

Security Misconfiguration (CWE-284)

Confirm that all is an intentional trust boundary for this PAT.

github-opt exposes the same server-side PAT-backed entry to every consumer of the all group. MCPServerEntry has no proxy authorization or audit layer, so callers can use whatever operations the PAT permits. Narrow the group or add a policy-enforcing proxy if all includes less-trusted gateways. (docs.stacklok.com)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@kubernetes/apps/ai/toolhive/config/github.yaml` around lines 33 - 40, The
github MCPServerEntry forwards a PAT-backed Authorization header to every
consumer of the all group without an authorization or audit layer. Update
groupRef.name in the github configuration to a restricted trusted group, or
route access through a policy-enforcing proxy when all includes less-trusted
gateways; preserve PAT access only for intended consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@kubernetes/apps/ai/toolhive/config/github.yaml`:
- Line 15: Update the GitHub MCP manifest URL entries near remoteUrl to avoid
hardcoding api.githubcopilot.com, using the repository-supported external-URL
indirection while preserving GitHub integration; if no suitable indirection
exists, document and apply an explicit repository exception.

---

Nitpick comments:
In `@kubernetes/apps/ai/toolhive/config/github.yaml`:
- Around line 33-40: The github MCPServerEntry forwards a PAT-backed
Authorization header to every consumer of the all group without an authorization
or audit layer. Update groupRef.name in the github configuration to a restricted
trusted group, or route access through a policy-enforcing proxy when all
includes less-trusted gateways; preserve PAT access only for intended consumers.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 130d1a85-db3f-48ae-bf44-dd6f34bb1bae

📥 Commits

Reviewing files that changed from the base of the PR and between 6162fad and 6341d9a.

📒 Files selected for processing (1)
  • kubernetes/apps/ai/toolhive/config/github.yaml
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • Tanguille/LLMKube (auto-detected)
  • Tanguille/2x-R9700-RDNA4-GFX1201-sglang-inference (auto-detected)

Comment thread kubernetes/apps/ai/toolhive/config/github.yaml
@Tanguille
Tanguille merged commit eac69fa into main Jul 28, 2026
13 of 14 checks passed
@Tanguille
Tanguille deleted the feat/github-remote-mcp branch July 28, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant