# TraconMcpServerExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.traconmcpserverextensions/
> Summary: TraconMcpServerExtensions: Extensions that connect the HTTP endpoint that publishes Tracon agents as MCP tools.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.AspNetCore.dll</code></div>

Extensions that connect the HTTP endpoint that publishes Tracon agents
as MCP tools.

```csharp
public static class TraconMcpServerExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.traconmcpserverextensions/">TraconMcpServerExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Fields

### <a id="Tracon_TraconMcpServerExtensions_DefaultPattern"></a> DefaultPattern

Default path.

```csharp
public const string DefaultPattern = "/tracon/mcp"
```

#### Field Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_TraconMcpServerExtensions_MapTraconMcpServer_Microsoft_AspNetCore_Routing_IEndpointRouteBuilder_System_String_"></a> MapTraconMcpServer\(IEndpointRouteBuilder, string\)

Publishes the exposed agents in the catalog as MCP tools.

```csharp
public static IEndpointConventionBuilder MapTraconMcpServer(this IEndpointRouteBuilder endpoints, string pattern = "/tracon/mcp")
```

#### Parameters

`endpoints` [IEndpointRouteBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.routing.iendpointroutebuilder)

The application's routing builder.

`pattern` [string](https://learn.microsoft.com/dotnet/api/system.string)

Path. Default is `/tracon/mcp`.

#### Returns

 [IEndpointConventionBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.builder.iendpointconventionbuilder)

The endpoint's convention builder.

#### Remarks

Applies the SAME three-layer protection as `MapTracon`
(loopback + bearer token + authorization policy) — settings are
inherited from there, a second settings set is not built.

If `AllowRemoteAccess` is enabled this fails at startup. A
single static token is not enough for an exposed agent surface.

If an exposed agent carries a tool that requires approval the
application STILL fails — but not synchronously from this method,
rather through [Tracon.McpApprovalGuardFilter](/api/tracon/): the check waits in
the background until the SQL schema is ready (so this method itself
does not crash with "no such table" against an empty database, the same
pattern), completes by the first request, and no request can
get ahead of it.

```csharp
app.MapTracon();
app.MapTraconMcpServer();
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`endpoints` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`pattern` is empty.

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

`UseMcpServer` or `MapTracon` has not been called
first, or this is called while remote access is enabled.
