.net MCP package intergation with ServiceStack

Hi,

is there a way to use the .net MCP server alongside with Servicestack? Better said in a .net Core Sevicestack project?

I am using these packages:

ModelContextProtocol --prerelease
Microsoft.Extensions.Hosting
ModelContextProtocol.AspNetCore

I couldn’t get the standart implementation from the Microsoft docs working.

builder.Services.AddMcpServer().WithHttpTransport().WithToolsFromAssembly();
app.MapMcp();

Thank you.

Never tried it, although ServiceStack itself is just another middleware in an ASP .NET Core App, it shouldn’t affect other middleware that’s registered before it. Does it work without running ServiceStack? (i.e. app.UseServiceStack())

Yes I tried to use it before registering ServiceStack

app.UseServiceStack(new AppHost());

but i couldn’t connect to the MCP Server.
It works in a normal WebApp

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ModelContextProtocol.Server;
namespace MyMcpServer
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var builder = WebApplication.CreateBuilder(args);
            builder.Services.AddMcpServer().WithHttpTransport().WithToolsFromAssembly();

            var app = builder.Build();
            app.MapMcp();

            app.Run();
        }
    }
}

Does it work in your ServiceStack App when you don’t run ServiceStack?

// Comment this out
// app.UseServiceStack(new AppHost());

Yes, it does work. But as soon as I add it back I get:
Connection Error - Check if your MCP server is running and proxy token is correct

It might be a routing conflict with the built-in /api pre-defined route, can you try disabling it with:

ConfigurePlugin<PredefinedRoutesFeature>(feature => feature.JsonApiRoute = null);

Otherwise if it’s still an issue can you publish a repro of this project on a GitHub Repo so I can try running it locally.