Mastra's MCPClient tells each server the name the application gave that server
Kind: idiosyncrasy · Status: current · Last verified: 2026-11-27 · Clients: mastra · Revisions: 2025-11-25, 2026-07-28
MCPClient creates one InternalMastraMCPClient per entry in its servers map and passes the entry's key as name. The constructor hands the SDK { name: clientInfo?.name ?? name, version: clientInfo?.version ?? version }, with version defaulting to '1.0.0'. With no clientInfo option the server's own config key is what goes on the wire.
The probe's adapter configures its fixture under the key probe and sets no clientInfo. Its capture of @mastra/mcp 2.9.0-alpha.1 shows {"name":"probe","version":"1.0.0"} in _meta["io.modelcontextprotocol/clientInfo"] on server/discover and on every later request, and the same object in initialize.params.clientInfo on the legacy run. The constructor code is the same at bb984550.
A server configured as github is told the client is called github. Two servers under one MCPClient see two different client names. Nothing in the default value names Mastra or its version, so a feed that joins on clientInfo.name cannot count Mastra traffic.
The application can set a name. MCPClientOptions.clientInfo sets a default for every server, and a server entry's clientInfo overrides it field by field. The option arrived with mastra-ai/mastra#26328.
The three in-repo consumers of MCPClient that were read do not set it. Mastra Code passes id, servers and timeout. The editor's toMCPClientOptions returns id and servers. @mastra/connect builds one client per connection with the integration id as the server key. Each of them is on the wire under its server keys.
The registry's clientInfoNames for Mastra holds mastra-playground, which is the literal Studio's connection preview sends from a separate hand-written client. MCPClient itself contributes no fixed name.
Sources
- packages/mcp/src/client/client.ts, InternalMastraMCPClient constructor, commit
0a31d4d0,packages/mcp/src/client/client.ts:InternalMastraMCPClient, 2026-11-27 - packages/mcp/src/client/configuration.ts, MCPClientOptions.clientInfo and getOrCreateClient, commit
0a31d4d0,packages/mcp/src/client/configuration.ts:MCPClientOptions,MCPClient.getOrCreateClient, 2026-11-27 - packages/mcp/src/client/types.ts, MCPClientInfo and the per-server override, commit
0a31d4d0,packages/mcp/src/client/types.ts:MCPClientInfo,BaseServerOptions, 2026-11-27 - mastracode/sdk/src/mcp/manager.ts, Mastra Code's MCPClient construction, commit
0a31d4d0,mastracode/sdk/src/mcp/manager.ts:connectAndCollectTools, 2026-11-27 - packages/editor/src/namespaces/mcp.ts, toMCPClientOptions, commit
0a31d4d0,packages/editor/src/namespaces/mcp.ts:toMCPClientOptions, 2026-11-27 - packages/connect/src/multi-connection.ts, one MCPClient per connection, commit
0a31d4d0,packages/connect/src/multi-connection.ts:buildMcpMultiConnectionTools, 2026-11-27 - client-sdks/react/src/hooks/mcps/use-try-connect-mcp.ts, the one fixed name, commit
0a31d4d0,client-sdks/react/src/hooks/mcps/use-try-connect-mcp.ts:connectAndListTools, 2026-11-27