Skip to content

Commit 4d8f900

Browse files
committed
Burn down json-schema-ref-no-deref conformance scenario
Add a driver handler for the scenario (the missing handler was why it failed, not actual dereferencing) and remove it from both expected-failures baselines. Document the server-side external-$ref rejection in the migration guide.
1 parent f7366a6 commit 4d8f900

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎.github/actions/conformance/client.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ async def run_tools_call(server_url: str) -> None:
185185
logger.debug(f"add_numbers result: {result}")
186186

187187

188+
@register("json-schema-ref-no-deref")
189+
async def run_json_schema_ref_no_deref(server_url: str) -> None:
190+
"""List tools whose schemas contain a network `$ref`; must not dereference it (SEP-2106)."""
191+
async with streamable_http_client(url=server_url) as (read_stream, write_stream):
192+
async with ClientSession(read_stream, write_stream) as session:
193+
await session.initialize()
194+
tools_result = await session.list_tools()
195+
logger.debug(f"Listed tools without dereferencing network $refs: {[t.name for t in tools_result.tools]}")
196+
197+
188198
@register("sse-retry")
189199
async def run_sse_retry(server_url: str) -> None:
190200
"""Connect, initialize, list tools, call test_reconnection, close."""

‎.github/actions/conformance/expected-failures.2026-07-28.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ client:
6363
# SEP-2243 (HTTP standardization): no fixture handler / client header support yet.
6464
- http-custom-headers
6565
- http-invalid-tool-headers
66-
# SEP-2106 (JSON Schema $ref handling): client still dereferences network $refs.
67-
- json-schema-ref-no-deref
6866
# SEP-2468 (authorization response iss parameter): not implemented in the client.
6967
- auth/iss-supported
7068
- auth/iss-not-advertised

‎.github/actions/conformance/expected-failures.yml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ client:
2222
# SEP-2243 (HTTP standardization): no fixture handler / client header support yet.
2323
- http-custom-headers
2424
- http-invalid-tool-headers
25-
# SEP-2106 (JSON Schema $ref handling): client still dereferences network $refs.
26-
- json-schema-ref-no-deref
2725
# SEP-2468 (authorization response iss parameter): not implemented in the client.
2826
- auth/iss-supported
2927
- auth/iss-not-advertised

‎docs/migration.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ Results returned from server handlers are now validated against the negotiated p
240240

241241
`ClientSession` now validates server requests, notifications, and results against the negotiated protocol version's schema before parsing them into `mcp.types` models. Spec-invalid server output that the previous monolith parse tolerated may now raise `pydantic.ValidationError` from `list_tools()`, `call_tool()`, and similar calls. `_meta` remains the sanctioned place for result extras (and `experimental` for capability extras).
242242

243+
### External JSON Schema `$ref`s are rejected in tool schemas (SEP-2106)
244+
245+
SEP-2106 permits the full JSON Schema 2020-12 vocabulary in tool schemas, including `$ref`. A `$ref` that resolves to a network URI is an SSRF / fetch-DoS vector, so per the spec implementations must never automatically dereference any `$ref` that is not a same-document reference (a JSON Pointer such as `#/$defs/Foo` or an `$anchor` such as `#Foo`).
246+
247+
Registering a tool whose generated input or output schema contains an external `$ref` now raises `ExternalSchemaRefError` (from `mcp.server.mcpserver.utilities.func_metadata`). Schemas pydantic generates from your type hints only ever use same-document refs, so this affects you only if you inject an external `$ref` into a schema, e.g. via `Field(json_schema_extra=...)`. To migrate, inline the referenced schema or point the `$ref` at a same-document `$defs` entry.
248+
243249
### `args` parameter removed from `ClientSessionGroup.call_tool()`
244250

245251
The deprecated `args` parameter has been removed from `ClientSessionGroup.call_tool()`. Use `arguments` instead.

0 commit comments

Comments
 (0)