Aspire is an amazing tool. You get easy access, real-time telemetry on a running application while you debug it in your local developer environment. It comes complete with a detailed suite of logs that delve deeply into that running code, giving you detailed analysis on what’s happening, what resources it consumes, and how long it takes. It can make it easier for you, as a developer, to figure out what’s going wrong and why.
AI code agents can sometimes be quite useful in identifying and resolving issues in your code. Sometimes it even does it faster than you can as the developer. The issue is that oftentimes, your AI tool doesn’t have access to the logs of your code while it’s running, forcing you to copy and paste back and forth between your runtime logs and your AI tool.
In the previous version of Aspire, they tried to tackle that issue by giving you direct access to Github Copilot from the Aspire dashboard. You could ask Copilot about your running code and it could see your logs in real-time. But what if you don’t use Copilot? Or what if you want the agent to be able to update the code and make fixes instead of just suggesting fixes in the chat sidebar?
With version 13 of Aspire, the problem has been solved. The Aspire dashboard utility now exposes an MCP server from the dashboard that will allow any AI coding tool to be able to access it and get information about your running code, including the logs, while the code is running.
MCP Servers
What is an MCP server, you might ask? MCP servers are utilities that run on a computer, be it locally or remotely, that allow an AI agent to ask questions about certain topics and get answers to help the agent answer the questions you ask in your prompts. Those questions can be about whatever topics the MCP server is programmed to provide information on. For example, a business might create an MCP server to answer questions about internal company topics such as HR questions or facility information about an office. It’s kind of like a specialized FAQ tool that an AI agent can use to respond to your prompts.
They can also allow an AI agent to automatically execute commands on the machine the MCP server is running on. Those commands are limited to whatever the MCP server is programmed to allow. For instance, you might create an MCP server that automatically converts a Word document to PDF format when an AI agent asks for a file. Or you might create an MCP server to search a folder of image files for images with specific tags or dates.
The MCP server that has been added to the Aspire dashboard allows AI agents to get information about app resources, console logs, real-time telemetry, and health checks. It also allows it to run the commands you have made available in the dashboard for your various resources. For example, you might tell your agent to make a configuration change in your API project and then restart that project from the Aspire dashboard.
Considerations
There are a couple of things to remember. First, the Aspire MCP server is only available while the application is running. Stop Aspire, and the MCP server is clearly no longer running. The other thing to keep in mind is that it is specific to that running application. And each Aspire application typically runs on a different port in your localhost. So, the MCP server for one application can’t provide information about a different application, even if both are running on your machine at the same time. Each has it’s own separate MCP server.
Another consideration is that the Aspire MCP server runs with a self-signed certificate. Some AI agents (and VS Code) don’t like that too well. For those tools, you’ll probably have to set it to access the MCP server using HTTP instead of HTTPS. There are more details in the Aspire docs on workarounds and security considerations.
One last thing to keep in mind. There’s a limit on the amount of data that can be passed back and forth. Aspire logs, especially the console logs, tend to get pretty detailed and hence, pretty long. So if you want it to analyze info in your console logs, make sure you filter your prompt as much as possible, and ask it soon after the event occurs that you want the AI to examine. Otherwise, the info in the log that you need might get truncated off the top and not included in what gets passed to the AI.
Installation
Installation is easy. You just have to let your AI agent know the address and API key for the Aspire MCP server. To get that information, the Aspire dashboard has a button at the top right of the page.
Clicking on this button will open a dialog that has the Aspire MCP server information for that running instance.
Depending on the AI tool you’re using, there are a couple of different installation processes. For VS Code and Visual Studio, there are buttons you can click to install the MCP server automagically. For most other AI agents, it will depend on the agent tool. For some there might be a JSON file you update. For others, you might have to configure some dialog. Check the docs for your preferred AI agent for the hows. But the Aspire dialog provides the information you need.
Once you enter the information, your AI agent should then have access to that MCP server to help you run and debug your Aspire application. Hook it up, and prompt away.
Prompts
So, what kinds of things can you ask your AI agent? There’s all kinds of things you might try:
- Are any of my resources unhealthy?
- Restart my API resource
- Analyze the errors in the web application logs
- What is the longest running API call?
Commands
The Aspire MCP server exposes the following commands to be accessed.
- list_resources - Lists all the resources available in your app and provides information about those resources, such as current state, health, endpoints, and available commands for that resource
- list_traces - This provides a list of traces available to be searched. It can be filtered by resource name
- list_structured_logs - This provides a list of the structured logs available. It can be filtered by resource name
- list_trace_structured_logs - Lists the structured logs for a specific trace.
- list_console_logs - Lists the console logs available for a resource
- execute_resource_command - executes a command for a specific resource.
For any command or resource that you don’t want exposed via the MCP server, you’ll add the ExcludeFromMcp() fluent syntax to the code in the AppHost file. For example:
var api = builder.AddProject<Projects.ApiService>("api").ExcludeFromMcp();One might ask about the security implications of exposing everything by default. The AppHost, and therefore the MCP server, only run on your local machine. They don’t get deployed when you deploy your code. Also, the MCP server requires a unique API key to access. Only those agent tools you’ve set up with that connection information will be able to make calls to it. And the MCP server is only running while you’re running your AppHost. So, overall, it’s really not that big of a concern.
Conclusion
The inclusion of Copilot in the previous version of Aspire was already pretty useful, but adding a full-on MCP server in Aspire 13 so that you can use whatever AI agent tool you want to takes it to a whole other level. Maybe Copilot isn’t your thing. Or maybe you want Copilot to be able to more than just give you answers in the browser chat window. Now you can. Aspire just keeps getting better and better.


