Skip to content

feat: tole mcp — serve tole's tools as an MCP server (D1, issue #94) - #98

Merged
ajianaz merged 3 commits into
developfrom
feat/tole-mcp-server
Sep 18, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/tole-mcp-server

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

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 (mcp feature): RegistryServer implements rmcp ServerHandler over an ordinary ToolRegistry — tools/list mirrors specs() schemas, tools/call routes through execute under the registry's approval decisions.
  • Approval policy in server context: ReadOnly always callable; Write requires --allow patterns (denied calls settle as tool errors with an actionable message); Destructive structurally absent (non-interactive registration is refused — invariant 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 (5 scenarios).
  • README/CHANGELOG/epics docs (also fixes escaped backticks the Track D doc shipped with).

Testing

  • fmt / clippy -D warnings / test --workspace ✅ (202 tests, +5 MCP server e2e)
  • Live E2E: initialize → tools/list (11 tools, Destructive absent) → read_file round-trip ✓ → write without --allow denied with actionable message ✓ → write with --allow executes ✓
  • cora review --staged: No issues found

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).
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Comment thread crates/tole-core/src/mcp_server.rs Outdated
.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.
@ajianaz
ajianaz merged commit e98b98f into develop Sep 18, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/tole-mcp-server branch September 18, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: tole mcp — expose tole's tools as an MCP server (Phase D1)

2 participants