car-mcp 0.15.2

MCP (Model Context Protocol) server library — transport-agnostic dispatch for exposing CAR capabilities. Used by car-mcp-server (stdio binary) and car-server (HTTP-streamable daemon endpoint).
Documentation
//! MCP (Model Context Protocol) server library — transport-agnostic
//! dispatch for exposing CAR capabilities to MCP-aware clients.
//!
//! Two transports use this crate today:
//!
//! - **stdio** — `car-mcp-server` binary, one client per process.
//!   Suitable for Claude Desktop / Cursor / Claude Code's
//!   `--mcp-config` and any other client that follows the MCP spec's
//!   stdio framing. See [`transport::stdio_loop`].
//! - **HTTP-streamable** — `car-server` daemon endpoint, many
//!   concurrent clients sharing the same `Runtime` / policy chain /
//!   eventlog. Implemented in `car-server-core` against the same
//!   [`Server::handle`] entry point. (Phase 2 stage 4b — pending.)
//!
//! Both share the same `Server::handle(Request) -> Option<Response>`
//! pure function, so transports stay separable from protocol logic.
//!
//! ## Why a library crate
//!
//! Originally this lived in `car-mcp-server`'s `main.rs` as a
//! self-contained binary. v0.8 + the external-agent work made it
//! clear MCP needs to be a first-class daemon surface so every
//! external client (Claude Code, Codex, Gemini, custom GPTs) gets
//! CAR's tools through the same governance layer. Extracting the
//! dispatch logic into a library lets the daemon embed it without
//! shelling out to a subprocess. See
//! `docs/proposals/external-agent-detection.md` (Phase 2 stage 4b).

mod schemas;
mod server;
pub mod transport;

pub use schemas::{cached_prompt_schemas, cached_tool_schemas};
pub use server::{Request, Response, Server, ToolError};

/// MCP protocol version this server speaks.
pub const PROTOCOL_VERSION: &str = "2024-11-05";

/// Server identifier reported in `initialize` responses.
pub const SERVER_NAME: &str = "car-mcp";

/// JSON-RPC error codes per the spec.
pub mod error_codes {
    pub const PARSE: i32 = -32700;
    pub const INVALID_REQUEST: i32 = -32600;
    pub const METHOD_NOT_FOUND: i32 = -32601;
    pub const INVALID_PARAMS: i32 = -32602;
    pub const INTERNAL: i32 = -32603;
}