refactor: unify virtual and non-virtual MCPs under the same route#2361
Open
refactor: unify virtual and non-virtual MCPs under the same route#2361
Conversation
Contributor
🧪 BenchmarkShould we run the Virtual MCP strategy benchmark for this PR? React with 👍 to run the benchmark.
Benchmark will run on the next push after you react. |
Contributor
Release OptionsShould a new version be published when this PR is merged? React with an emoji to vote on the release type:
Current version: Deployment
|
Contributor
There was a problem hiding this comment.
1 issue found across 11 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="apps/docs/client/src/content/en/mcp-mesh/mcp-gateways.mdx">
<violation number="1" location="apps/docs/client/src/content/en/mcp-mesh/mcp-gateways.mdx:23">
P3: Grammar mismatch: "Agents are... Supports..." should be "They support..." or "This endpoint supports...". Also, the term "tool selection strategy" is slightly inconsistent with the section title "Tool exposure strategies".</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR unifies virtual MCPs (agents) and regular connections under the same route pattern
/mcp/:connectionId. Previously, virtual MCPs were accessed via separate endpoints (/mcp/gateway/:virtualMcpIdor/mcp/virtual-mcp/:virtualMcpId), creating an inconsistent API surface.Changes
Core Changes
POST /mcp/:connectionIdstrategyparameter tocreateMCPProxyfunctions to support tool selection strategies (passthrough, smart_tool_selection, code_execution) via?mode=query parametercreateClientto accept an options object withsuperUserandstrategyparameters instead of separate boolean flagsFiles Modified
apps/mesh/src/api/routes/proxy.ts: Updated to handle virtual MCPs via the same route, added strategy parsing from query paramsapps/mesh/src/mcp-clients/index.ts: Refactored to accept options object and pass strategy to virtual client creationapps/mesh/src/mcp-clients/virtual-mcp/index.ts: Added strategy parameter supportapps/mesh/src/core/context-factory.ts: UpdatedcreateMCPProxysignature to accept strategyapps/mesh/src/core/mesh-context.ts: Updated type definitions for strategy parameterBenefits
/mcp/gatewayand/mcp/virtual-mcpendpoints remain available for backward compatibilityTesting
/mcp/:connectionIdroute/mcp/:connectionIdrouteMigration Notes
Clients using the old virtual MCP endpoints (
/mcp/gateway/:virtualMcpIdor/mcp/virtual-mcp/:virtualMcpId) should migrate to/mcp/:connectionIdwhereconnectionIdis the virtual MCP's connection ID. The old endpoints remain available for backward compatibility but may be deprecated in a future release.Made with Cursor
Summary by cubic
Unifies virtual MCPs (Agents) and regular connections under POST /mcp/:connectionId for a consistent API. Adds a tool selection strategy via ?mode= and updates docs/UI to use the new pattern.
New Features
Migration
Written for commit 4a55bd9. Summary will update on new commits.