Skip to content
Merged
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
6 changes: 6 additions & 0 deletions docs/list-of-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ Connection-string physical-name metadata (`ConnectionStringEnvironmentVariableNa
`ConnectionStringReference.EnvironmentVariableNames`) is stable and no longer produces
`ASPIRECONNECTIONSTRINGS001`. Existing suppressions of that diagnostic can be removed.

### Retired Experimental API Warnings

| Diagnostic ID | Description | Location |
| ------------- | ----------- | -------- |
| `ASPIREMCP001` | MCP endpoint declaration via `WithMcpServer` is stable and no longer requires suppression. This declares an existing server for Aspire tooling discovery and proxying; it does not implement or configure an MCP transport. | [src/Aspire.Hosting/McpServerResourceBuilderExtensions.cs](../src/Aspire.Hosting/McpServerResourceBuilderExtensions.cs) |

## Analyzer Warnings

| Diagnostic ID | Severity | Description | Location |
Expand Down
1 change: 0 additions & 1 deletion src/Aspire.Hosting.PostgreSQL/PostgresBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREMCP001
#pragma warning disable ASPIRETERMINAL001

using System.Globalization;
Expand Down
13 changes: 9 additions & 4 deletions src/Aspire.Hosting/McpServerResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.ApplicationModel;

namespace Aspire.Hosting;
Expand All @@ -18,13 +17,20 @@ public static class McpServerResourceBuilderExtensions
/// </summary>
/// <typeparam name="T">The resource type.</typeparam>
/// <param name="builder">The resource builder.</param>
/// <param name="path">An optional path to append to the endpoint URL when forming the MCP server address. Defaults to <c>"/mcp"</c>.</param>
/// <param name="endpointName">An optional name of the endpoint that hosts the MCP server. If not specified, defaults to the first HTTPS or HTTP endpoint.</param>
/// <param name="path">An optional path to append to the endpoint URL when forming the MCP server address. Defaults to <c>"/mcp"</c>.
/// A leading slash is added if missing. A null or empty value uses the endpoint URL without an additional path.</param>
/// <param name="endpointName">An optional name of the endpoint that hosts the MCP server. If not specified, selects the endpoint
/// named <c>https</c>, falling back to the endpoint named <c>http</c>. Names are matched case-insensitively;
/// endpoints with other names must be selected explicitly, regardless of their URI scheme.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{T}"/> for chaining additional configuration.</returns>
/// <ats-returns>The resource builder.</ats-returns>
/// <remarks>
/// This method adds an <see cref="McpServerEndpointAnnotation"/> to the resource, enabling the Aspire tooling
/// to discover and proxy the MCP server exposed by the resource.
/// It does not create an endpoint, start an MCP server, or configure its transport or authentication.
/// The resource must already expose an MCP server at the selected endpoint and path.
/// Endpoint selection and URL resolution occur when tooling consumes the annotation, not when this method is called.
/// A missing selected endpoint causes resolution to throw a <see cref="DistributedApplicationException"/>.
/// </remarks>
/// <example>
/// Mark a resource as hosting an MCP server using the default endpoint:
Expand All @@ -38,7 +44,6 @@ public static class McpServerResourceBuilderExtensions
/// .WithMcpServer("/sse", endpointName: "https");
/// </code>
/// </example>
[Experimental("ASPIREMCP001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
[AspireExport]
public static IResourceBuilder<T> WithMcpServer<T>(
this IResourceBuilder<T> builder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3341,16 +3341,17 @@ type Aspire_Hosting_CodeGeneration_Go_TestsTestVaultResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) Aspire_Hosting_CodeGeneration_Go_TestsTestVaultResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -7470,16 +7471,17 @@ type CSharpAppResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) CSharpAppResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -14900,16 +14902,17 @@ type ContainerResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) ContainerResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -21142,16 +21145,17 @@ type DotnetToolResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) DotnetToolResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -26330,16 +26334,17 @@ type ExecutableResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) ExecutableResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -37926,16 +37931,17 @@ type ProjectResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) ProjectResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -43978,16 +43984,17 @@ type TestDatabaseResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) TestDatabaseResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -48459,16 +48466,17 @@ type TestRedisResource interface {
//
// This method adds an McpServerEndpointAnnotation to the resource, enabling the
// Aspire tooling to discover and proxy the MCP server exposed by the resource.
// It does not create an endpoint, start an MCP server, or configure its
// transport or authentication. The resource must already expose an MCP server
// at the selected endpoint and path. Endpoint selection and URL resolution
// occur when tooling consumes the annotation, not when this method is called. A
// missing selected endpoint causes resolution to throw a
// DistributedApplicationException.
//
// Parameters:
// - options: Optional parameters; see [WithMcpServerOption].
//
// Returns: The resource builder.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a later
// release.
WithMcpServer(options ...WithMcpServerOption) TestRedisResource

// WithMergeEndpoint configures a named endpoint
Expand Down Expand Up @@ -53522,10 +53530,13 @@ func (o *WithHttpHealthCheckOptions) ToMap() map[string]any {
// WithMcpServerOptions carries optional parameters for WithMcpServer.
type WithMcpServerOptions struct {
// Path is an optional path to append to the endpoint URL when forming the MCP
// server address. Defaults to "/mcp".
// server address. Defaults to "/mcp". A leading slash is added if missing. A
// null or empty value uses the endpoint URL without an additional path.
Path *string `json:"path,omitempty"`
// EndpointName is an optional name of the endpoint that hosts the MCP server.
// If not specified, defaults to the first HTTPS or HTTP endpoint.
// If not specified, selects the endpoint named https, falling back to the
// endpoint named http. Names are matched case-insensitively; endpoints with
// other names must be selected explicitly, regardless of their URI scheme.
EndpointName *string `json:"endpointName,omitempty"`
}

Expand Down
Loading
Loading