Skip to main content
Glama

Codex MCP Server

npm version npm downloads license

MCP server for OpenAI Codex CLI v0.50.0+ with session management, model selection, and native resume support.

graph LR
    A[Claude Code] --> B[Codex MCP Server]

    B --> C[codex tool]
    B --> D[listSessions tool]
    B --> E[ping tool]
    B --> F[help tool]

    C --> G[Codex CLI v0.50.0+]
    C --> H[Session Storage]

    style A fill:#FF6B35
    style B fill:#4A90E2
    style C fill:#00D4AA
    style D fill:#00D4AA
    style E fill:#00D4AA
    style F fill:#00D4AA
    style G fill:#FFA500
    style H fill:#9B59B6

Prerequisites

  • OpenAI Codex CLI v0.50.0+ must be pre-installed and configured

    • Install: npm i -g @openai/codex or brew install codex

    • Setup: Run codex login --api-key "your-openai-api-key"

    • ⚠️ Breaking Change: OPENAI_API_KEY environment variable is no longer supported

    • ⚠️ Version Requirement: v0.50.0+ required (see Version Compatibility below)

  • Claude Code installed

Version Compatibility

This MCP server requires codex CLI v0.50.0 or later due to the following changes:

  • v0.50.0+: Introduced --skip-git-repo-check flag (now required)

  • v0.50.0+: Reasoning effort now configured via -c model_reasoning_effort=X flag

If you have an older version of codex CLI, you will need to upgrade:

npm update -g @openai/codex

For detailed version compatibility information, see docs/codex-cli-integration.md.

Installation

One-Click Installation

VS Code

Install in VS Code

VS Code Insiders

Install in VS Code Insiders

Cursor

Install in Cursor

Manual Installation

Claude Code

claude mcp add codex-cli -- npx -y codex-mcp-server

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "codex-cli": {
      "command": "npx",
      "args": ["-y", "codex-mcp-server"]
    }
  }
}

Usage in Claude Code

Once installed, Claude Code can use these tools:

codex - Code Assistant

Run Codex queries with optional session support for multi-turn conversations.

Basic Usage:

Use the codex tool to explain this function:
[paste your code here]

Advanced Usage:

# Model selection (defaults to gpt-5.1-codex)
Use codex with model "gpt-4" to analyze this complex algorithm

# Reasoning effort control
Use codex with reasoningEffort "high" for thorough code review

# Session with model override
Use codex with sessionId "my-session" and model "gpt-4" to refactor this code

# Continue conversation (uses native codex resume)
Use codex with sessionId "my-session" to make it more efficient

# Reset session context
Use codex with sessionId "my-session" and resetSession true to start fresh analysis

Parameters:

  • prompt (required): Your coding question or request

  • sessionId (optional): Session ID for conversational context

  • resetSession (optional): Reset session history before processing

  • model (optional): Model to use (defaults to gpt-5.1-codex)

  • reasoningEffort (optional): Control reasoning depth ('minimal', 'low', 'medium', 'high')

listSessions - Session Management

List all active conversation sessions with metadata including creation time, last access, and turn count.

Usage:

Use listSessions to see all active coding sessions

ping - Connection Test

Test if the MCP server is working properly.

help - Codex CLI Help

Get information about Codex CLI capabilities and commands.

Example Workflows

Code Analysis:

Please use the codex tool to review this TypeScript function and suggest improvements

Conversational Code Development:

# Start a session for complex refactoring
Use codex with sessionId "refactor-auth" to analyze this authentication system

# Continue building on the analysis
Use codex with sessionId "refactor-auth" to implement the security improvements you suggested

# Check session history
Use listSessions to see all active development sessions

Bug Fixing:

Use codex to help debug this error: [error message]

Code Generation:

Ask codex to create a React component that handles file uploads

Advanced Features (Codex CLI v0.50.0+)

Session Management

  • Uses codex resume for conversation continuity

  • Falls back to manual context building when resume unavailable

  • Sessions persist for 24 hours

  • 57 tests covering functionality and edge cases

Model Selection

  • Default: gpt-5.1-codex

  • Override per request with model parameter

  • Reasoning effort: minimal, low, medium, high

Authentication

  • OPENAI_API_KEY env var no longer supported

  • Run codex login --api-key "your-key" instead

  • Credentials stored in CODEX_HOME/auth.json

Development

# Install dependencies
npm install

# Development mode
npm run dev

# Build
npm run build

# Start built server
npm start

Documentation

License

ISC

Available Tools

4 tools
codexC

Execute Codex CLI in non-interactive mode for AI assistance

ParametersJSON Schema
NameRequiredDescriptionDefault
promptYesThe coding task, question, or analysis request
sessionIdNoOptional session ID for conversational context
resetSessionNoReset the session history before processing this request
modelNoSpecify which model to use (defaults to gpt-5.1-codex). Options: gpt-5.1-codex, gpt-5-codex, gpt-4, gpt-3.5-turbo
reasoningEffortNoControl reasoning depth (minimal < low < medium < high)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'Execute Codex CLI in non-interactive mode' but doesn't explain what 'non-interactive' entails (e.g., single request vs. chat, no user input during execution), nor does it cover permissions, rate limits, or error handling, which are critical for an AI assistance tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It's front-loaded with the core action, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of an AI assistance tool with 5 parameters and no annotations or output schema, the description is insufficient. It lacks details on behavior (e.g., response format, error cases), usage context, and how parameters interact with 'non-interactive mode', leaving significant gaps for the agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the baseline is 3. The description adds no additional parameter information beyond what's in the schema (e.g., it doesn't clarify 'non-interactive mode' in relation to parameters like 'sessionId'), so it doesn't enhance the schema's documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Execute Codex CLI') and the mode ('non-interactive mode for AI assistance'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'help' or 'listSessions' beyond the general AI assistance context, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'help' or 'listSessions'. It mentions 'non-interactive mode' but doesn't explain what that means or when it's appropriate, leaving the agent without clear usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

helpB

Get Codex CLI help information

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. It states what the tool does ('Get help information') but doesn't describe behavioral traits such as output format, error handling, or any constraints. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and uses minimal words to convey the essential information. Every word earns its place, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is adequate but has clear gaps. It states the purpose but lacks details on behavioral aspects like what the help information includes or how it's formatted. For a help tool, more context on output expectations would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters, and schema description coverage is 100%, so there's no need for parameter details in the description. The description appropriately doesn't mention parameters, which is correct for a no-parameter tool. It adds no semantic value beyond the schema, but that's acceptable here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get Codex CLI help information' clearly states the action ('Get') and resource ('Codex CLI help information'), making the purpose immediately understandable. It's specific enough to distinguish it from siblings like 'codex', 'listSessions', and 'ping', though it doesn't explicitly differentiate from them. The verb 'Get' is appropriate for a help retrieval operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any prerequisites, context for usage, or comparisons to sibling tools. While the purpose is clear, the lack of usage instructions leaves the agent without direction on optimal invocation timing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

listSessionsB

List all active conversation sessions with metadata

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a listing operation but doesn't reveal whether it's paginated, real-time vs cached, permission requirements, rate limits, or what 'active' means (timeout thresholds). For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that communicates the core purpose without unnecessary words. It's front-loaded with the main action and resource, and every element ('List', 'all active conversation sessions', 'with metadata') serves a clear informational purpose. No wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and a simple zero-parameter design, the description is incomplete. It doesn't explain what metadata is returned, format of results, whether sessions are sorted/filterable, or error conditions. For a listing tool that presumably returns structured data, more context about output expectations is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100% (though empty). The description appropriately doesn't discuss parameters since none exist, and it adds value by clarifying scope ('active') and output content ('with metadata') beyond what an empty schema provides. This meets the baseline for zero-parameter tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List') and resource ('all active conversation sessions with metadata'), making the tool's purpose immediately understandable. It doesn't distinguish from siblings, but since siblings are unrelated tools (codex, help, ping), differentiation isn't needed here. The description goes beyond tautology by specifying scope ('active') and what's included ('with metadata').

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. While it implies usage when needing to see active sessions, there's no mention of prerequisites, frequency considerations, or comparison to other session-related tools (though none appear in siblings). This leaves the agent without contextual usage instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

pingB

Test MCP server connection

ParametersJSON Schema
NameRequiredDescriptionDefault
messageNoMessage to echo back

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool tests connection but doesn't describe what 'test' entails (e.g., whether it sends a request, checks latency, returns status codes), what happens on failure, or any side effects. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without any unnecessary words. It is appropriately sized and front-loaded, making it easy to understand at a glance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one optional parameter) and high schema coverage, the description is minimally adequate. However, without annotations or an output schema, it lacks details on behavioral traits (e.g., what 'test' means, response format) that would help the agent use it correctly, leaving room for improvement.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the parameter 'message' documented as 'Message to echo back'. The description adds no additional meaning about parameters beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as testing MCP server connection, which is a specific action (test) on a specific resource (MCP server connection). However, it doesn't distinguish this from sibling tools like 'help' or 'listSessions', which might also involve server interaction, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention any context, prerequisites, or exclusions, and doesn't reference sibling tools. The agent must infer usage based on the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 4 tool updatesv1.1.3
    • First observedcodex
    • First observedhelp
    • First observedlistSessions
    • First observedping

TDQS

B3.3/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: codex executes CLI commands, help provides documentation, listSessions manages sessions, and ping tests connectivity. There is no overlap or ambiguity in functionality.

Naming Consistency3/5

The naming is mixed: codex and ping are simple verbs, help is a noun, and listSessions uses camelCase. While readable, there is no consistent pattern like verb_noun or uniform casing.

Tool Count4/5

With 4 tools, the count is reasonable for a server focused on CLI assistance and session management. It is slightly thin but covers core operations without bloat.

Completeness4/5

For a Codex CLI server, the tools cover execution, help, session listing, and connectivity testing. A minor gap is the lack of session creation or deletion tools, but agents can work around this.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tom-wahl/codex-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server