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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! MCP (Model Context Protocol) server for vipune.
//!
//! This module provides an MCP server over stdio that exposes vipune's memory
//! operations as tools. The module is a default feature — MCP is enabled by
//! default. Use `default-features = false` in your Cargo.toml for sync-only builds.
//!
//! # Architecture
//!
//! Two-layer pattern: async MCP wrappers → sync MemoryStore operations
//! - MCP layer (server.rs, tools.rs, params.rs): async #[tool] wrappers using rmcp
//! - Business layer: calls MemoryStore methods synchronously via Arc<Mutex<MemoryStore>>
//!
//! # Entry Point
//!
//! Use `run_mcp()` to start the server:
//! ```no_run
//! use vipune::config::Config;
//! use vipune::mcp::server::run_mcp;
//!
//! let config = Config::default();
//! run_mcp(config, "default").expect("Failed to start MCP server");
//! ```
/// Supersede-path tests for the MCP surface, split out of `tests.rs` for #271
/// so that file stays inside the per-file cap. The `feature = "mcp"` half of the
/// gate is load-bearing: the tool handler these tests drive does not exist in
/// the `--no-default-features` lane CI runs, and without it the file compiles to
/// zero tests while the orphan guard in `lib.rs` still counts it as wired.
/// The get/update MCP surfaces, split out of `tests.rs` for #271 so that file
/// stays inside the per-file cap. Same `feature = "mcp"` reasoning as
/// `supersede_tests` above.
/// Cross-surface error-rendering parity (issue #255 review). Kept beside the
/// mapping it exercises rather than in `errors.rs`: `main.rs` compiles its own
/// copy of `errors.rs`, so only here are the CLI's `Error` and the one
/// `From<Error> for rmcp::ErrorData` is implemented for the same nominal type.