Skip to content

Update ModelContextProtocol to 2.2.0 - #20045

Draft
Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-mcp-sdk-2-migration
Draft

Update ModelContextProtocol to 2.2.0#20045
Jose Perez Rodriguez (joperezr) wants to merge 1 commit into
mainfrom
joperezr-mcp-sdk-2-migration

Conversation

@joperezr

Copy link
Copy Markdown
Member

Description

Updates ModelContextProtocol from 1.3.0 to 2.2.0 as a separate, rollbackable breaking-change PR rather than combining the major SDK migration with the bulk third-party dependency update.

The package is consumed by the production Aspire CLI MCP server, the AppHost resource-MCP proxy, CLI tests, hosting tests, and the Foundry hosted-agent playground. The playground's VersionOverride="1.1.0" is removed so it does not defeat the central 2.2.0 version. No Microsoft.Extensions.AI, Microsoft.Extensions.AI.OpenAI, OpenAI, or unrelated Foundry package versions are changed.

The existing Aspire source compiles against 2.2.0 without API adaptations:

  • aspire agent mcp remains a stdio MCP server through StdioMcpTransportFactory / StdioServerTransport.
  • AppHost resource MCP integration remains an HTTP client through HttpClientTransport / McpClient.CreateAsync for tool discovery and invocation.
  • Aspire's built-in tools already emit Tool.InputSchema.
  • Aspire's built-in CLI tools manually construct content blocks and do not use the SDK's reflection-based non-object structured-result wrapping.

Dependency restore resolved 2.2.0 from the approved dotnet-public feed; no mirror pipeline was triggered.

Breaking changes

Affected scenario: user-defined MCP servers attached to Aspire resources with WithMcpServer(...), then discovered and invoked through the Aspire CLI MCP server.

Behavior
Before SDK 1.3 tolerated a tools/list entry that omitted inputSchema and supplied a default schema.
After SDK 2.2 requires every Tool payload to contain inputSchema; malformed entries throw during deserialization. Aspire's AppHost discovery logs the failure and omits that resource's tools from the CLI tool list.

Custom MCP servers and proxies must include an input schema for every tool. An empty object is sufficient for tools without arguments:

{
  "name": "restart",
  "description": "Restarts the resource",
  "inputSchema": {}
}

A more descriptive schema remains preferred:

{
  "name": "query",
  "description": "Runs a query",
  "inputSchema": {
    "type": "object",
    "properties": {
      "sql": { "type": "string" }
    },
    "required": ["sql"]
  }
}

Compatibility assumptions and exclusions:

  • This does not mean every older MCP peer breaks. SDK 2 clients probe server/discover first and fall back to the down-level initialize handshake when communicating with older servers; older compliant servers that include inputSchema remain supported.
  • The SDK 2 stateless-by-default HTTP server change does not apply to aspire agent mcp, because Aspire serves that endpoint over stdio, not HttpServerTransport.
  • Aspire is only an HTTP MCP client for resource endpoints; this PR does not change a hosted Aspire HTTP MCP server's session mode.
  • Aspire does not configure SDK OAuth callbacks or dynamic client registration for resource endpoints, so SDK 2's stricter PKCE S256, issuer metadata, and callback validation does not change an existing Aspire-managed OAuth flow.
  • The SDK's raw non-object structuredContent behavior does not change Aspire's built-in tool result shape. Resource MCP results continue to pass through the SDK CallToolResult over the AppHost backchannel.

Rollback: revert the central package version to 1.3.0 and restore the Foundry playground's 1.1.0 override. No data or configuration migration is required.

Upstream references:

Test evidence

  • Built src/Aspire.Cli/Aspire.Cli.csproj, src/Aspire.Hosting/Aspire.Hosting.csproj, and playground/FoundryAgents/DotNetHostedAgent/DotNetHostedAgent.csproj with no warnings or errors.
  • Passed 18 focused CLI MCP server and backchannel serialization tests.
  • Passed 80 hosting MCP endpoint, resource discovery, and auxiliary backchannel tests.
  • Resolved Foundry graph remains Microsoft.Extensions.AI 10.7.0, Microsoft.Extensions.AI.OpenAI 10.9.0, OpenAI 2.12.0, and ModelContextProtocol 2.2.0.

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 20045

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 20045"

@github-actions github-actions Bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 10, 2026
@aspire-repo-bot
aspire-repo-bot Bot requested a balanced review from Copilot September 10, 2026 19:11
@joperezr Jose Perez Rodriguez (joperezr) added the breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. label Sep 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

Selects the full PR test matrix + all PR-gated jobs (ALL) — a rule matching 'Directory.Packages.props' selects ALL

Advisory workflow impact (4)

  • Aspire.Deployment.EndToEnd.Tests (deployment workflow-only)
  • Aspire.EndToEnd.Tests (outerloop-only)
  • Aspire.Oracle.EntityFrameworkCore.Tests (outerloop-only)
  • deployment-e2e (schedule/dispatch-only)

Selection computed for commit 00187dc.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The deployment fixture remains pinned to 1.1.0, and the documented malformed-tool behavior lacks focused coverage.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity Directory.Packages.props — Cover malformed tool discovery under SDK 2.2
Medium severity playground/​FoundryAgents/​DotNetHostedAgent/​DotNetHostedAgent.csproj — Keep the deployment fixture on MCP 2.2
What changed in this PR

Updates ModelContextProtocol to 2.2.0 across centrally managed consumers.

Changes:

  • Bumps the central package version from 1.3.0 to 2.2.0.
  • Removes the Foundry playground’s 1.1.0 override.
File Description
Directory.Packages.props Sets ModelContextProtocol 2.2.0 centrally.
playground/​FoundryAgents/​DotNetHostedAgent/​DotNetHostedAgent.csproj Uses the central package version.

Comment thread Directory.Packages.props
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" Version="5.0.0-rc.6.26241.1" />
<PackageVersion Include="Milvus.Client" Version="2.3.0-preview.1" /> <!-- No stable release available -->
<PackageVersion Include="ModelContextProtocol" Version="1.3.0" />
<PackageVersion Include="ModelContextProtocol" Version="2.2.0" />
<PackageReference Include="Microsoft.Agents.AI.Foundry.Hosting" VersionOverride="1.12.0-preview.260629.1" />
<PackageReference Include="Microsoft.Extensions.AI" VersionOverride="10.7.0" />
<PackageReference Include="ModelContextProtocol" VersionOverride="1.1.0" />
<PackageReference Include="ModelContextProtocol" />
@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

@github-actions

Copy link
Copy Markdown
Contributor

Retrying the failed CI jobs for this pull request from the CI run attempt. The rerun is being tracked in the rerun attempt.

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

Labels

breaking-change Issue or PR that represents a breaking API or functional change over a prerelease. needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants