Conversation
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 14283Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 14283" |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds in-process unit test coverage for the CLI’s MCP server behavior by introducing test-friendly abstractions and DI overrides, enabling MCP server/client communication without spinning up external RPC infrastructure.
Changes:
- Introduces
IAppHostAuxiliaryBackchanneland updates backchannel monitor/command plumbing to depend on the interface. - Adds DI-provided MCP server transport (
ITransport) so tests can inject an in-memory transport while production uses stdio. - Adds new MCP-focused test infrastructure and an in-process
AgentMcpCommandtest suite.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Aspire.Cli.Tests/Utils/CliTestHelper.cs | Adds DI factories for MCP transport and docs indexing to support test overrides. |
| tests/Aspire.Cli.Tests/TestServices/TestAuxiliaryBackchannelMonitor.cs | Updates test monitor to store/return IAppHostAuxiliaryBackchannel. |
| tests/Aspire.Cli.Tests/TestServices/TestAppHostAuxiliaryBackchannel.cs | New test double implementing IAppHostAuxiliaryBackchannel. |
| tests/Aspire.Cli.Tests/Mcp/TestMcpServerTransportFactory.cs | New in-memory pipe transport helper for MCP server/client tests. |
| tests/Aspire.Cli.Tests/Mcp/TestDocsIndexService.cs | New docs index test double to avoid network calls. |
| tests/Aspire.Cli.Tests/Mcp/MockPackagingService.cs | Updates mock monitor signatures to use IAppHostAuxiliaryBackchannel. |
| tests/Aspire.Cli.Tests/Commands/AgentMcpCommandTests.cs | New in-process tests for listing tools and calling select MCP tools via an injected transport. |
| src/Aspire.Cli/Program.cs | Registers MCP ITransport (stdio) and adds MCP subcommands to DI. |
| src/Aspire.Cli/Mcp/KnownMcpTools.cs | Minor cleanup of pattern matching for tool classification. |
| src/Aspire.Cli/Commands/RunCommand.cs | Switches detached run backchannel handling to IAppHostAuxiliaryBackchannel. |
| src/Aspire.Cli/Commands/ResourcesCommand.cs | Uses IAppHostAuxiliaryBackchannel for snapshot/watch operations. |
| src/Aspire.Cli/Commands/PsCommand.cs | Uses IAppHostAuxiliaryBackchannel for listing AppHosts. |
| src/Aspire.Cli/Commands/McpStartCommand.cs | Delegates via injected AgentMcpCommand instead of manual construction. |
| src/Aspire.Cli/Commands/McpCommand.cs | Uses injected McpStartCommand/McpInitCommand instead of manual construction. |
| src/Aspire.Cli/Commands/LogsCommand.cs | Uses IAppHostAuxiliaryBackchannel for log streaming operations. |
| src/Aspire.Cli/Commands/AgentMcpCommand.cs | Accepts injected ITransport, exposes KnownTools for tests, and uses injected transport for server creation. |
| src/Aspire.Cli/Backchannel/IAuxiliaryBackchannelMonitor.cs | Updates monitor contract to return IAppHostAuxiliaryBackchannel. |
| src/Aspire.Cli/Backchannel/IAppHostAuxiliaryBackchannel.cs | New interface enabling test doubles for AppHost backchannel behavior. |
| src/Aspire.Cli/Backchannel/AuxiliaryBackchannelMonitor.cs | Returns IAppHostAuxiliaryBackchannel while continuing to manage concrete connections internally. |
| src/Aspire.Cli/Backchannel/AppHostConnectionResolver.cs | Returns interface-typed connection results. |
| src/Aspire.Cli/Backchannel/AppHostConnectionHelper.cs | Returns selected connection as IAppHostAuxiliaryBackchannel. |
| src/Aspire.Cli/Backchannel/AppHostAuxiliaryBackchannel.cs | Implements IAppHostAuxiliaryBackchannel. |
Contributor
🎬 CLI E2E Test RecordingsThe following terminal recordings are available for commit
📹 Recordings uploaded automatically from CI run #21593317652 |
4662a4d to
29d2c73
Compare
davidfowl
reviewed
Feb 2, 2026
| }, _cts.Token); | ||
|
|
||
| // Wait a brief moment for the server to start | ||
| await Task.Delay(100, _cts.Token); |
davidfowl
approved these changes
Feb 2, 2026
Contributor
|
We should probably add an e2e as well with a real mcp client. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds unit tests for important CLI MCP functionality:
Notably, this PR adds
IAppHostAuxiliaryBackchannel. Without this abstraction we'd have to spin up an RPC server for the implementation to call.Checklist
<remarks />and<code />elements on your triple slash comments?doc-ideatemplatebreaking-changetemplatediagnostictemplate