Creating an MCP server
Register the MCP transport and expose it from your ASP.NET Core host.
Use the host that owns the services clients should call. Studio and an agent runtime are optional for an MCP-only application.
Register and map the server
Install Runiq.AI.Mcp, then add this startup code:
This registers stateless Streamable HTTP at /mcp. Add the tool and service from Application service as a tool to expose a callable operation.
Understand discovery
AddRuniqMcp() discovers attributed tool classes in the application's entry assembly. Put the example tool in the host project; do not assume every referenced library is automatically scanned.
Methods marked with [McpServerTool] on a [McpServerToolType] class become tool candidates. Register their service dependencies with the host.
Choose the endpoint
Replace the default mapping to use a custom route:
Configure the MCP client with the host's actual address and that path. Studio's URL is a separate inspection surface.
Configure access in the host
Apply your application's access policy to the MCP route and enforce data access in its services. A Studio access rule does not protect a separately mapped /mcp endpoint.
MapRuniqMcp() returns the endpoint route builder, not an endpoint convention builder. Do not chain RequireAuthorization() directly onto its return value.
Continue with Application service as a tool.