Skip to content

feat: migrate aibridge injected-MCP proxy to official MCP Go SDK - #28060

Draft
ibetitsmike wants to merge 1 commit into
mike/mcp-go-sdk/agent-clientfrom
mike/mcp-go-sdk/aibridge-proxy
Draft

feat: migrate aibridge injected-MCP proxy to official MCP Go SDK#28060
ibetitsmike wants to merge 1 commit into
mike/mcp-go-sdk/agent-clientfrom
mike/mcp-go-sdk/aibridge-proxy

Conversation

@ibetitsmike

@ibetitsmike ibetitsmike commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Stack Context

PR 5 of 6 in a stack that migrates every Coder MCP surface from the archived github.com/mark3labs/mcp-go library to the official github.com/modelcontextprotocol/go-sdk v1.7.0.

Stack: #28056 -> #28057 -> #28058 -> #28059 -> #28060 -> #28061

Why

The aibridge injected-MCP proxy now owns an official *mcp.Client, *mcp.StreamableClientTransport, and *mcp.ClientSession.

  • The proxy constructor accepts an optional *http.Client instead of mark3labs options; the header-injecting wrapper shallow-copies a supplied client so its Timeout, Jar, and redirect policy survive.
  • Manual protocol version negotiation and the mark3labs five-second close workaround are removed; the SDK negotiates during Connect and fails when no mutually supported version exists.
  • Repeated Init closes the previous session, and a failed tool fetch closes the just-created session so transports do not leak.
  • Tool and intercept types use the official pointer content types; embedded resource blobs are re-encoded to base64 for model-facing text because the SDK decodes them into raw bytes.
  • aibridge/mcpmock is regenerated, and its stale go:generate source path is corrected.

Mux created this PR on Mike's behalf.

Replace the mark3labs client with the official SDK client for the
deprecated injected-MCP proxy. The manual protocol-version handshake
check and the 5s-close workaround are subsumed by SDK negotiation
and session close. The proxy constructor takes an optional
*http.Client instead of mark3labs transport options; auth headers
ride an http.RoundTripper. Repeated Init now closes the previous
session instead of leaking its transport.

Test fixtures move to official SDK stateless servers, including the
enterprise integration mock, which previously answered every POST
with a canned initialize response that the stricter SDK client
rejects. The mcpmock generate directive also pointed at the
pre-vendoring aibridge module path; fix it and regenerate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant