Expose advertised MCP server capabilities in status responses (#44826)

## What changed

Add `serverCapabilities` to `mcpServerStatus/list` responses in both `full` and `toolsAndAuthOnly` modes, including thread-scoped reads. Return the initialized server's capabilities object, including its `extensions` map, or `null` when unavailable.

Capture capabilities during initialization so they remain available when tool discovery fails. Clear them on each new connection attempt and keep them independent of shared tool caches. Update the protocol schemas, generated TypeScript and Python types, and documentation.

## Testing

Add coverage for extension capabilities surviving tool-discovery failures in both detail modes. Extend existing tests to check advertised extensions, absent capabilities after initialization failure, and serialization of unavailable capabilities as `null`.

GitOrigin-RevId: 8e9d67c10fac3a54e82bef8be5d99caaf82597d1
This commit is contained in:
Gabriel Peal
2026-09-11 13:46:21 +00:00
committed by copyberry
parent 624ccf7947
commit 7a6f469dcf
20 changed files with 199 additions and 9 deletions

View File

@@ -8340,6 +8340,13 @@ class McpServerStatus(BaseModel):
description="Current thread-runtime connection state; null when unavailable or the configuration changed.",
),
] = None
server_capabilities: Annotated[
Any | None,
Field(
alias="serverCapabilities",
description="Capabilities advertised by the initialized MCP server; null when unavailable.",
),
] = None
server_info: Annotated[McpServerInfo | None, Field(alias="serverInfo")] = None
tools: dict[str, Tool]
tools_error: Annotated[