-
Notifications
You must be signed in to change notification settings - Fork 614
Add support for v0.1.11 client conformance tests #1178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
When I rebase onto the mdk/client-conformance-v0.1.11, which adds support to run all the v0.1.11 tests, I still get 5 errors:
@copilot please rebase onto that branch and then fix these and any other errors. |
8adee2d to
23b3136
Compare
|
@halter73, please pay careful attention to all the auth stuff. That was mostly all copilot. |
src/ModelContextProtocol.Core/Client/SseClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
77ee750 to
9deb100
Compare
halter73
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the _scopStepUpCount logic to include all redirect loops and write test cases for that and all of the client credential flows.
src/ModelContextProtocol.Core/Authentication/ClientOAuthProvider.cs
Outdated
Show resolved
Hide resolved
src/ModelContextProtocol.Core/Client/SseClientSessionTransport.cs
Outdated
Show resolved
Hide resolved
| # Keep version in sync with McpConformanceVersion in Directory.Packages.props | ||
| - name: 📦 Install conformance test runner | ||
| run: npm install @modelcontextprotocol/conformance@0.1.10 | ||
| run: npm install @modelcontextprotocol/conformance@0.1.11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should go back to testing against the latest version? I know it will be annoying when it causes random PRs to fail, but we'll definitely notice that way. And the InvalidOperationException we'd get from GetConformanceVersion() when they do fall out of sync should be pretty clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok by me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| run: npm install @modelcontextprotocol/conformance@0.1.11 | |
| run: npm install @modelcontextprotocol/conformance |
@copilot Also update the message in the InvalidOperationException thrown by GetConformanceVersion() to tell the developer to start pinning the version in ci-build-test.yml and file an issue to update the conformance tests if they run into it.
|
@stephentoub Given that the client credentials flow stuff is an auth extension (https://github.com/modelcontextprotocol/ext-auth/pull/3/changes), what do we think about only supporting it via a I think this is more similar to what the TS SDK does with https://github.com/modelcontextprotocol/typescript-sdk/blob/b0ef89ffaf6db8b3c52cd8919e8949b0f1da9ca4/packages/client/src/client/auth.ts for the mainline authorization code and then forces you to manually call |
…ing protection, add client credentials tests - Replace _scopeStepUpCount with _repeatedAuthFailureCount to track all auth failures - Reset counter only on successful requests to prevent infinite loops - Replace custom DNS rebinding middleware with AllowedHosts configuration - Add client_credentials grant support to TestOAuthServer with basic auth and post methods - Add ClientCredentialsTests with infinite loop prevention test - Fix off-by-one error in MaxReconnectionAttempts Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
Fixed in 919ff3e. Replaced |
src/ModelContextProtocol.AspNetCore/DnsRebindingProtectionMiddleware.cs
Outdated
Show resolved
Hide resolved
Remove the DNS rebinding protection middleware, extension methods, and tests as requested. The ConformanceServer now uses the built-in AllowedHosts configuration instead. Co-authored-by: halter73 <54385+halter73@users.noreply.github.com>
Can you elaborate? |
|
The idea is that we'd provide a Similarly, we'd provide an I know that by not implementing the |
| private string? _clientSecret; | ||
| private ITokenCache _tokenCache; | ||
| private AuthorizationServerMetadata? _authServerMetadata; | ||
| private int _repeatedAuthFailureCount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stephentoub I don't think this is really thread-safe or safe against interleaved async requests for that matter. There can be multiple concurrent tool calls and the like. Would it be worth shoving the retry count into the HttpRequestMessage?

Summary
Adds SDK support required to pass v0.1.11 MCP conformance tests. Six client tests were failing due to missing OAuth features and SSE reconnection support.
Changes Made
OAuth Provider Changes (
ClientOAuthProvider.cs)token_endpoint_auth_methods_supportedfrom server metadata. Useclient_secret_basic(HTTP Basic auth) when supported, fall back toclient_secret_postclient_credentialsflow for machine-to-machine auth when server advertises it and no redirect delegate is configuredClientIdandClientSecretare provided_scopeStepUpCountwith_repeatedAuthFailureCountto track all auth failures. Counter only resets on successful requests to prevent infinite loops.SSE Transport Changes (
SseClientSessionTransport.cs)Last-Event-IDand send it on reconnection attemptsTest OAuth Server Updates
client_credentialsgrant typeclient_secret_basicauth method (HTTP Basic)private_key_jwtauth method (JWT assertions)DNS Rebinding Protection
UseMcpDnsRebindingProtectionmiddleware, extension methods, and testsAllowedHostsconfiguration in ConformanceServer insteadNew Tests
ClientCredentialsTests.cswith tests for:client_credentialswithclient_secret_postclient_credentialswithclient_secret_basicChecklist
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.