MCPCreating an MCP server

Creating an MCP server

Add Runiq.Mcp to an ASP.NET Core application and expose an MCP endpoint.

Start with an ASP.NET Core application that should expose selected capabilities through MCP.

Runiq.Mcp hosts the MCP endpoint from the same application process. The application keeps its normal ASP.NET Core setup, dependency injection container, configuration, and services.

Register Runiq.Mcp

Add Runiq.Mcp to the host application.

Program.cs
using Runiq.Mcp;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRuniqMcp();

Map the MCP endpoint

Map the MCP endpoint after building the application.

Snippet
var app = builder.Build();

app.MapRuniqMcp();

app.Run();

By default, the MCP endpoint is available at:

Snippet
/mcp

MCP-compatible clients connect to this endpoint using streamable HTTP transport.

Use a custom path

You can map a custom path when the default /mcp route does not fit your host application:

Snippet
app.MapRuniqMcp("/ai/mcp");

After the endpoint is mapped, expose application behavior by adding MCP tool classes. See Application service as MCP tool for the service-backed tool pattern.

On this page