-
Notifications
You must be signed in to change notification settings - Fork 151
Add Bun support for MCP Inspector resource builder #1079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Introduces the WithBun extension method to allow configuring the MCP Inspector to use Bun (bunx) as the package manager. Updates argument handling logic, documentation, API surface, and adds corresponding unit tests to ensure correct command and argument setup for Bun.
|
@dotnet-policy-service agree |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for Bun as a package manager option for the MCP Inspector resource, complementing the existing npm, yarn, and pnpm support. The change introduces a WithBun() extension method that configures the inspector to use bunx for running the MCP Inspector package.
Key Changes
- Adds
WithBun()extension method to configure Bun/bunx as the package manager - Updates argument handling logic to support bunx command pattern (no additional flags needed beyond package name)
- Extends documentation with Bun usage examples
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/CommunityToolkit.Aspire.Hosting.McpInspector/McpInspectorResourceBuilderExtensions.cs | Implements WithBun() method and adds bunx case to argument handling logic |
| src/CommunityToolkit.Aspire.Hosting.McpInspector/README.md | Updates documentation to include Bun in supported package managers with usage example |
| src/CommunityToolkit.Aspire.Hosting.McpInspector/api/CommunityToolkit.Aspire.Hosting.McpInspector.cs | Adds new public API surface for WithBun, WithYarn, and WithPnpm methods |
| tests/CommunityToolkit.Aspire.Hosting.McpInspector.Tests/McpInspectorResourceBuilderExtensionsTests.cs | Adds comprehensive tests for WithBun functionality and refactors existing assertions for consistency |
| public static ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> WithBun(this ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> builder) { throw null; } | ||
|
|
||
| public static ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> WithMcpServer<TResource>(this ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> builder, ApplicationModel.IResourceBuilder<TResource> mcpServer, bool isDefault = true, McpTransportType transportType = McpTransportType.StreamableHttp, string path = "/mcp") | ||
| where TResource : ApplicationModel.IResourceWithEndpoints { throw null; } | ||
|
|
||
| public static ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> WithPnpm(this ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> builder) { throw null; } | ||
|
|
||
| public static ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> WithYarn(this ApplicationModel.IResourceBuilder<ApplicationModel.McpInspectorResource> builder) { throw null; } |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The API surface file should not be manually updated. According to the coding guidelines, files under /api/*.cs are generated and should not be edited manually. Please remove these changes and regenerate the API surface using the appropriate tooling.
| var appBuilder = DistributedApplication.CreateBuilder(); | ||
|
|
||
| // Act | ||
| var inspector = appBuilder.AddMcpInspector("inspector") |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method AddMcpInspector.
| var inspector = appBuilder.AddMcpInspector("inspector", options => | ||
| { | ||
| options.InspectorVersion = "0.15.0"; | ||
| }) |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method AddMcpInspector.
| var appModel = app.Services.GetRequiredService<DistributedApplicationModel>(); | ||
| var inspectorResource = Assert.Single(appModel.Resources.OfType<McpInspectorResource>()); | ||
|
|
||
| var args = await inspectorResource.GetArgumentValuesAsync(); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Call to obsolete method GetArgumentValuesAsync.
| var inspector = appBuilder.AddMcpInspector("inspector") | ||
| .WithBun(); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to inspector is useless, since its value is never read.
| var inspector = appBuilder.AddMcpInspector("inspector", options => | ||
| { | ||
| options.InspectorVersion = "0.15.0"; | ||
| }) | ||
| .WithBun(); |
Copilot
AI
Dec 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to inspector is useless, since its value is never read.
Changed McpInspectorResource constructor to accept a packageName parameter. Refactored test cases to use the new constructor signature and introduced a helper method GetArgsAsync to streamline argument extraction and assertions.
Eliminated the .WithNpm() method call from the AddMcpInspector extension method, simplifying the resource builder configuration.
Closes #1008 (follow on)
Introduces the WithBun extension method to allow configuring the MCP Inspector to use Bun (bunx) as the package manager. Updates argument handling logic, documentation, API surface, and adds corresponding unit tests to ensure correct command and argument setup for Bun. Effectively a +1 to the existing pnpm and yarn extensions.
PR Checklist
Other information