feat(ai/mcp): expose serverInfo from MCP initialize handshake#13825
Closed
alexzurbonsen wants to merge 4 commits intovercel:mainfrom
Closed
feat(ai/mcp): expose serverInfo from MCP initialize handshake#13825alexzurbonsen wants to merge 4 commits intovercel:mainfrom
serverInfo from MCP initialize handshake#13825alexzurbonsen wants to merge 4 commits intovercel:mainfrom
Conversation
`MCPClient` now exposes the server's `serverInfo` (containing `name`, `version`, and optional `title`) as a readonly property. Previously, this was parsed during initialization but discarded. Signed-off-by: Alexander zur Bonsen <alexander.zur.bonsen@tngtech.com>
Signed-off-by: Alexander zur Bonsen <alexander.zur.bonsen@tngtech.com>
Author
|
@aayush-kapoor or @lgrammel: could you give this PR a review? You have touched some of the files before. Thank you :) |
Collaborator
|
could you link to the official docs as a reference? |
Author
Sure, I updated the PR description. |
4 tasks
Collaborator
aayush-kapoor
left a comment
There was a problem hiding this comment.
there wwre just a couple of things that i wanted to change so have continued this in #14288. will mark this as closed - thanks for raising!
aayush-kapoor
added a commit
that referenced
this pull request
Apr 10, 2026
## Background introduced in #13825 we used to capture the `serverInfo` in the schema but never surface it through to the client. only `result.capabilities` was stored and `result.serverInfo` was thrown away. there was no field on the client to hold it and no property on the MCPClient interface to access it ## Summary - added `title` field to `ClientOrServerImplementationSchema` to align with [MCP spec](https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation) - exposed `serverInfo` via a getter function ## Manual Verification verified by running the client and server under `examples/mcp/src/server-info` ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
vercel-ai-sdk bot
pushed a commit
that referenced
this pull request
Apr 10, 2026
## Background introduced in #13825 we used to capture the `serverInfo` in the schema but never surface it through to the client. only `result.capabilities` was stored and `result.serverInfo` was thrown away. there was no field on the client to hold it and no property on the MCPClient interface to access it ## Summary - added `title` field to `ClientOrServerImplementationSchema` to align with [MCP spec](https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation) - exposed `serverInfo` via a getter function ## Manual Verification verified by running the client and server under `examples/mcp/src/server-info` ## Checklist - [x] Tests have been added / updated (for bug fixes / features) - [ ] Documentation has been added / updated (for bug fixes / features) - [x] A _patch_ changeset for relevant packages has been added (for bug fixes / features - run `pnpm changeset` in the project root) - [x] I have reviewed this pull request (self-review)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
Motivation: I would like to use the title (name respectively) in a UI.
Summary
Exposes the MCP server's
serverInfo(containingname,version, and optionaltitle) as a readonly property on ai sdk'sMCPClient. Previously, this was parsed during initialization but discarded.MCP Specs:
The (spec page)[https://modelcontextprotocol.io/specification/2025-11-25] lists (schema.ts)[https://github.com/modelcontextprotocol/modelcontextprotocol/blob/a0d7bf599d56dfc0c73a2752dc68995bf0e72bb8/schema/2025-11-25/schema.ts#L530] as authoritative reference.
The
Implementationtype is defined here:https://github.com/modelcontextprotocol/modelcontextprotocol/blob/a0d7bf599d56dfc0c73a2752dc68995bf0e72bb8/schema/2025-11-25/schema.ts#L552
and used in:
clientInfo: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/a0d7bf599d56dfc0c73a2752dc68995bf0e72bb8/schema/2025-11-25/schema.ts#L263serverInfo: https://github.com/modelcontextprotocol/modelcontextprotocol/blob/a0d7bf599d56dfc0c73a2752dc68995bf0e72bb8/schema/2025-11-25/schema.ts#L287Manual Verification
From
examples/mcprun the examples from the second commit of this branch.Terminal 1:
pnpm tsx src/server-info/server.tsTerminal 2:
pnpm tsx src/server-info/client.tsSee the client logging
serverInfo: { name: 'my-weather-server', version: '2.1.0' }Checklist
pnpm changesetin the project root)Related Issues