# McpServerEndpointAnnotation Methods

- Package: [Aspire.Hosting](/reference/api/csharp/aspire.hosting.md)
- Type: [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md)
- Kind: `Methods`
- Members: `1`

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

## FromEndpoint(string, string?)

- Name: `FromEndpoint(string, string?)`
- Modifiers: `static`
- Returns: [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md)
- Source: [GitHub](https://github.com/microsoft/aspire/blob/bd20f904cde09ecb9c9ae5116a6f13614bf2d7c2/src/Aspire.Hosting/ApplicationModel/McpServerEndpointAnnotation.cs#L38-L67)

Creates an [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) that resolves the MCP server URL from a named endpoint.

```csharp
public sealed class McpServerEndpointAnnotation
{
    public static McpServerEndpointAnnotation FromEndpoint(
        string endpointName,
        string? path = "/mcp")
    {
        // ...
    }
}
```

## Parameters

- `endpointName` (`string`)
  The name of the endpoint on the resource that hosts the MCP server.
- `path` (`string?`) `optional`
  An optional path to append to the endpoint URL. Defaults to `"/mcp"`.

## Returns

[McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) -- A new [McpServerEndpointAnnotation](/reference/api/csharp/aspire.hosting/mcpserverendpointannotation.md) instance.
