Add experimental Server Cards support (SEP-2127) - #2696
Closed
dsp-ant wants to merge 2 commits into
Closed
Claude / Claude Code Review
completed
Jun 3, 2026 in 37m 12s
Code review found 1 important issue
Found 5 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 1 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🔴 Important | src/mcp/server/experimental/server_card.py:38-46 |
_ServerIdentity Protocol uses mutable attributes, so MCPServer (read-only properties) fails pyright |
| 🟡 Nit | src/mcp/client/experimental/ai_catalog.py:50-67 |
fetch_* Raises sections omit json.JSONDecodeError from response.json() |
Annotations
Check failure on line 46 in src/mcp/server/experimental/server_card.py
claude / Claude Code Review
_ServerIdentity Protocol uses mutable attributes, so MCPServer (read-only properties) fails pyright
The `_ServerIdentity` Protocol declares its members as plain mutable attributes, but `MCPServer` exposes `name`/`version`/`title`/`description`/`website_url`/`icons` as read-only `@property` getters, so the documented usage of passing an `MCPServer` to `build_server_card()` fails pyright ("name is invariant because it is mutable... property is not assignable to str"). Declaring the protocol members as `@property` getters (e.g. `@property\ndef name(self) -> str: ...`) lets both the low-level `Ser
Check warning on line 67 in src/mcp/client/experimental/ai_catalog.py
claude / Claude Code Review
fetch_* Raises sections omit json.JSONDecodeError from response.json()
The `Raises:` sections of `fetch_ai_catalog` (and `fetch_server_card` / `discover_server_cards` in `server_card.py`) only list `httpx.HTTPError` and `pydantic.ValidationError`, but `response.json()` raises `json.JSONDecodeError` when a 2xx response carries a non-JSON body — a realistic outcome when probing well-known paths on arbitrary hosts (e.g. a 200 + HTML index page). Consider adding `json.JSONDecodeError` to the `Raises:` sections (as `load_server_card` already does) or wrapping it.
Loading