Skip to content

feat: cora MCP auto-preset — zero-config code-intel attach - #86

Closed
ajianaz wants to merge 2 commits into
developfrom
feature/cora-mcp-autopreset
Closed

ajianaz wants to merge 2 commits into
developfrom
feature/cora-mcp-autopreset

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

What

When the cora binary is on PATH, tole attaches the local cora mcp server automatically: the full code-intel surface (brain search, callers, impact, affected tests, dead-code, review — 18 tools, registry names mcp_cora_*) registers with zero configuration. Includes the mcp feature becoming a CLI default and fixes for mcp-gated code that default-feature CI never compiled.

(Supersedes #80 — that PR's base branch was consumed by the #79 merge; same changes, rebased on develop.)

Why

The ecosystem goal is that sibling tools are usable out of the box. Today cora_search gives one search tool; cora's real surface (18 tools) required a manual --mcp-server flag and an opt-in cargo feature nobody passes. Probing-first registration already exists for uteke — this extends the same contract to cora's MCP server.

Changes

  • auto_mcp_specs probes cora and returns the cora=cora mcp preset; merge_mcp_specs (pure, unit-tested) merges explicit flags over presets — explicit same-name wins, malformed specs tolerated
  • --no-auto-mcp global flag to opt out per run
  • tole-cli default features now ["shell-tools", "mcp"] — embedders unaffected (tole-core defaults unchanged)
  • cora_search follows the startup-probing contract: missing binary → one-line warning; skipped when the cora MCP surface is attached (no duplicate search tools)
  • fix: mcp-gated code rotted behind the opt-in feature (move-error in register_server_tools, unused import, deprecated ClientInfo → ClientConfig, missing trait import in mcp_tests.rs) — all green now under --workspace since defaults compile the mcp path
  • Trust model untouched: MCP tools stay Risk::Write, approval gate every call
  • CHANGELOG (Unreleased) + README ecosystem section updated

Testing

  • cargo fmt / clippy -D warnings / test --workspace ✅ (mcp path now compiled by default CI: mcp_preset_tests 5 new, mcp_tests 4 fixed)
  • Live E2E (release binary): auto-preset registers 18 tools in ~23ms; --no-auto-mcp attaches nothing; explicit --mcp-server cora=... yields exactly one registration
  • cora review --staged: No issues found (exit 0)

The mcp feature was opt-in, so 'cargo check/clippy/test --workspace'
with default features never compiled the mcp paths — and they had
rotted: a moved-value borrow error in register_server_tools, an unused
PathBuf import, two deprecated rmcp::model::ClientInfo uses (now
ClientConfig per rmcp 3.3), and mcp_tests.rs calling risk() without the
Tool trait in scope. All fixed; no behavior change.
When the cora binary is on PATH, tole now attaches the local 'cora mcp'
server automatically: the full code-intel surface (brain search, callers,
impact, affected tests, dead-code, review — 18 tools, registry names
mcp_cora_*) registers with no manual flag, matching the ecosystem goal
that sibling tools are usable out of the box.

- tole-cli default features now include the mcp client
  (default = ["shell-tools", "mcp"]); embedder profiles are unaffected
  (tole-core defaults do not change).
- --no-auto-mcp global flag skips the presets per run; an explicit
  --mcp-server cora=... spec replaces the preset for that name (explicit
  wins over auto in the pure, unit-tested merge_mcp_specs).
- cora_search now follows the same startup-probing contract as the uteke
  tools: a missing cora binary degrades to a one-line warning instead of
  a phantom tool, and the native single-tool fallback is skipped when
  the cora MCP surface is attached (no duplicate search tools).
- Trust model untouched: MCP tools stay Risk::Write with the approval
  gate on every call; server metadata is never trusted.

Live E2E (release binary): auto-preset registers 18 tools in ~23ms;
--no-auto-mcp attaches nothing; explicit --mcp-server cora=... yields
exactly one registration (no duplicate).
.map_err(|e| anyhow::anyhow!("registering cora_search: {e}"))?;
{
#[cfg(feature = "mcp")]
let cora_mcp_attached = mcp_servers.iter().any(|c| c.name == "cora");
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (1)

  • crates/tole-cli/src/main.rs:328 — The fallback decision uses mcp_servers.iter().any(|c| c.name == "cora") — config presence, not registration success. If cora is on PATH but cora mcp fails (older cora without the subcommand, bad handshake, timeout), register_server_tools returns an empty name list and only prints "mcp[cora]: no tools registered", while the native cora_search was already skipped at line 331. The user silently loses all code-intel, a regression from the previous unconditional registration. MCP registration also happens after this check, so the outcome cannot influence the decision.

Review powered by cora-code · BYOK · MIT

@ajianaz ajianaz closed this Sep 18, 2026
@ajianaz
ajianaz deleted the feature/cora-mcp-autopreset branch September 18, 2026 01:52
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.

2 participants