Skip to content
Tracon

TraconMcpServerBuilderExtensions

Namespace Tracon · Assembly Tracon.AspNetCore.dll

Extensions that register the services needed to publish Tracon agents as MCP tools.

public static class TraconMcpServerBuilderExtensions

objectTraconMcpServerBuilderExtensions

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

UseMcpServer(ITraconBuilder, Action<TraconMcpServerOptions>?)

Section titled “ UseMcpServer(ITraconBuilder, Action<TraconMcpServerOptions>?)”

Registers the MCP server services. The HTTP endpoint must still be connected separately with app.MapTraconMcpServer(...).

public static ITraconBuilder UseMcpServer(this ITraconBuilder builder, Action<TraconMcpServerOptions>? configure = null)

builder ITraconBuilder

The Tracon configuration chain.

configure Action<TraconMcpServerOptions>?

Options mutator.

ITraconBuilder

The chain, for further configuration.

Registration happens HERE, not in MapTraconMcpServer: the MCP SDK’s AddMcpServer call operates on IServiceCollection and must happen BEFORE the application is Build-ed. The Map... extensions only connect already-built services to HTTP.

By default no agent is exposed. Exposing one requires an explicit choice via TraconMcpServerOptions.ExposedAgents or TraconMcpServerOptions.ExposeAllAgents.

Also registers the MCP Tasks extension, gated OFF by default through TraconMcpServerOptions.EnableTasks: the execution-mode selector returns McpTaskExecutionMode.Synchronous when it is off, which is the SDK’s own fast path back to today’s behavior — CreateTaskAsync is never called. The task-provisioning filter (Tracon.McpTaskRunProvisioningFilter) is still registered unconditionally; it is value-transparent when tasks are off, since it only replaces Tracon.CatalogToolCallHandler’s own id-minting with an equivalent one handed down ambiently.

builder.AddTracon()
.UseOpenAI(apiKey)
.UsePostgreSql(connectionString)
.UseMcpServer(o => o.ExposedAgents.Add("asistan"));
// ...
app.MapTracon("/tracon");
app.MapTraconMcpServer();

ArgumentNullException

builder is null.