fix: register ACP MCP tools as native callable tools via cpython proxy - #2002
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 41985b9. Configure here.
snimu
approved these changes
Sep 3, 2026
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.

No-Ticket: Evaluation-driven ACP compatibility fix; no Linear ticket was created.
Problem
When verifiers sends MCP tool servers through the ACP
session/new(mcp_servers=...)protocol, prime-agent stores them correctly but only adds prose guidance to the system prompt. The model must infer the correctawait mcp.call_tool(...)incantation — a reasoning step that often fails, causing fallback to website scraping via cpython.Solution
Register native
ToolDefinitionentries for each ACP MCP server. The model sees typed, callable tool entries in its tool list. Execution routes through the IPython kernel viaawait mcp.call_tool(...)— consistent with prime-agent's cpython-first architecture.Each server gets two tools:
mcp_list_tools_{server}— discover tool names and schemasmcp_call_{server}— call a tool with JSON argumentsChanges
tools/acp-mcp.tsmcp.call_tool()in the kerneltools/index.tscreateAcpMcpToolDefinitionsagent-session.ts_rebuildRuntimeForAcpMcpServersmcp-manager.tsgetAcpServers()public getterNote
Medium Risk
Changes tool registration and runtime rebuild paths for ACP sessions and hard-requires cpython when ACP MCP servers are present; incorrect cleanup or naming could break verifier/ACP integrations.
Overview
ACP-supplied MCP servers from ACP clients are no longer described only in the system prompt as generic
mcp.list_tools/mcp.call_toolusage. Each server now gets two native agent tools—mcp_list_tools_{server}andmcp_call_{server}—that run MCP through the session’s cpython kernel.acp-mcp.tsbuilds those definitions: validates server names, maps list/call to kernel Python, and surfaces kernel failures as tool errors.agent-sessionkeeps ACP tools in_acpMcpTools, merges them into the tool registry on replace/rebuild, strips them on release, and requires the built-in cpython provisioner; it also rejects name collisions with base, custom, or extension tools.McpManagersplits listing:getAcpServers()for session-scoped ACP configs vsgetEnabledPersistentGenericServers()for user-declared servers still documented in the generic MCP section of the prompt. Tests cover argument JSON encoding, release/reload behavior, and the cpython requirement.Reviewed by Cursor Bugbot for commit 2c006d4. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Register ACP MCP tools as native callable tools via cpython proxy
AgentSessionmanages the ACP tool lifecycle — building, validating, rebuilding on reload, and removing on release — and rejects ACP servers when the cpython kernel is missing or a generated tool name collides with an existing tool (agent-session.ts)McpManagernow separates ACP server configs from persistent user-declared generic servers viagetAcpServersandgetEnabledPersistentGenericServers, so the system prompt no longer lists ACP servers as generic MCP servers (mcp-manager.ts)getEnabledGenericServersis renamed togetEnabledPersistentGenericServersand no longer returns ACP servers; callers must usegetAcpServersinsteadMacroscope summarized 2c006d4.