Add Extensions support to ClientCapabilities and ServerCapabilities (SEP-2133)#1292
Add Extensions support to ClientCapabilities and ServerCapabilities (SEP-2133)#1292
Conversation
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
…message Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
| public static class CapabilitiesTests | ||
| { | ||
| [Fact] | ||
| public static void ClientCapabilities_ExtensionsProperty_SerializationRoundTrip() |
There was a problem hiding this comment.
@copilot these should be split into test files by type, one for client, one for server
There was a problem hiding this comment.
Done in b19aefd. Split into ClientCapabilitiesTests.cs (5 tests) and ServerCapabilitiesTests.cs (5 tests).
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
| /// MCP features. Having separate constants improves code clarity while maintaining a | ||
| /// single diagnostic suppression point. | ||
| /// </remarks> | ||
| public const string Extensions_DiagnosticId = "MCPEXP001"; |
There was a problem hiding this comment.
| public const string Extensions_DiagnosticId = "MCPEXP001"; | |
| public const string Extensions_DiagnosticId = "MCPEXP002"; |
Shouldn't we use a different diagnostic ID if we're going to have a different URL/message? There are more usages we'll have to fix. Are we going to wait for #1260 to get merged first before merging this? @MackinnonBuck
There was a problem hiding this comment.
It's the same url, just a different message. It's fine to have different messages for the dame diagnostic. I also don't want to proliferate diagnostics, or makes consumption super annoying.
docs/list-of-diagnostics.mdto include Extensions in MCPEXP001 descriptionExtensionsproperty toClientCapabilitieswith[Experimental]attribute using MCPEXP001Extensionsproperty toServerCapabilitieswith[Experimental]attribute using MCPEXP001Original prompt
Summary
Implement support for the MCP Extensions framework defined in SEP-2133. This SEP adds an
extensionsfield to bothClientCapabilitiesandServerCapabilitiesto allow clients and servers to advertise support for MCP extensions during the initialization handshake.What changed in the spec
The last commit of SEP-2133 (
f19398725c6ef464e1f3af0214cfde3ff4f80325) adds anextensionsfield to bothClientCapabilitiesandServerCapabilitiesin the draft schema:What needs to be done in the C# SDK
1. Add
Extensions_DiagnosticId,Extensions_Message, andExtensions_Urltosrc/Common/Experimentals.csFollow the existing pattern from
Tasks. Use diagnostic IDMCPEXP002. The message should mention that the Extensions feature is experimental per the MCP specification. The URL should point tohttps://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#mcpexp002.2. Update
docs/list-of-diagnostics.mdAdd a new row to the "Experimental APIs" table for
MCPEXP002describing the MCP Extensions feature and linking to the SEP-2133 PR.3. Add
Extensionsproperty toClientCapabilities(src/ModelContextProtocol.Core/Protocol/ClientCapabilities.cs)Add the following property:
4. Add
Extensionsproperty toServerCapabilities(src/ModelContextProtocol.Core/Protocol/ServerCapabilities.cs)Add the following property:
5. Suppress
MCPEXP002in project files that already suppressMCPEXP001Add
;MCPEXP002to the<NoWarn>in the following project files (these are the ones that already suppress MCPEXP001):src/ModelContextProtocol.Core/ModelContextProtocol.Core.csprojsrc/ModelContextProtocol/ModelContextProtocol.csprojsrc/ModelContextProtocol.AspNetCore/ModelContextProtocol.AspNetCore.csproj(if it suppresses MCPEXP001)tests/ModelContextProtocol.AotCompatibility.TestApp/ModelContextProtocol.AotCompatibility.TestApp.csprojsamples/LongRunningTasks/LongRunningTasks.csprojImportant patterns to follow
Extensionsshould beIDictionary<string, object>?— this matches the existingExperimentalproperty on both classes.[Experimental]attribute uses constants fromsrc/Common/Experimentals.cs— follow the same pattern as `Tasks_Diagno...This pull request was created from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.