Skip to main content

codex/
mcp.rs

1//! Launch and interact with Codex MCP + app servers using stored runtime definitions.
2//!
3//! - Spawn `codex mcp-server`, call `codex/codex` or `codex/codex-reply`, and stream
4//!   `codex/event` notifications (task completion, approvals, cancellations, errors).
5//! - Start `codex app-server` threads/turns and surface item/task_complete notifications.
6//! - Manage `[mcp_servers]` and `[app_runtimes]` config entries, resolve them into launch-ready
7//!   runtimes, and expose read-only APIs (including pooled app runtimes) without mutating stored
8//!   config or thread metadata.
9//! - Requests may be cancelled via the JSON-RPC `$ /cancelRequest` flow.
10//!
11//! The MCP server exposes two tool entrypoints:
12//! - `codex/codex`: start a new Codex session with a prompt.
13//! - `codex/codex-reply`: continue an existing session by conversation ID.
14//!
15//! The app-server supports `thread/start`, `thread/resume`, `turn/start`, and `turn/interrupt`
16//! requests. Runtime and pool helpers keep resume hints/metadata intact while starting,
17//! reusing, and stopping app-server instances.
18
19mod protocol;
20pub use protocol::*;
21
22mod config;
23pub use config::*;
24
25mod runtime;
26pub use runtime::*;
27mod app;
28pub use app::*;
29mod jsonrpc;
30
31mod client;
32pub use client::*;
33
34#[cfg(all(test, unix))]
35mod test_support;
36#[cfg(all(test, unix))]
37mod tests_core;
38#[cfg(all(test, unix))]
39mod tests_runtime_app;