feat: add generic kernel-owned MCP runtime - #1495
Open
sethkarten wants to merge 19 commits into
Open
Conversation
…lias-fix # Conflicts: # packages/coding-agent/CHANGELOG.md
# Conflicts: # packages/coding-agent/CHANGELOG.md
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 2929f6d. Configure here.
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
mcp.list_tools(server)andmcp.call_tool(server, tool, arguments)API for user-configured MCP serversTests
cd prime-agent-runtime && uv run --with pytest python -m pytest -q test(74 passed; includes real keyless stdio and Streamable HTTP fixtures)cd packages/coding-agent && npx tsx ../../node_modules/vitest/dist/cli.js --run test/mcp-manager.test.ts test/settings-manager.test.ts test/ipython-bootstrap.test.ts test/kernel-bootstrap.test.ts(77 passed)cd packages/coding-agent && unset RLM_DEPTH RLM_MAX_DEPTH && npx tsx ../../node_modules/vitest/dist/cli.js --run test/agent-session-recursion.test.ts(96 passed)cd packages/coding-agent && npx tsx ../../node_modules/vitest/dist/cli.js --run test/kernel-startup.test.ts test/kernel-abort.test.ts(6 passed)npm run checkgit diff --checkNote
High Risk
Touches kernel bootstrap, subprocess stdio MCP, credential handling, and global settings persistence; outdated kernels without the new runtime will fail readiness checks.
Overview
Adds a kernel-owned generic MCP client (
rlm.mcp) withlist_tools,call_tool,reload, andclose, supporting Streamable HTTP and stdio transports, per-server connection reuse, startup/call timeouts, tool allow/deny filters, and redacted stdio startup diagnostics.CLI and TUI can persist user MCP servers via
mcp add|list|get|remove(and/mcpequivalents). Entries live only in global~/.prime/agent/settings.json; project MCP configs are no longer used for execution. Stdio secrets are env-var references only; list/get output shows name and transport, not commands or tokens.The system prompt advertises enabled generic servers and
await mcp.list_tools/await mcp.call_toolwhen IPython is active. Kernel bootstrap now requires callablemcp.list_toolsandmcp.call_tool. Catalog names (e.g. Linear/Notion) cannot be overridden for the generic API; authored wrappers keep their login flow.Settings writes use atomic temp-file rename with mode
0600.Reviewed by Cursor Bugbot for commit ce6c27b. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Add kernel-owned generic MCP runtime with HTTP and stdio transport support
prime-agent mcp add/list/get/removeCLI subcommands backed by mcp-command.ts and routed through public-command.ts;/mcpin the TUI gains the same subcommands.mcp.list_toolsandmcp.call_toolas pre-imported Python APIs in the kernel bootstrap; the system prompt advertises enabled generic MCP servers with usage examples when IPython is active.SettingsManager.getGlobalMcpServers/setGlobalMcpServer/removeGlobalMcpServerfor managing MCP server configs scoped to global (user-level) settings only, replacing the previous merged-settings approach.McpStartupError.McpServerConfigshape changed (env values are now{"env": "NAME"}tag objects for stdio;getMcpServers()replaced bygetGlobalMcpServers()), which may break existing integrations relying on the prior merged config behavior.Macroscope summarized ce6c27b.