跳转到内容
Docs Try Aspire
Docs Try

Dashboard and AI coding agents

此内容尚不支持你的语言。

AI coding agents can use the Aspire CLI and Aspire MCP server to fetch logs and telemetry from the Aspire dashboard. This gives agents the same observability data that developers see in the dashboard UI — structured logs, distributed traces, resource status, and console output — so they can diagnose issues, verify fixes, and add new features with full context.

When an Aspire app is running, the dashboard collects OpenTelemetry data from all resources. AI coding agents access this data through two channels:

  • Aspire CLI — Commands like aspire logs, aspire otel logs, aspire otel traces, and aspire describe retrieve resource status, console logs, and telemetry directly from the terminal. All commands support --format Json for structured output that agents can parse.
  • Aspire MCP server — The MCP server exposes tools such as list_resources, list_structured_logs, list_traces, and list_console_logs that agents call directly through the Model Context Protocol.

Both channels draw from the same underlying dashboard data. Whether an agent reads logs via the CLI or through MCP tools, it sees the same information as the dashboard UI.

The following workflow is an example — Aspire skill files teach agents the best patterns to run and debug Aspire apps automatically. A typical agent-driven debugging session looks like this:

  1. The agent starts the Aspire app with aspire start and waits for resources to become healthy with aspire wait.
  2. The agent runs aspire describe to check resource status and identify any unhealthy services.
  3. The agent fetches structured logs with aspire otel logs or the list_structured_logs MCP tool, filtering by resource name to find errors.
  4. The agent retrieves distributed traces with aspire otel traces to understand cross-service request flow and identify latency issues.
  5. Using the collected data, the agent makes code changes, restarts the affected resource, and verifies the fix by checking logs and traces again.

The fastest way to set up AI coding agents with Aspire is the aspire agent init command. See Use AI coding agents for the full setup guide, including skill files, MCP server configuration, and supported AI assistants.

The Aspire CLI and MCP server work with the standalone dashboard — you don’t need an Aspire AppHost project. This is useful when monitoring any application that sends OpenTelemetry data to the dashboard.

Start the dashboard using the Aspire CLI:

Aspire CLI
aspire dashboard run --allow-anonymous

The dashboard starts with the following defaults:

  • Frontend UI at http://localhost:18888
  • OTLP/gRPC endpoint at http://localhost:4317
  • OTLP/HTTP endpoint at http://localhost:4318

Use Aspire CLI with the standalone dashboard

Section titled “Use Aspire CLI with the standalone dashboard”

Pass --dashboard-url with the full frontend URL to point CLI commands at a standalone dashboard:

Aspire CLI
aspire otel logs --dashboard-url "http://localhost:18888"
aspire otel traces --dashboard-url "http://localhost:18888"
aspire otel spans --dashboard-url "http://localhost:18888"

Use Aspire MCP with the standalone dashboard

Section titled “Use Aspire MCP with the standalone dashboard”

Start the MCP server in dashboard-only mode using --dashboard-url:

Aspire CLI
aspire agent mcp --dashboard-url "http://localhost:18888"

This exposes the dashboard’s telemetry tools (structured logs, traces, and resource data) to any MCP-compatible AI assistant.

Configuration is required in the agent to use the MCP server. For configuration details, see Aspire MCP server configuration. The --dashboard-url must be passed as a command line argument when configuring the MCP server for standalone use.

The following is a sample skill file that teaches an AI coding agent how to start the standalone dashboard and query its data. Save it as .github/skills/aspire-standalone/SKILL.md (for GitHub Copilot) or .claude/skills/aspire-standalone/SKILL.md (for Claude Code):

SKILL.md
---
name: aspire-standalone
description: Use the Aspire standalone dashboard for observability. Start the dashboard, send telemetry, and query logs and traces with the Aspire CLI.
---
# Aspire Standalone Dashboard
## Start the dashboard
```bash
aspire dashboard run --allow-anonymous
```
The dashboard UI is at http://localhost:18888.
Apps should send OpenTelemetry to http://localhost:4317 (gRPC) or http://localhost:4318 (HTTP).
## Query telemetry
View structured logs:
```bash
aspire otel logs --dashboard-url http://localhost:18888
```
View distributed traces:
```bash
aspire otel traces --dashboard-url http://localhost:18888
```
View trace spans:
```bash
aspire otel spans --dashboard-url http://localhost:18888
```
## Rules
- Ensure the dashboard has started querying telemetry. The dashboard may already be running.
- Use `--format Json` with CLI commands when you need to parse the output.
- Check `aspire otel logs` for errors after making code changes.
- Use `aspire otel traces` to investigate cross-service latency.