Skip to content

Add conformance tests for SEP-2243 HTTP Standardization#259

Open
mikekistler wants to merge 4 commits intomodelcontextprotocol:mainfrom
mikekistler:mdk/sep-2243-conformance-tests
Open

Add conformance tests for SEP-2243 HTTP Standardization#259
mikekistler wants to merge 4 commits intomodelcontextprotocol:mainfrom
mikekistler:mdk/sep-2243-conformance-tests

Conversation

@mikekistler
Copy link
Copy Markdown
Contributor

@mikekistler mikekistler commented May 1, 2026

Summary

Adds conformance test scenarios for SEP-2243 (HTTP Standardization), covering the new standard and custom MCP request headers.

The PR also adds a "prepare" script to the package.json to allow "npm install" from a branch for pre-merge testing.

Scenarios added

Server scenarios (test server — inspects client requests)

  • http-standard-headers — Verifies clients send Mcp-Method and Mcp-Name headers on HTTP POST requests
  • http-custom-headers — Verifies clients handle x-mcp-header annotations: mirror param values into Mcp-Param-* headers, apply Base64 encoding for non-ASCII values, and convert number/boolean values correctly
  • http-invalid-tool-headers — Verifies clients reject invalid x-mcp-header tool definitions (empty values, duplicates, non-primitive types, illegal characters, etc.)

Client scenarios (connect to server under test)

  • http-header-validation — Verifies servers reject mismatched/missing Mcp-Method/Mcp-Name headers, accept case-insensitive header names, reject case-mismatched values, trim whitespace, validate Base64-encoded custom headers, and return -32001 (HeaderMismatch)
  • http-custom-header-server-validation — Verifies servers validate custom Mcp-Param-* headers against the request body

Traceability

  • src/scenarios/sep-2243.yaml maps 30+ spec requirements to check IDs

Notes

  • Server-side scenarios are registered as pending until the everything-server implements SEP-2243 header validation
  • Includes a prepare script in package.json for git-based dependency installs

Checklist

  • npm run build passes
  • npm test passes
  • Scenarios registered in src/scenarios/index.ts

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 1, 2026

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@259

commit: 156cdf2

@mikekistler
Copy link
Copy Markdown
Contributor Author

Notes on how this was tested:

I ran the tests in this branch the support for SEP-2243 added in this branch of the MCP C# SDK and all tests pass.

Here's how I ran the tests:

# In the MCP C# SDK repo, checkout the branch
git checkout mdk/sep-2243-implementation

# Remove any existing node_modules to get to a known state
rm -rf node_modules

# Install node modules with the exact versions in package lock
npm ci

# Now replace the conformance node module with the tests in this branch
npm install --no-save "@modelcontextprotocol/conformance@github:mikekistler/conformance#mdk/sep-2243-conformance-tests"

# Run the server conformance tests (.NET 10 only)
MCP_CONFORMANCE_PROTOCOL_VERSION=DRAFT-2026-v1 dotnet test tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj -f net10.0 --filter "FullyQualifiedName~ServerConformanceTests"

# Run the client conformanct tests (.NET 10 only)
MCP_CONFORMANCE_PROTOCOL_VERSION=DRAFT-2026-v1 dotnet test tests/ModelContextProtocol.AspNetCore.Tests/ModelContextProtocol.AspNetCore.Tests.csproj -f net10.0 --filter "FullyQualifiedName~ClientConformanceTests"

Here's the server conformance test output I got:

  ModelContextProtocol.Analyzers netstandard2.0 succeeded (1.0s) → artifacts/bin/ModelContextProtocol.Analyzers/Debug/netstandard2.0/ModelContextProtocol.Analyzers.dll
  ModelContextProtocol.TestOAuthServer net10.0 succeeded (2.7s) → artifacts/bin/ModelContextProtocol.TestOAuthServer/Debug/net10.0/ModelContextProtocol.TestOAuthServer.dll
  ModelContextProtocol.Core net10.0 succeeded (2.3s) → artifacts/bin/ModelContextProtocol.Core/Debug/net10.0/ModelContextProtocol.Core.dll
  ModelContextProtocol.ConformanceClient net10.0 succeeded (0.6s) → artifacts/bin/ModelContextProtocol.ConformanceClient/Debug/net10.0/ModelContextProtocol.ConformanceClient.dll
  ModelContextProtocol net10.0 succeeded (0.7s) → artifacts/bin/ModelContextProtocol/Debug/net10.0/ModelContextProtocol.dll
  TestServerWithHosting net10.0 succeeded (0.2s) → artifacts/bin/TestServerWithHosting/Debug/net10.0/TestServerWithHosting.dll
  ModelContextProtocol.AspNetCore net10.0 succeeded (0.3s) → artifacts/bin/ModelContextProtocol.AspNetCore/Debug/net10.0/ModelContextProtocol.AspNetCore.dll
  ModelContextProtocol.ConformanceServer net10.0 succeeded (0.4s) → artifacts/bin/ModelContextProtocol.ConformanceServer/Debug/net10.0/ModelContextProtocol.ConformanceServer.dll
  ModelContextProtocol.TestSseServer net10.0 succeeded (0.4s) → artifacts/bin/ModelContextProtocol.TestSseServer/Debug/net10.0/TestSseServer.dll
  ModelContextProtocol.AspNetCore.Tests net10.0 succeeded (0.8s) → artifacts/bin/ModelContextProtocol.AspNetCore.Tests/Debug/net10.0/ModelContextProtocol.AspNetCore.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.5)
