From 5030f627789b74f0c27231f1c1ca38c938291cb0 Mon Sep 17 00:00:00 2001 From: soyuka Date: Tue, 12 May 2026 16:18:55 +0200 Subject: [PATCH] [Conformance] Target 2025-11-25 spec in conformance fixtures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The conformance test runner (npm @modelcontextprotocol/conformance@0.1.16) covers the 2025-11-25 spec — adding 6 scenarios on top of 2025-06-18, of which json-schema-2020-12 (SEP-1613) requires the fixture to expose a tool whose inputSchema exercises $schema/$defs/$ref/additionalProperties. - tests/Conformance/server.php and tests/Conformance/client.php now negotiate ProtocolVersion::V2025_11_25 via setProtocolVersion(). - The server fixture registers json_schema_2020_12_tool with the schema expected by SEP-1613. Result against `--spec-version 2025-11-25 --suite all`: - server: 42 passed, 1 failed (dns-rebinding-protection, in baseline) - client: 2 passed, 42 failed (all in baseline, baseline check passes) --- tests/Conformance/client.php | 2 ++ tests/Conformance/server.php | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/Conformance/client.php b/tests/Conformance/client.php index 5c2ee2c7..d23c0b60 100644 --- a/tests/Conformance/client.php +++ b/tests/Conformance/client.php @@ -16,6 +16,7 @@ use Mcp\Client\Transport\HttpTransport; use Mcp\Schema\ClientCapabilities; use Mcp\Schema\Enum\ElicitAction; +use Mcp\Schema\Enum\ProtocolVersion; use Mcp\Schema\JsonRpc\Request; use Mcp\Schema\JsonRpc\Response; use Mcp\Schema\Request\ElicitRequest; @@ -36,6 +37,7 @@ $builder = Client::builder() ->setClientInfo('mcp-conformance-test-client', '1.0.0') + ->setProtocolVersion(ProtocolVersion::V2025_11_25) ->setInitTimeout(30) ->setRequestTimeout(60) ->setLogger($logger); diff --git a/tests/Conformance/server.php b/tests/Conformance/server.php index 02c78c2a..36126081 100644 --- a/tests/Conformance/server.php +++ b/tests/Conformance/server.php @@ -19,6 +19,7 @@ use Mcp\Schema\Content\EmbeddedResource; use Mcp\Schema\Content\ImageContent; use Mcp\Schema\Content\TextContent; +use Mcp\Schema\Enum\ProtocolVersion; use Mcp\Schema\Result\CallToolResult; use Mcp\Server; use Mcp\Server\Session\FileSessionStore; @@ -37,6 +38,7 @@ $server = Server::builder() ->setServerInfo('mcp-conformance-test-server', '1.0.0') + ->setProtocolVersion(ProtocolVersion::V2025_11_25) ->setSession(new FileSessionStore(__DIR__.'/sessions')) ->setLogger($logger) // Tools @@ -52,6 +54,29 @@ ->addTool([Elements::class, 'toolWithElicitation'], name: 'test_elicitation', description: 'Tests server-initiated elicitation') ->addTool([Elements::class, 'toolWithElicitationDefaults'], name: 'test_elicitation_sep1034_defaults', description: 'Tests elicitation with default values') ->addTool([Elements::class, 'toolWithElicitationEnums'], name: 'test_elicitation_sep1330_enums', description: 'Tests elicitation with enum schemas') + ->addTool( + static fn () => 'ok', + name: 'json_schema_2020_12_tool', + description: 'Tool with JSON Schema 2020-12 features', + inputSchema: [ + '$schema' => 'https://json-schema.org/draft/2020-12/schema', + 'type' => 'object', + '$defs' => [ + 'address' => [ + 'type' => 'object', + 'properties' => [ + 'street' => ['type' => 'string'], + 'city' => ['type' => 'string'], + ], + ], + ], + 'properties' => [ + 'name' => ['type' => 'string'], + 'address' => ['$ref' => '#/$defs/address'], + ], + 'additionalProperties' => false, + ], + ) // Resources ->addResource(static fn () => 'This is the content of the static text resource.', 'test://static-text', 'static-text', 'A static text resource for testing') ->addResource(static fn () => fopen('data://image/png;base64,'.Elements::TEST_IMAGE_BASE64, 'r'), 'test://static-binary', 'static-binary', 'A static binary resource (image) for testing')