From 6341d9a2af49d63d1d2dbe5a0112ed005b747fd0 Mon Sep 17 00:00:00 2001 From: Tanguille <91473554+Tanguille@users.noreply.github.com> Date: Tue, 28 Jul 2026 22:15:21 +0200 Subject: [PATCH] feat(toolhive): serve GitHub over its hosted MCP endpoint 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. --- .../apps/ai/toolhive/config/github.yaml | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/kubernetes/apps/ai/toolhive/config/github.yaml b/kubernetes/apps/ai/toolhive/config/github.yaml index 26031c55e4..6abf379a23 100644 --- a/kubernetes/apps/ai/toolhive/config/github.yaml +++ b/kubernetes/apps/ai/toolhive/config/github.yaml @@ -1,17 +1,40 @@ -# Disabled: neither transport works on ToolHive v0.40.1. -# -# stdio: virtual-MCP health monitoring re-runs `initialize`, which the backend rejects with -# `duplicate "initialize" received`, degrading the resources and unified gateways (#5890). -# -# streamable-http: `server http` takes no server-side token (verified against v1.7.0 --help), -# so the only path is MCPExternalAuthConfig bearerToken. The operator turns its tokenSecretRef -# into the thv CLI store reference `toolhive-secrets,target=bearer_token` and never projects -# the Secret into the proxy pod, so proxyrunner exits on "secrets provider not configured" -# before it serves. Restore once either is fixed upstream. +# GitHub's hosted MCP server instead of the self-run container: stdio dies on the +# virtual-MCP health check re-running `initialize` (#5890, still open in 0.41.0) and +# the container's http mode has no server-side token path (#4220). A remote entry has +# neither problem — headerForward injects the PAT server-side, the same shape context7 +# has run since 2026-04. The endpoint takes a raw PAT (verified: `Bearer ` and a +# bare `` both return 200, `token ` returns 400), so the existing secret key +# goes in unmodified. Despite the hostname, no Copilot entitlement is involved: a token +# carrying no `copilot` scope lists all 46 repo/issue/PR tools. --- apiVersion: toolhive.stacklok.dev/v1beta1 -kind: MCPToolConfig +kind: MCPServerEntry metadata: name: github spec: - toolsFilter: [] + remoteUrl: https://api.githubcopilot.com/mcp/ + transport: streamable-http + groupRef: + name: resources + headerForward: + addHeadersFromSecret: + - headerName: Authorization + valueSecretRef: + name: toolhive-secrets + key: GITHUB_PERSONAL_ACCESS_TOKEN +--- +apiVersion: toolhive.stacklok.dev/v1beta1 +kind: MCPServerEntry +metadata: + name: github-opt +spec: + remoteUrl: https://api.githubcopilot.com/mcp/ + transport: streamable-http + groupRef: + name: all + headerForward: + addHeadersFromSecret: + - headerName: Authorization + valueSecretRef: + name: toolhive-secrets + key: GITHUB_PERSONAL_ACCESS_TOKEN