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
71
72
73
74
75
76
//! MCP (Model Context Protocol) server module for Myko.
//!
//! This module provides an MCP server that automatically exposes:
//! - **Resources**: Queries and reports as readable resources
//! - **Tools**: Commands as executable tools
//!
//! All registrations are discovered automatically via the inventory system,
//! so any type decorated with `#[myko_query]`, `#[myko_report]`, or `#[myko_command]`
//! will be available through the MCP interface.
//!
//! ## Usage
//!
//! For Rship, use the `rship-mcp` binary which includes all entity registrations:
//!
//! ```bash
//! cargo run -p rship-mcp
//! ```
//!
//! Or use programmatically in your own crate:
//!
//! ```rust,ignore
//! // Link your entities crate to register them
//! my_entities::link();
//!
//! // Start the MCP server
//! let server = myko_server::mcp::McpServer::new();
//! server.run_stdio()?;
//! ```
//!
//! ## Restricting Exposed Tools
//!
//! Install a [`ToolFilter`] to expose only a subset of registered tools.
//! Filtered tools respond like unknown ones.
//!
//! ```rust,ignore
//! let server = myko_server::mcp::McpServer::new()
//! .with_allowed_tool_names(["connection_status", "query:GetAllFoos"]);
//! server.run_stdio()?;
//! ```
//!
//! ## MCP Client Configuration
//!
//! Add to Claude Desktop or other MCP clients:
//!
//! ```json
//! {
//! "mcpServers": {
//! "rship": {
//! "command": "cargo",
//! "args": ["run", "-p", "rship-mcp"],
//! "cwd": "/path/to/rship"
//! }
//! }
//! }
//! ```
//!
//! ## Protocol
//!
//! The server implements the MCP protocol (2024-11-05) over stdio using JSON-RPC.
//!
//! ### Resources
//!
//! - `myko://schema/query/{query_id}` - JSON schema for a query
//! - `myko://schema/report/{report_id}` - JSON schema for a report
//! - `myko://schema/command/{command_id}` - JSON schema for a command
//!
//! ### Tools
//!
//! Each registered command becomes an MCP tool with the command's JSON schema
//! as the input schema.
pub use ;
pub use *;