Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:0xranx OpenContext Codex CLI

From Leeroopedia
Knowledge Sources
Domains Agent, CLI
Last Updated 2026-10-24 10:00 GMT

Overview

Codex CLI agent installed and accessible via MCP protocol for spawning AI agent sessions within the OpenContext desktop app.

Description

This environment requires the Codex CLI to be installed and available as an MCP server. The `codex_exec` Tauri command spawns a Codex agent session by sending `tools/call` JSON-RPC requests (either `codex` or `codex-reply` tool names) to the Codex MCP server. Sessions support conversation continuity via `conversationId` and handle permission prompts for tool calls.

Usage

Use this environment when running AI agent sessions from the OpenContext desktop app. It is the mandatory prerequisite for the `codex_exec` implementation which spawns and communicates with Codex agents via MCP.

System Requirements

Category Requirement Notes
OS Cross-platform Must match Codex CLI support
Hardware Any modern CPU Network access for AI inference
Network Internet access AI model API calls

Dependencies

  • Codex CLI installed and available on PATH
  • MCP server protocol support
  • Tauri desktop runtime (for the host application)

Credentials

  • Codex CLI configuration (model, API keys) must be set up separately
  • The `model` parameter can be passed via `codex_exec` options

Quick Install

# Install Codex CLI (follow Codex installation instructions)
# Ensure it is available on PATH and configured as an MCP server

Code Evidence

Codex MCP tool invocation from `src-tauri/src/commands/agent.rs:1580-1605`:

let params = if use_reply {
    args.insert("conversationId".to_string(),
        serde_json::Value::String(conversation_id.clone()));
    serde_json::json!({
        "name": "codex-reply",
        "arguments": serde_json::Value::Object(args),
    })
} else {
    serde_json::json!({
        "name": "codex",
        "arguments": serde_json::Value::Object(args),
        "config": {
            "conversationId": conversation_id,
        }
    })
};

send_rpc_request(&session, "tools/call", params, Some(request_id), false, 600);

Session creation with Codex MCP kind from `agent.rs:1545-1552`:

let session = get_or_create_rpc_session(
    app.clone(),
    state,
    &session_id,
    AgentRpcKind::CodexMcp,
    cwd.clone(),
    model,
)?;

Common Errors

Error Message Cause Solution
`Agent RPC session not found` Codex MCP server not started Ensure Codex CLI is installed and configured
`codex_preflight failed` Pre-flight check failed (missing CLI, config) Install/configure Codex CLI
Timeout on `tools/call` Agent took too long (600s timeout) Check model availability and network

Compatibility Notes

  • Conversation continuity: First message uses `codex` tool; subsequent messages use `codex-reply` with `conversationId`.
  • Timeout: RPC requests have a 600-second (10 minute) timeout.
  • Session state: Each session tracks `codex_session_started` and `conversation_id` for multi-turn conversations.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment