Skip to content

Conversation

@krubenok
Copy link

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

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

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.
Copilot AI review requested due to automatic review settings December 30, 2025 06:12
@krubenok
Copy link
Author

@dotnet-policy-service agree

Copy link
Contributor

Copilot AI left a 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

Comment on lines +33 to +40
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; }
Copy link

Copilot AI Dec 30, 2025

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.

Copilot generated this review using guidance from repository custom instructions.
var appBuilder = DistributedApplication.CreateBuilder();

// Act
var inspector = appBuilder.AddMcpInspector("inspector")
Copy link

Copilot AI Dec 30, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +626 to +629
var inspector = appBuilder.AddMcpInspector("inspector", options =>
{
options.InspectorVersion = "0.15.0";
})
Copy link

Copilot AI Dec 30, 2025

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.

Copilot uses AI. Check for mistakes.
var appModel = app.Services.GetRequiredService<DistributedApplicationModel>();
var inspectorResource = Assert.Single(appModel.Resources.OfType<McpInspectorResource>());

var args = await inspectorResource.GetArgumentValuesAsync();
Copy link

Copilot AI Dec 30, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 557 to 558
var inspector = appBuilder.AddMcpInspector("inspector")
.WithBun();
Copy link

Copilot AI Dec 30, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines +626 to +630
var inspector = appBuilder.AddMcpInspector("inspector", options =>
{
options.InspectorVersion = "0.15.0";
})
.WithBun();
Copy link

Copilot AI Dec 30, 2025

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.

Copilot uses AI. Check for mistakes.
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support alternative package managers in MCP Inspector integration

1 participant