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
//! MCP (Model Context Protocol) for Myko.
//!
//! The server hosts MCP at `/myko/mcp` over three content-negotiated
//! transports (HTTP POST, WebSocket, SSE) — see [`http`] and [`ws`].
//! [`dispatch`] is the transport-agnostic JSON-RPC core, [`exec`] is the
//! tool executor abstraction (in-process or remote client), and [`filter`]
//! parses per-client filters from request headers (or env vars on stdio).
//!
//! Every type decorated with `#[myko_query]`, `#[myko_view]`,
//! `#[myko_report]`, or `#[myko_command]` is auto-discovered via
//! `inventory` and exposed as an MCP tool with prefix `query:`, `view:`,
//! `report:`, or `command:`. The tool's input schema also surfaces as a
//! resource at `myko://schema/<kind>/<id>`.
//!
//! ## Client filters
//!
//! Two layers (see [`filter::ClientFilters`]):
//!
//! - **Visibility** — name allow/deny via
//! `X-Myko-Tool-Visibility-Allow` / `X-Myko-Tool-Visibility-Deny`
//! headers (or `MYKO_MCP_TOOL_VISIBILITY_{ALLOW,DENY}` env vars on
//! stdio). Patterns are globs: `*`, `prefix*`, `*suffix`, exact.
//! Denial → MCP **Protocol Error** (`-32602`, "Unknown tool: …").
//!
//! - **Callability** — per-tool / per-arg JSON value lists via
//! `X-Myko-Tool-Callable-Allow` / `X-Myko-Tool-Callable-Deny`
//! (or the matching `MYKO_MCP_TOOL_CALLABLE_*` env vars). Denial →
//! MCP **Tool Execution Error** (`isError: true` content carrying a
//! short reason).
//!
//! Both layers compose AND; deny wins inside each layer.
//!
//! ## Protocol
//!
//! Implements MCP 2024-11-05 JSON-RPC (compatible with the 2025-06-18
//! error-handling conventions).
//!
//! ## Legacy stdio
//!
//! [`McpServer::run_stdio`] is a transitional stdio transport that wraps a
//! `MykoClient` and connects out over WebSocket. It will be removed once
//! all consumers have migrated to the in-server `/myko/mcp` endpoint.
pub use McpServer;
pub use *;