Skip to content

Add Dashboard:Mcp:Stateless configuration option to enable stateless HTTP transport Labels: area-mcp, area-dashboard #13318

@kellen-dunham

Description

@kellen-dunham

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

When using the Aspire Dashboard MCP server with AI assistants (Claude Code, Cursor, etc.), sessions frequently become invalid with 404 "Session not found" errors. This occurs when:

  1. The Aspire AppHost restarts but the AI client doesn't
  2. The MCP session times out (default 2 hours, but checked every 5 seconds)
  3. Any interruption in the SSE streaming connection

This is a significant developer experience issue - users must manually reset their MCP client connections after every AppHost restart.

Describe the solution you'd like

The MCP C# SDK's HttpServerTransportOptions has a Stateless property that eliminates session management entirely:
If true, SessionId will be null, and the "MCP-Session-Id" header will not be used, the RunSessionHandler will be called once for each request, and the "/sse" endpoint will be disabled.

Current code in McpExtensions.cs:
.WithHttpTransport() // No options passed

Proposed change:

  1. Add Stateless property to McpOptions:

public bool Stateless { get; set; } = false;

  1. Pass it to WithHttpTransport:

.WithHttpTransport(options =>
{
options.Stateless = dashboardOptions.Mcp.Stateless;
})

  1. Users can then configure via environment variable:

Dashboard__Mcp__Stateless=true

Additional context

Reference: Simon Doy's article on MCP stateless mode describes this exact issue and solution for Copilot Studio. Relation to CLI MCP (#12394): The upcoming CLI MCP server will face the same challenge - if the CLI connects to a dashboard that restarts, its session becomes invalid. The Aspire CLI MCP spec mentions using a Unix socket backchannel to obtain credentials, but the underlying HTTP transport will still have session state issues unless stateless mode is available.

Trade-offs of stateless mode:

  • Eliminates session management issues
  • Allows dashboard restarts without breaking clients
  • Disables SSE endpoint (no server-initiated messages)
  • Disables client sampling and roots capabilities

For most Aspire MCP use cases (querying resources, logs, traces), stateless mode is sufficient since all operations are client-initiated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions