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
Thrown by ListConsoleLogsTool.CallToolAsync when AppHostConnectionHelper.GetSelectedConnectionAsync returns null, meaning the CLI has no live auxiliary backchannel connection to a running Aspire AppHost. The shared message McpErrorMessages.NoAppHostRunning explains how to start one; code is InternalError (-32603).
Solutions
- Run 'aspire start' in your AppHost project directory, then retry the tool call.
- Verify the AppHost process is still running (dashboard reachable) and restart it if it exited.
- Reconnect the CLI/session to the running AppHost so a backchannel connection is selected.
- Confirm you are operating in the same project directory / environment as the running AppHost.
Example fix
# before: tool call fails with no connection aspire mcp list-console-logs --resource frontend # after: start the AppHost first aspire start aspire mcp list-console-logs --resource frontend
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight: verify a live AppHost connection before calling the tool
var connection = await AppHostConnectionHelper.GetSelectedConnectionAsync(monitor, logger, ct);
if (connection is null)
{
// Prompt user to run 'aspire start' in the AppHost project directory
} Try / catch
try
{
await ListConsoleLogsAsync(resourceName);
}
catch (McpProtocolException ex) when (ex.Message.Contains("No Aspire AppHost is currently running"))
{
logger.LogWarning("AppHost not running; instruct user to run 'aspire start' and retry.");
} Prevention
- Start the AppHost with 'aspire start' before invoking MCP tools.
- Check the dashboard is reachable before each tool session.
- Handle AppHost restarts by re-establishing the backchannel connection.
- Run the MCP client and AppHost in the same directory/environment/session.
When it happens
Trigger: Calling the list-console-logs MCP tool while no 'aspire start' session is active, the AppHost has exited, or no backchannel connection is selected in the monitor.
Common situations: Running MCP clients in a fresh terminal before starting the AppHost; AppHost crashed or was stopped; CLI session pointed at a different directory than the AppHost project; backchannel dropped after an AppHost restart.
Related errors
AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16).
Data as JSON: /api/errors/1eeb740102bcd141.
Report an issue: GitHub.
Appendix: source
Thrown at src/Aspire.Cli/Mcp/Tools/ListConsoleLogsTool.cs:71
}
if (string.IsNullOrEmpty(resourceName))
{
throw new McpProtocolException("The resourceName parameter is required.", McpErrorCode.InvalidParams);
}
string? search = null;
if (arguments is not null && arguments.TryGetValue("search", out var searchElement) &&
searchElement.ValueKind == JsonValueKind.String)
{
search = searchElement.GetString();
}
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);
}
// Check if the resource is excluded from MCP before fetching logs.
// This is the only check needed because the resource name is required for this tool.
var excludedResult = await McpToolHelpers.CheckResourceExcludedAsync(connection, resourceName, cancellationToken).ConfigureAwait(false);
if (excludedResult is not null)
{
return excludedResult;
}
try
{
var logParser = new LogParser(ConsoleColor.Black);
var logEntries = new LogEntries(maximumEntryCount: SharedAIHelpers.ConsoleLogsLimit) { BaseLineNumber = 1 };
// Collect logs from the backchannel
await foreach (var logLine in connection.GetResourceLogsAsync(resourceName, follow: false, cancellationToken).ConfigureAwait(false))
{View on GitHub (pinned to 25830f84bd)