Skip to main content

lattice_ai/mcp/
mod.rs

1//! `mcp` — lattice as the IDE side of the Claude Code agent protocol.
2//!
3//! The MCP adapter half of `lattice-ai` (AG‑4): an external `claude` CLI
4//! connects over a loopback WebSocket and drives the editor (reading
5//! selection / open buffers / diagnostics, opening files, proposing edits
6//! as interactive diffs). This is the lattice analog of
7//! `claude-code-ide.el` and the VS Code / JetBrains integrations — it
8//! speaks the same WebSocket + MCP contract. Gated behind
9//! `feature = "mcp"`.
10//!
11//! Architecturally this is a **network peer**, like `lattice-lsp` (an LSP
12//! *client*): a loopback JSON-RPC connection to an external process. It
13//! runs no agent in-process and adds no scripting surface, so it does not
14//! touch the "WASM is the only extension substrate" rule. It shares the
15//! protocol-neutral editor-capability port (`lattice-agent`) with the ACP
16//! adapter in `super::acp`.
17//!
18//! See `docs/dev/architecture/ide-protocol.md` (design) +
19//! `docs/dev/architecture/agent-integration.md` (the AG‑4 fold).
20
21pub mod auth;
22pub mod commands;
23// I4 (openDiff): the blocking interactive-diff tool. Sends a
24// `ProgrammaticDiffRequest` on the host-drained bus and awaits the user's
25// verdict (no timeout) to shape the FILE_SAVED / DIFF_REJECTED reply.
26pub mod diff;
27pub mod dispatch;
28pub mod error;
29// BC.3b: the crate-owned `install(boot)` entry point — one Phase-B line in
30// `editor_boot`, all wiring here.
31pub mod install;
32pub mod lockfile;
33pub mod modes;
34// I6: server-initiated notifications (selection_changed / didChangeActiveEditor)
35// — a task coalesces SelectionsChanged + broadcasts frames to connected agents.
36pub mod notifications;
37pub mod protocol;
38pub mod reads;
39pub mod server;
40// I7: the `claude-code` modeline status segment (running/port/conns) shown on
41// the agent terminal's modeline. Mode-owned (registered by claude-code-mode).
42pub mod status;
43pub mod transport;
44pub mod writes;
45
46pub use commands::register_claude_code_ex_commands;
47pub use error::{ClaudeCodeError, Result};
48pub use install::install;
49pub use modes::{ClaudeCodeMode, register_claude_code_modes};
50pub use server::{ClaudeCodeServerHandle, ServerConfig, ServerState, spawn};