fix: forward passthrough headers to composite MCP children - #7005
fix: forward passthrough headers to composite MCP children#7005jsguerrero wants to merge 1 commit into
Conversation
Signed-off-by: Juan Sebastián Guerrero Guerrero <73492954+jsguerrero@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes composite MCP server behavior so that request header passthrough (notably per-request auth context) is propagated from a composite nanobot proxy to each of its child MCP servers, aligning composite behavior with the existing non-composite nanobot config path.
Changes:
- Extend
constructMCPServerNanobotYAMLForCompositeto accept passthrough header names and apply them to each child server entry in the generated nanobot YAML. - Ensure
Authorizationis always included in the composite-to-child passthrough allowlist (case-insensitive, no additional duplicate added). - Update docker + Kubernetes backends to pass
server.PassthroughHeaderNames, and add a table-driven unit test covering the intended header forwarding behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
pkg/mcp/kubernetes.go |
Passes composite server passthrough header names into composite nanobot YAML construction. |
pkg/mcp/docker.go |
Passes composite server passthrough header names into composite nanobot YAML construction. |
pkg/mcp/backend.go |
Threads passthrough headers into composite child configs and ensures Authorization is included. |
pkg/mcp/backend_test.go |
Adds TestCompositeNanobotYAMLForwardsAuthHeaders to validate forwarding + dedup behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
EntelligenceAI PR SummaryAdds
Confidence Score: 5/5 - Safe to MergeSafe to merge — this PR correctly addresses issue #6845 by extending Key Findings:
Files requiring special attention
|
|
Cross-repo context: this passthrough change is part of enabling per-user OAuth brokering to lazy-auth SaaS MCPs through composite servers. It pairs with obot-platform/nanobot#332 (lazy-auth: OAuth required without a 401 challenge). The obot-side wiring that sets |
What
constructMCPServerNanobotYAMLForCompositenow threads the composite server'sconfigured
PassthroughHeaderNamesto each child, and always includesAuthorization(deduped, case-insensitive). The two call sites (docker.go,kubernetes.go) passserver.PassthroughHeaderNames.Why
Composite MCP servers did not propagate per-request auth to their child servers:
the composite branch only set
BaseURL/ToolOverrides/ToolPrefixper child,while the non-composite path already forwards
PassthroughHeaderNames. As aresult the child never received the inbound bearer and downstream calls failed
with "access token missing".
Composite children are internal Obot
/mcp-connectendpoints that resolve thecaller's per-user credentials, so forwarding
Authorizationonly ever crossesan Obot→Obot hop and lets each child authenticate as the calling user. This
makes the composite path consistent with the non-composite one.
Fixes #6845
Tests
TestCompositeNanobotYAMLForwardsAuthHeaders(table-driven):AuthorizationAuthorizationAuthorizationis not duplicated when already configuredmake validate(gofmt,go vet,go test ./...) passes.