# McpServerEndpointAnnotation

- Kind: `class`
- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.ApplicationModel`
- Target framework: `net8.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/McpServerEndpointAnnotation.cs)
- Implements: [IResourceAnnotation](/reference/api/csharp/aspire.hosting/iresourceannotation.md)

Represents an annotation that identifies an endpoint on a resource that hosts a Model Context Protocol (MCP) server.

## Definition

```csharp
namespace Aspire.Hosting.ApplicationModel;

public sealed class McpServerEndpointAnnotation
    : Aspire.Hosting.ApplicationModel.IResourceAnnotation
{
    // ...
}
```

## Remarks

This annotation is intended for discovery and proxying scenarios where the Aspire AppHost can act as a mediator between clients (such as the Aspire CLI) and MCP servers exposed by resources.

## Constructors

- [McpServerEndpointAnnotation(Func<IResourceWithEndpoints, CancellationToken, Task<Uri?>>)](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation/constructors.md#constructor-func-iresourcewithendpoints-cancellationtoken-task-uri) -- Initializes a new instance of the [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) class.

## Properties

- [EndpointUrlResolver](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation/properties.md#endpointurlresolver) : `Func<IResourceWithEndpoints, CancellationToken, Task<Uri?>>` `get` -- Gets the callback that resolves the MCP server endpoint URL from the resource.

## Methods

- [FromEndpoint(string, string?)](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation/methods.md#fromendpoint-string-string) : [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) `static` -- Creates an [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) that resolves the MCP server URL from a named endpoint.
