1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//! MCP client — connect to external MCP servers (#662).
//!
//! Koda can act as an MCP **client**, discovering and invoking tools exposed
//! by third-party MCP servers (Playwright, databases, Slack, etc.).
//!
//! ## Architecture
//!
//! ```text
//! ┌─────────────────┐ stdio/http ┌──────────────────┐
//! │ McpManager │ ◄────────────────► │ MCP Server │
//! │ (owns clients) │ │ (e.g. Playwright)│
//! └────────┬────────┘ └──────────────────┘
//! │
//! ToolRegistry
//! (server__tool naming)
//! ```
//!
//! ## Config storage
//!
//! MCP server configs are stored globally in the SQLite `kv_store` table
//! under the `mcp:` key prefix. Managed via `/mcp add`, `/mcp add-http`,
//! `/mcp remove`, and `/mcp list` slash commands.
//!
//! Supports both stdio (child process) and HTTP (Streamable HTTP) transports.
//!
//! ## Design decisions (#662)
//!
//! - **Global scope (user-level)** — not per-project. Accepted trade-off.
//! - **Tool annotations → ToolEffect** — `destructiveHint`/`readOnlyHint`
//! map directly to the TrustMode approval matrix.
//! - **Resources** — not yet implemented.
/// MCP server configuration types and database persistence.
/// Single MCP server client — wraps rmcp connection lifecycle.
/// Multi-server connection manager — parallel startup, tool discovery.
/// Bridge MCP tools into Koda's ToolRegistry (naming, classification).
pub use McpServerConfig;
pub use McpManager;
pub use ;