Skip to content

Construct every MCP client through one factory that declares capabilties - #2477

Merged
pngwn merged 1 commit into
mainfrom
feat/mcp-client-capabilities
Aug 3, 2026
Merged

Construct every MCP client through one factory that declares capabilties#2477
pngwn merged 1 commit into
mainfrom
feat/mcp-client-capabilities

Conversation

@pngwn

@pngwn pngwn commented Aug 3, 2026

Copy link
Copy Markdown
Member

MCP clients were built in four places — tool listing, the connection pool, and both transports of the health check — with three different identities and no capability declaration on any of them. Capabilities have to be identical across all of them, and the file you would reach for is the wrong one: only the pooled client is alive while a tool runs, so a server-initiated request can only ever reach that one. A capability added to the listing client would look declared and never fire.

Adds createMcpClient, the single construction point, and routes all four sites through it. The session and health identities stay distinct, since servers can see the difference.

The declared set is deliberately empty, which is what the SDK already defaulted to, so nothing changes on the wire today. It exists so elicitation and sampling have one obvious place to be added — and a comment saying they must arrive with their handlers, because a capability declared without one makes servers issue a request the SDK can only answer with method-not-found.

…ties

MCP clients were built in four places — tool listing, the connection pool, and
both transports of the health check — with three different identities and no
capability declaration on any of them. Capabilities have to be identical across
all of them, and the file you would reach for is the wrong one: only the pooled
client is alive while a tool runs, so a server-initiated request can only ever
reach that one. A capability added to the listing client would look declared and
never fire.

Adds `createMcpClient`, the single construction point, and routes all four sites
through it. The session and health identities stay distinct, since servers can
see the difference.

The declared set is deliberately empty, which is what the SDK already defaulted
to, so nothing changes on the wire today. It exists so elicitation and sampling
have one obvious place to be added — and a comment saying they must arrive with
their handlers, because a capability declared without one makes servers issue a
request the SDK can only answer with method-not-found.
@pngwn
pngwn merged commit 7b47c49 into main Aug 3, 2026
7 checks passed
@pngwn
pngwn deleted the feat/mcp-client-capabilities branch August 3, 2026 17:54
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