MCP Inspector integration
Цей контент ще не доступний вашою мовою.
MCP Inspector is a development tool for testing and debugging Model Context Protocol (MCP) servers. The Aspire Community Toolkit integration adds it to your AppHost and configures it to inspect one or more HTTP MCP server resources.
Use the Inspector UI to connect to the configured server and test its MCP interactions. Aspire starts the Inspector alongside your application and provides a dashboard link to its client endpoint.
Why use the MCP Inspector integration?
Section titled “Why use the MCP Inspector integration?”- Run the Inspector as an Aspire-managed resource beside your MCP server.
- Configure server endpoints, transport types, paths, and a default server from the AppHost.
- Use the Aspire dashboard to open the Inspector and monitor its health.
How it works
Section titled “How it works”The AppHost starts your MCP server and the Inspector process. Calling WithMcpServer registers the server endpoint with the Inspector and creates a resource relationship in the dashboard. The Inspector has a browser client endpoint and a server proxy endpoint. Aspire configures a proxy authentication token and adds it to the Inspector’s dashboard URL.
Prerequisites
Section titled “Prerequisites”- An MCP server resource with at least one HTTP endpoint.
- Node.js and npm available on the machine running the AppHost. To use Yarn, pnpm, or Bun instead, install that package manager as well.
Add MCP Inspector to the AppHost
Section titled “Add MCP Inspector to the AppHost”Install the hosting integration package in your AppHost project:
aspire add communitytoolkit-mcpinspectorAspire CLI інтерактивний; оберіть відповідний результат пошуку:
Select an integration to add:
> communitytoolkit-mcpinspector (CommunityToolkit.Aspire.Hosting.McpInspector)> Other results listed as selectable options...#:package CommunityToolkit.Aspire.Hosting.McpInspector@*<PackageReference Include="CommunityToolkit.Aspire.Hosting.McpInspector" Version="*" />Add your MCP server and MCP Inspector as AppHost resources:
import { createBuilder } from './.aspire/modules/aspire.mjs';
const builder = await createBuilder();
const mcpServer = await builder.addProject( 'mcp-server', '../McpServer/McpServer.csproj');
const inspector = await builder.addMcpInspector('inspector');await inspector.withInspectedMcpServer(mcpServer);
await builder.build().run();var builder = DistributedApplication.CreateBuilder(args);
var mcpServer = builder.AddProject<Projects.McpServer>("mcp-server");var inspector = builder.AddMcpInspector("inspector") .WithMcpServer(mcpServer);
// After adding all resources, run the app...builder.Build().Run();The server project must expose an HTTP endpoint. The integration uses the https endpoint when available, otherwise it selects http, then the first endpoint on the server resource. WithMcpServer defaults to Streamable HTTP and the /mcp path.