Repository navigation
feat: tole mcp — serve tole's tools as an MCP server (D1, issue #94) - #98
Merged
Merged
Conversation
tole as an MCP server over stdio (rmcp ServerHandler over the ordinary ToolRegistry): the registry's hardened tools — jailed file ops, argv-validated git, detached jobs, memory loop, cora/uteke integrations — become callable by any MCP client, instead of being locked inside the CLI process. - Approval policy in server context: no stdin human (stdin IS the protocol), so the interactive approver is replaced by explicit pre-authorization — ReadOnly always callable; Write requires --allow patterns (denied calls settle as tool errors with an actionable message); Destructive structurally absent (registration behind a non-interactive approver is refused — the three-layer invariant holds unchanged). - tole mcp subcommand: server-mode registry (same hardened tools, no MCP-client nesting, no interactive prompts) + serve_stdio. - Tests: in-process duplex end-to-end over the real rmcp server+client pair — listing (schemas mirror spec()), write denial without --allow, write execution with --allow, unknown tool, Destructive absence. - Live E2E: initialize/tools/list (11 tools, Destructive absent), read_file round-trip, write without --allow denied with an actionable message, write with --allow executes. - Docs: README ecosystem bullet, CHANGELOG Added, epics D1 marked done (+ fixed escaped backticks the Track D doc shipped with).
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
| .ok_or_else(|| format!("unknown tool: {name}"))?; | ||
| match tool.risk() { | ||
| Risk::ReadOnly => {} | ||
| Risk::Write | Risk::Destructive => match self.registry.decide(name, &args) { |
CodeCora scan finding on the MCP server: execute_checked grouped Destructive with Write behind the approver decision — an embedder passing a permissive registry (interactive+allow) got a Destructive tool hidden from tools/list yet callable via tools/call, contradicting the module's documented invariant. Now the guard is structural: Destructive refuses outright in execute_checked before any approver is consulted, with a regression test that registers a Destructive tool behind a permissive interactive approver and asserts it is both hidden and uncallable.
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.
What
tole mcp: tole presents itself as an MCP server over stdio — the registry's hardened tools (jailed file ops, argv-validated git, detached jobs, memory loop, cora/uteke integrations) become callable by any MCP client.Closes #94 (Phase D1 of the integration-surfaces plan).
Why
The ecosystem mesh was one-directional: cora serves 18 MCP tools, uteke serves uteke-mcp — tole only consumed. Any agent wanting tole's capabilities had no way in.
Changes
tole-core/src/mcp_server.rs(mcpfeature):RegistryServerimplements rmcpServerHandlerover an ordinaryToolRegistry—tools/listmirrorsspecs()schemas,tools/callroutes throughexecuteunder the registry's approval decisions.--allowpatterns (denied calls settle as tool errors with an actionable message); Destructive structurally absent (non-interactive registration is refused — invariant unchanged).tole mcpsubcommand: server-mode registry (same hardened tools; no MCP-client nesting; no interactive prompts) +serve_stdio.Testing