2

I'm working on a tool using ModelContextProtocol in C# (.NET 8), and I'm hitting a frustrating issue when trying to run my MCP server from JetBrains Rider.

Here's the setup:

My Program.cs uses WithStdioServerTransport():

builder.Services.AddMcpServer().WithStdioServerTransport().WithToolsFromAssembly();

I can run the project just fine from Visual Studio Code using:

{
    "servers": {
        "TestMcp": {
            "type": "stdio",
            "command": "dotnet",
            "args": [
                "run",
                "--project",
                "/Path/To/My/Project/Project.csproj"
            ]
        }
    }
}

and MCP connects in VSCode without issues.

But when I try to run it from Rider, either:

  • via a regular Run Configuration
  • or via the MCP tool integration (using .mcp.json or JSON config)

I get this error:

MCP error -1: Connection closed

Logging shows that the app does start, and even prints:

Application started...

So stdin/stdout are technically there — but MCP just immediately disconnects when launched from Rider. Same thing happens if I Dockerize the app and run it via Rider with docker run -i.

What I've tried:

  • Switching to WithStreamServerTransport(Console.OpenStandardInput(), Console.OpenStandardOutput()) – same issue
  • Manually flushing the streams with Console.Out.Flush() – still no luck
  • Setting "type": "stdio" in .mcp.json – doesn't seem to matter in Rider

Running the same setup from VS Code and Claude Desktop – works perfectly

My Question: Is this a known issue with Rider and StdioServerTransport in MCP?

1 Answer 1

0

It looks similar to a known issue in JetBrains AI Assistant: https://youtrack.jetbrains.com/issue/LLM-16647. The fix should be available in the latest 2025.2 EAP build: https://www.jetbrains.com/rider/nextversion.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.