microsoft/aspire · error · McpProtocolException

InternalError

InternalError

Error message

No Aspire AppHost is currently running. To use Aspire MCP tools, you must first start an Aspire application by running 'aspire start' in your AppHost project directory. Once the application is running, the MCP tools will be able to connect to the dashboard and execute commands.

What it means

Identical family to error 174 but thrown by ListResourcesTool.CallToolAsync: the tool cannot obtain a live connection to a running AppHost (GetSelectedConnectionAsync returned null) and throws McpErrorMessages.NoAppHostRunning as an McpProtocolException with code InternalError. No resource listing can occur without that connection.

Solutions

  1. Start the application with 'aspire start' in the AppHost project directory, then retry.
  2. Check the AppHost is still alive and restart it if it crashed.
  3. Re-establish/re-select the backchannel connection in the CLI session.
  4. Ensure the MCP client and the AppHost run in the same environment/user session.
Defensive patterns

Strategy: try-catch

Validate before calling

var connection = await AppHostConnectionHelper.GetSelectedConnectionAsync(monitor, logger, ct);
if (connection is null)
{
    // Ensure 'aspire start' is running before calling list-resources
}

Try / catch

try
{
    await ListResourcesAsync();
}
catch (McpProtocolException ex) when (ex.Message.Contains("No Aspire AppHost is currently running"))
{
    // Surface guidance: run 'aspire start' in the AppHost project directory
}

Prevention

When it happens

Trigger: Calling the list-resources MCP tool with no 'aspire start' session, after the AppHost exited, or before any auxiliary backchannel connection is established/selected.

Common situations: Fresh CLI session with no running app; AppHost terminated between calls; multiple environments and the monitor has no selected connection; CI/agent environments where the AppHost was never started.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/12a73b8bef42cb1f. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Cli/Mcp/Tools/ListResourcesTool.cs:67

/// </summary>
internal sealed class ListResourcesTool(IAuxiliaryBackchannelMonitor auxiliaryBackchannelMonitor, ILogger<ListResourcesTool> logger) : CliMcpTool
{
    public override string Name => KnownMcpTools.ListResources;

    public override string Description => "List the application resources. Includes information about their type (.NET project, container, executable), running state, source, HTTP endpoints, health status, commands, configured environment variables, and relationships.";

    public override JsonElement GetInputSchema()
    {
        return JsonDocument.Parse("{ \"type\": \"object\", \"properties\": {} }").RootElement;
    }

    public override async ValueTask<CallToolResult> CallToolAsync(CallToolContext context, CancellationToken cancellationToken)
    {
        var connection = await AppHostConnectionHelper.GetSelectedConnectionAsync(auxiliaryBackchannelMonitor, logger, cancellationToken).ConfigureAwait(false);
        if (connection is null)
        {
            logger.LogWarning("No Aspire AppHost is currently running");
            throw new McpProtocolException(McpErrorMessages.NoAppHostRunning, McpErrorCode.InternalError);
        }

        try
        {
            // Get dashboard URL and resource snapshots in parallel
            var dashboardUrlsTask = connection.GetDashboardUrlsAsync(cancellationToken);
            var snapshotsTask = connection.GetResourceSnapshotsAsync(includeHidden: true, cancellationToken);

            await Task.WhenAll(dashboardUrlsTask, snapshotsTask).ConfigureAwait(false);

            var dashboardUrls = await dashboardUrlsTask.ConfigureAwait(false);
            var snapshots = await snapshotsTask.ConfigureAwait(false);

            // Filter out resources that have opted out of MCP.
            snapshots = snapshots.Where(s => !McpToolHelpers.IsExcludedFromMcp(s)).ToList();

            if (snapshots.Count == 0)
            {

View on GitHub (pinned to 25830f84bd)