Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ seoTitle: "ASPIREMCP001: MCP server types and members are for"
description: Learn what causes the Aspire compiler warning ASPIREMCP001 and how to fix it so your AppHost builds cleanly. Resolve or suppress it to keep your Aspire build.
---

import { Badge } from '@astrojs/starlight/components';
import { Aside, Badge } from '@astrojs/starlight/components';
import ApiReference from '@components/ApiReference.astro';

<Badge
Expand All @@ -14,6 +14,10 @@ import ApiReference from '@components/ApiReference.astro';
class:list={'mb-1'}
/>

<Aside type="note">
`ASPIREMCP001` is retired for `WithMcpServer`. The method is stable and no longer reports this diagnostic. You can remove any suppressions you added for it.
</Aside>

> <abbr title="Model Context Protocol" data-tooltip-placement="top">MCP</abbr> server types and members are for evaluation purposes only and are subject to change or removal in future updates. Suppress this diagnostic to proceed.

This diagnostic warning is reported when using the experimental <ApiReference name="Aspire.Hosting.McpServerResourceBuilderExtensions.WithMcpServer" /> extension method and related Model Context Protocol (MCP) server APIs. These APIs enable Aspire tooling to discover and proxy MCP servers exposed by resources.
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/content/docs/diagnostics/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The following table lists the possible MSBuild and analyzer warnings and errors
| [ASPIREINTERACTION001](/diagnostics/aspireinteraction001/) | (Experimental) Warning | Interaction service types and members are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREJAVASCRIPT001](/diagnostics/aspirejavascript001/) | (Experimental) Warning | JavaScript hosting and publishing APIs are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREHOSTINGPYTHON001](/diagnostics/aspirehostingpython001/) | (Experimental) Error | <ApiReference name="Aspire.Hosting.PythonAppResourceBuilderExtensions.AddPythonApp" /> is for evaluation purposes only and is subject to change or removal in future updates. |
| [ASPIREMCP001](/diagnostics/aspiremcp001/) | (Experimental) Warning | <abbr title="Model Context Protocol" data-tooltip-placement="top">MCP</abbr> server types and members are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREMCP001](/diagnostics/aspiremcp001/) | (Retired) Warning | <abbr title="Model Context Protocol" data-tooltip-placement="top">MCP</abbr> server types and members are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREPERSISTENCE001](/diagnostics/aspirepersistence001/) | (Experimental) Error | Resource lifetime types and members are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREPIPELINES001](/diagnostics/aspirepipelines001/) | (Experimental) Error | Pipeline infrastructure APIs are for evaluation purposes only and are subject to change or removal in future updates. |
| [ASPIREPIPELINES002](/diagnostics/aspirepipelines002/) | (Experimental) Error | Deployment state manager APIs are for evaluation purposes only and are subject to change or removal in future updates. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ await builder.build().run();
</Tabs>

<Aside type="note">
The resource MCP APIs are experimental. Suppress the `ASPIREMCP001` or `ASPIREPOSTGRES001` diagnostic to use them.
The PostgreSQL MCP integration is experimental. Suppress the `ASPIREPOSTGRES001` diagnostic to use it. The `WithMcpServer` endpoint declaration helper is stable and no longer requires suppressing `ASPIREMCP001`.
</Aside>

<ContainerImages package="Aspire.Hosting.PostgreSQL" only="Postgres MCP" />
Expand Down Expand Up @@ -97,8 +97,6 @@ You can add any container that implements the MCP protocol as an MCP-enabled res
<Tabs syncKey='aspire-lang'>
<TabItem id='csharp' label='C#'>
```csharp title="AppHost.cs"
#pragma warning disable ASPIREMCP001

var builder = DistributedApplication.CreateBuilder(args);

// Add a custom MCP server container
Expand Down Expand Up @@ -126,14 +124,18 @@ await builder.build().run();
</TabItem>
</Tabs>

The MCP annotation method accepts an optional path and endpoint name:
`WithMcpServer` declares an MCP server that already exists on the resource. It adds metadata that Aspire tooling uses for discovery and proxying; it doesn't create an endpoint, start a server, or configure transport or authentication. The server must implement MCP at the declared URL.

The method accepts an optional path and endpoint name:

- With no arguments, it uses the default HTTP endpoint at `/mcp`.
- To use a named endpoint at a different path, pass the path and endpoint name, such as `/sse` and `https`.
- With no arguments, it uses the `https` endpoint if one exists, otherwise the `http` endpoint, at the `/mcp` path. Endpoint names are matched case-insensitively, regardless of declaration order.
- To use any other endpoint, pass its name with `endpointName`, even when it uses HTTPS.
- A path without a leading slash gets one added. A null or empty path uses the endpoint's base URL, and trailing slashes are kept.
- A missing endpoint selection fails when the resolver consumes the declaration, not when you call `WithMcpServer`.

## See also

- [Use AI coding agents](/get-started/ai-coding-agents/) — set up your project for AI agents
- [Aspire MCP server](/get-started/aspire-mcp-server/) — the built-in MCP server tools
- [ASPIREMCP001 diagnostic](/diagnostics/aspiremcp001/) — experimental MCP server API warning
- [ASPIREMCP001 diagnostic](/diagnostics/aspiremcp001/) — retired MCP server API warning
- [ASPIREPOSTGRES001 diagnostic](/diagnostics/aspirepostgres001/) — experimental PostgreSQL MCP warning
Loading