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
67
68
69
70
//! Model Context Protocol (MCP) server for aprender.
//!
//! Exposes the `apr` CLI as MCP tools for Claude Code, Cursor, Cline, and
//! other MCP clients over JSON-RPC 2.0 stdio transport.
//!
//! Spec: `docs/specifications/apr-mcp-server-spec.md`.
//! Protocol: MCP v2024-11-05 (<https://spec.modelcontextprotocol.io>).
//!
//! # Example
//!
//! ```no_run
//! # #[cfg(feature = "native")]
//! # fn main() -> anyhow::Result<()> {
//! let mut server = aprender_mcp::AprMcpServer::new();
//! server.run_stdio()?;
//! # Ok(())
//! # }
//! # #[cfg(not(feature = "native"))]
//! # fn main() {}
//! ```
//!
//! # Scope (M1–M3 shipped)
//!
//! - M1: `initialize` + `tools/list` + the `apr.version` stub.
//! - M2: 7 subprocess wrappers (`apr.validate`, `apr.tensors`, `apr.bench`,
//! `apr.qa`, `apr.trace`, `apr.run`, `apr.serve`) + FALSIFY-MCP-005/-007
//! dispatcher gates + Draft-7 schema meta-validation.
//! - M3: `apr.finetune` (8th Phase-1 tool), `notifications/cancelled` →
//! SIGTERM→SIGKILL for `apr.run`, `build.rs` codegen from
//! `contracts/apr-mcp-tool-schemas-v1.yaml` for both `inputSchema`
//! (`schemas::APR_<TOOL>_SCHEMA`) and tool-level `description`
//! (`schemas::APR_<TOOL>_DESCRIPTION`, PMAT-514), and opt-in per-line
//! `notifications/progress` for `apr.finetune` via
//! `params._meta.progressToken` (FALSIFY-MCP-PROGRESS-001).
//!
//! M4 (in progress) promotes FALSIFY-MCP-003/-004 from surface tests to
//! real-model end-to-end; M5 ports the dispatcher to `pmcp = "2.3"` and
//! extends cancellation to `apr.serve`.
/// FALSIFY-MCP-008: per-tool JSON Schema + description constants codegen'd
/// at build time from `contracts/apr-mcp-tool-schemas-v1.yaml` by `build.rs`.
///
/// For each tool, `build.rs` emits two constants:
/// * `APR_<TOOL>_SCHEMA: &str` — a JSON string whose parsed body is the
/// tool's MCP `inputSchema`. Consume via `serde_json::from_str`.
/// * `APR_<TOOL>_DESCRIPTION: &str` — the tool-level description.
/// Consume via `.to_string()`.
///
/// Tools MUST source both fields from this module — hand-coding either in
/// the tool's source file is caught by `tests/falsify_mcp_008.rs`
/// (PMAT-514, 2026-04-18).
pub use ;
pub use ;
/// MCP protocol version this server implements.
pub const PROTOCOL_VERSION: &str = "2024-11-05";
/// Server identity reported in `initialize` response.
pub const SERVER_NAME: &str = "aprender-mcp";