-
-
Notifications
You must be signed in to change notification settings - Fork 1
MCP Router Phase 2: Scheduler Integration & API Endpoint #91
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
Conversation
- Add MCP router to scheduler for task dispatch routing - Log selected MCPs to PDR for each task - Add POST /mcp/route API endpoint - Initialize MCP router in daemon startup - Wire router to scheduler and control plane Refs: #89
PR Compliance Guide 🔍(Compliance updated until commit 7c26930)Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label Previous compliance checksCompliance check up to commit 117b901
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Latest suggestions up to 7c26930
Previous suggestions✅ Suggestions up to commit 117b901
|
||||||||||||||||||||||||||||||||||||||
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
Co-authored-by: qodo-code-review[bot] <151058649+qodo-code-review[bot]@users.noreply.github.com>
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.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This is the final PR Bugbot will review for you during this billing cycle
Your free Bugbot reviews will reset on February 18
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| SelectedMCPs: mcps, | ||
| MatchedRules: result.MatchedRules, | ||
| TotalTools: result.TotalTools, | ||
| ToolBudget: 80, // Default budget |
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.
API returns hardcoded tool budget ignoring configuration
Low Severity
The ToolBudget field in the /mcp/route response is hardcoded to 80, but the actual budget used by the router comes from config.MaxToolsPerTask which users can customize via their mcp.yaml configuration. If a user configures a different budget (e.g., 50 or 100), the API response still shows 80, providing misleading metadata about the actual tool budget being enforced.
User description
🔗 MCP Router Phase 2: Integration
Refs #89
Summary
Integrates the MCP Tool Router (from Phase 1) into the scheduler and control plane, enabling automatic MCP selection for dispatched tasks and exposing a REST API for routing decisions.
Changes
internal/scheduler/scheduler.gomcpRouterfield,SetMCPRouter(), route tasks inpollAndDispatch(), log to PDRinternal/controlplane/server.goMCPRouterinterface,SetMCPRouter(),POST /mcp/routeendpointcmd/neona/daemon.goNew API Endpoint
Response:
{ "selected_mcps": [ {"name": "github", "tool_count": 30}, {"name": "git", "tool_count": 15}, {"name": "filesystem", "tool_count": 10} ], "matched_rules": ["github,pr"], "total_tools": 55, "tool_budget": 80 }Testing
CGO_ENABLED=0PR Type
Enhancement
Description
Integrates MCP router into scheduler for automatic tool selection
Adds POST /mcp/route REST API endpoint for routing decisions
Logs selected MCPs to PDR for task dispatch auditing
Initializes MCP router on daemon startup with configuration
Diagram Walkthrough
File Walkthrough
daemon.go
Initialize and wire MCP router on startupcmd/neona/daemon.go
server.go
Add MCP routing REST API endpointinternal/controlplane/server.go
MCPs and tool counts
scheduler.go
Integrate MCP routing into task dispatchinternal/scheduler/scheduler.go
Note
Integrates MCP tool routing across the runtime and exposes a minimal API for routing decisions.
schedulerandserverMCPRouterinterface,SetMCPRouter, andPOST /mcp/routehandler that returnsselected_mcps,matched_rules,total_tools, andtool_budgetmcpRouterfield andSetMCPRouter; route tasks during dispatch and record selections to PDRWritten by Cursor Bugbot for commit 48d970a. This will update automatically on new commits. Configure here.