Skip to main content

Module server

Module server 

Source
Expand description

The in-process MCP server.

Holds a registry of Tool implementations and dispatches JSON-RPC requests to them. Transport is OUT of scope here - this type is a pure request/response router. The mcp::orchestration module wires dispatch calls to the mcp_message control-request arm of Client::handle_control.

Re-exportsΒ§

use std::collections::BTreeMap; πŸ”’
use std::sync::Arc; πŸ”’
use tracing::debug; πŸ”’
use tracing::warn; πŸ”’
use crate::mcp::protocol::JsonRpcRequest; πŸ”’
use crate::mcp::protocol::JsonRpcResponse; πŸ”’
use crate::mcp::protocol::JsonRpcResult; πŸ”’
use crate::mcp::protocol::LATEST_PROTOCOL_VERSION; πŸ”’
use crate::mcp::protocol::McpError; πŸ”’
use crate::mcp::protocol::SUPPORTED_PROTOCOL_VERSIONS; πŸ”’
use crate::mcp::protocol::ServerInfo; πŸ”’
use crate::mcp::protocol::ToolDescription; πŸ”’
use crate::mcp::tool::Tool; πŸ”’
use crate::mcp::tool::ToolInput; πŸ”’
use crate::mcp::tool::ToolOutput; πŸ”’

StructsΒ§

McpServer
A fully-constructed MCP server. Clone is cheap (just bumps Arcs).
McpServerBuilder
Builder for McpServer.

EnumsΒ§

Negotiated πŸ”’
What the client’s requested version resolved to. Kept distinct from the answered string because an unsupported version and a missing one are different events: protocolVersion is required, so the latter is a broken client rather than a negotiation outcome.

FunctionsΒ§

classify_protocol_version πŸ”’
negotiate_protocol_version πŸ”’
Echo the client’s requested protocol version when we speak it, else answer with our latest - the spec’s SHOULD for an unsupported request.