[xUnit.net 00:00:00.36]   Discovering: ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:00.52]   Discovered:  ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:00.63]   Starting:    ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:03.32]   Finished:    ModelContextProtocol.AspNetCore.Tests (ID = '80e86993fc6c5aa1b19aa869c2acb5dc11fd46fcd744c0c6edd18b834e87fda2')
WARNING: Overwriting results file: /Users/mikekistler/Projects/modelcontextprotocol/csharp-sdk/artifacts/TestResults/Debug/ModelContextProtocol.AspNetCore.Tests.net10.0.Unix.trx
Results File: /Users/mikekistler/Projects/modelcontextprotocol/csharp-sdk/artifacts/TestResults/Debug/ModelContextProtocol.AspNetCore.Tests.net10.0.Unix.trx
  ModelContextProtocol.AspNetCore.Tests test net10.0 succeeded (3.7s)

Test summary: total: 45, failed: 0, succeeded: 45, skipped: 0, duration: 3.7s
Build succeeded in 10.1s

And here's the output from the client conformance tests:

  ModelContextProtocol.TestOAuthServer net10.0 succeeded (0.2s) → artifacts/bin/ModelContextProtocol.TestOAuthServer/Debug/net10.0/ModelContextProtocol.TestOAuthServer.dll
  ModelContextProtocol.Analyzers netstandard2.0 succeeded (0.1s) → artifacts/bin/ModelContextProtocol.Analyzers/Debug/netstandard2.0/ModelContextProtocol.Analyzers.dll
  ModelContextProtocol.Core net10.0 succeeded (0.1s) → artifacts/bin/ModelContextProtocol.Core/Debug/net10.0/ModelContextProtocol.Core.dll
  ModelContextProtocol.ConformanceClient net10.0 succeeded (0.1s) → artifacts/bin/ModelContextProtocol.ConformanceClient/Debug/net10.0/ModelContextProtocol.ConformanceClient.dll
  ModelContextProtocol net10.0 succeeded (0.1s) → artifacts/bin/ModelContextProtocol/Debug/net10.0/ModelContextProtocol.dll
  ModelContextProtocol.AspNetCore net10.0 succeeded (0.1s) → artifacts/bin/ModelContextProtocol.AspNetCore/Debug/net10.0/ModelContextProtocol.AspNetCore.dll
  TestServerWithHosting net10.0 succeeded (0.2s) → artifacts/bin/TestServerWithHosting/Debug/net10.0/TestServerWithHosting.dll
  ModelContextProtocol.TestSseServer net10.0 succeeded (0.2s) → artifacts/bin/ModelContextProtocol.TestSseServer/Debug/net10.0/TestSseServer.dll
  ModelContextProtocol.ConformanceServer net10.0 succeeded (0.3s) → artifacts/bin/ModelContextProtocol.ConformanceServer/Debug/net10.0/ModelContextProtocol.ConformanceServer.dll
  ModelContextProtocol.AspNetCore.Tests net10.0 succeeded (0.3s) → artifacts/bin/ModelContextProtocol.AspNetCore.Tests/Debug/net10.0/ModelContextProtocol.AspNetCore.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v3.1.5+1b188a7b0a (64-bit .NET 10.0.5)
[xUnit.net 00:00:00.17]   Discovering: ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:00.37]   Discovered:  ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:00.49]   Starting:    ModelContextProtocol.AspNetCore.Tests
[xUnit.net 00:00:11.43]   Finished:    ModelContextProtocol.AspNetCore.Tests (ID = '80e86993fc6c5aa1b19aa869c2acb5dc11fd46fcd744c0c6edd18b834e87fda2')
WARNING: Overwriting results file: /Users/mikekistler/Projects/modelcontextprotocol/csharp-sdk/artifacts/TestResults/Debug/ModelContextProtocol.AspNetCore.Tests.net10.0.Unix.trx
Results File: /Users/mikekistler/Projects/modelcontextprotocol/csharp-sdk/artifacts/TestResults/Debug/ModelContextProtocol.AspNetCore.Tests.net10.0.Unix.trx
  ModelContextProtocol.AspNetCore.Tests test net10.0 succeeded (12.3s)

Test summary: total: 34, failed: 0, succeeded: 34, skipped: 0, duration: 12.2s
Build succeeded in 14.0s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant