Expand description
Launch and interact with Codex MCP + app servers using stored runtime definitions.
- Spawn
codex mcp-server, callcodex/codexorcodex/codex-reply, and streamcodex/eventnotifications (task completion, approvals, cancellations, errors). - Start
codex app-serverthreads/turns and surface item/task_complete notifications. - Manage
[mcp_servers]and[app_runtimes]config entries, resolve them into launch-ready runtimes, and expose read-only APIs (including pooled app runtimes) without mutating stored config or thread metadata. - Requests may be cancelled via the JSON-RPC
$ /cancelRequestflow.
The MCP server exposes two tool entrypoints:
codex/codex: start a new Codex session with a prompt.codex/codex-reply: continue an existing session by conversation ID.
The app-server supports thread/start, thread/resume, turn/start, and turn/interrupt
requests. Runtime and pool helpers keep resume hints/metadata intact while starting,
reusing, and stopping app-server instances.
Structs§
- AddApp
Runtime Request - Input for adding or updating an app runtime entry.
- AddServer
Request - Input for adding or updating an MCP server entry.
- AppCall
Handle - Handle returned for each app-server call, bundling response and notifications.
- AppRuntime
- Stored app runtime converted into launch-ready config with metadata intact.
- AppRuntime
Api - Read-only helpers around
AppRuntimeManagerbacked by stored config. - AppRuntime
Definition - Stored definition for launching an app-server runtime.
- AppRuntime
Entry - App runtime definition coupled with its name.
- AppRuntime
Handle - Prepared app runtime with merged stdio config and metadata.
- AppRuntime
Launcher - Launch-ready stdio config bundled with app metadata.
- AppRuntime
Manager - Non-destructive manager for app runtimes backed by launch-ready configs.
- AppRuntime
Pool - Async pool that starts, reuses, and stops app runtimes without mutating config.
- AppRuntime
Pool Api - Public API around
AppRuntimePoolthat exposes pooled lifecycle helpers. - AppRuntime
Summary - Summarized app runtime metadata for listing.
- Approval
Request - Approval request emitted as part of a
codex/eventnotification. - Client
Info - Client metadata attached to the
initializerequest. - Codex
AppServer - Client wrapper around the stdio app-server.
- Codex
Call Handle - Handle returned for each codex call, bundling response and notifications.
- Codex
Call Params - Parameters for
codex/codex(new session). - Codex
Call Result - Final response payload for
codex/codexorcodex/codex-reply. - Codex
McpServer - Client wrapper around the stdio MCP server.
- Codex
Reply Params - Parameters for
codex/codex-reply(continue an existing conversation). - Forked
Thread - Forked thread metadata returned by
thread/fork. - Initialize
Params - Parameters for the initial
initializehandshake. - Managed
AppRuntime - Running app-server instance with metadata preserved.
- Managed
Http Runtime - HTTP runtime connector with tool hints preserved.
- Managed
Stdio Runtime - Running stdio MCP server along with its pipes.
- McpConfig
Manager - Helper to load and mutate MCP + app runtime config stored under
[mcp_servers]and[app_runtimes]. - McpLogin
Result - Result of logging into a server (auth token set in env var).
- McpLogout
Result - Result of clearing a stored auth token.
- McpRuntime
Api - Read-only helpers around
McpRuntimeManagerbacked by stored config. - McpRuntime
Manager - Lightweight runtime manager that owns resolved launchers/connectors.
- McpRuntime
Server - Resolved runtime configuration for an MCP server, ready for spawning or connecting.
- McpRuntime
Summary - Summarized runtime metadata for listing available MCP servers.
- McpServer
Definition - JSON-serializable MCP server configuration stored under
[mcp_servers]. - McpServer
Entry - MCP server definition coupled with its name.
- McpServer
Launcher - Launcher/connector wrapper around a resolved MCP runtime server.
- McpTool
Config - Tool allow/deny lists for a given MCP server.
- Resolved
Streamable Http Definition - HTTP runtime config with bearer tokens resolved from the environment.
- Stdio
Launcher - Prepared stdio launcher with merged env and startup timeout.
- Stdio
Server Config - Shared launch configuration for stdio MCP/app-server processes.
- Stdio
Server Definition - Stdio transport configuration for an MCP server.
- Streamable
Http Connector - Prepared HTTP connector with resolved headers and timeouts.
- Streamable
Http Definition - HTTP transport configuration that supports streaming responses.
- Thread
Fork Params - Parameters for
thread/fork. - Thread
Fork Response - Response payload for
thread/fork. - Thread
List Params - Parameters for
thread/list. - Thread
List Response - Response payload for
thread/list. - Thread
Resume Params - Parameters for
thread/resume. - Thread
Start Params - Parameters for
thread/start. - Thread
Summary - Thread metadata summary returned by
thread/list. - Turn
Input - Turn
Interrupt Params - Parameters for
turn/interrupt. - Turn
Start Params - Parameters for
turn/start. - Turn
Start Params V2 - Parameters for
turn/start(fork-focused pinned v2 subset).
Enums§
- AppNotification
- Notification emitted by the app-server.
- AppRuntime
Error - Errors surfaced while reading app runtimes.
- Approval
Decision - Decision payload sent back to the MCP server in response to an approval prompt.
- Approval
Kind - Classification for approval prompts surfaced by the MCP server.
- Codex
Event - Notification emitted by
codex/event. - McpConfig
Error - Errors surfaced while managing MCP config entries.
- McpError
- Errors surfaced while managing MCP/app-server transports.
- McpRuntime
Error - Errors surfaced while starting or stopping MCP runtimes.
- McpRuntime
Handle - Handle returned by
McpRuntimeManager::preparefor either transport. - McpRuntime
Summary Transport - Transport kind used by a runtime.
- McpRuntime
Transport - Transport-specific runtime configuration.
- McpServer
Launcher Transport - Transport-specific launcher/connector.
- McpTransport
- Supported transport definitions for MCP servers.
- Thread
List Sort Key - Sorting key for
thread/list. - User
Input V2 - User input shape pinned for fork flows.
Constants§
- DEFAULT_
CONFIG_ FILE - Default config filename placed under CODEX_HOME.
- METHOD_
CANCEL - JSON-RPC cancellation method per the spec.
- METHOD_
CODEX - Tool-call method exposed by the MCP server.
- METHOD_
CODEX_ APPROVAL - Expected approval response hook (server-specific; confirmed during E2).
- METHOD_
CODEX_ EVENT - Notification channel emitted by
codex mcp-server. - METHOD_
CODEX_ REPLY - Tool-call method for follow-up prompts (codex-reply).
- METHOD_
EXIT - JSON-RPC method name used after shutdown to signal exit.
- METHOD_
INITIALIZE - JSON-RPC method name used to initialize MCP servers.
- METHOD_
SHUTDOWN - JSON-RPC method name used to shut down MCP servers.
- METHOD_
THREAD_ FORK - Fork an existing thread.
- METHOD_
THREAD_ LIST - List threads (paged).
- METHOD_
THREAD_ RESUME - Resume an existing thread.
- METHOD_
THREAD_ START - Method names exposed by
codex app-server. - METHOD_
TURN_ INTERRUPT - Interrupt an active turn.
- METHOD_
TURN_ START - Start a new turn on a thread.
Type Aliases§
- Event
Stream - Stream of notifications surfaced alongside a JSON-RPC response.
- Request
Id - Unique identifier for JSON-RPC calls.