OpenAI Codex Connection Guide¶
This guide describes how to connect OpenAI Codex to SnatchArr's Model Context Protocol (MCP) server.
Protocol and Transport¶
SnatchArr exposes a native Model Context Protocol server over two transports:
- Streamable HTTP:
http://localhost:8080/api/v1/mcp(sessionless JSON-RPC 2.0). - Subprocess stdio:
snatcharr mcp stdio(ordocker exec -i -e SNATCHARR_URL -e SNATCHARR_API_KEY <container> /snatcharr-api mcp stdiofor container deployments), a thin proxy that delegates to/api/v1/mcpviaSNATCHARR_URLandSNATCHARR_API_KEY.
Authentication and Prerequisites¶
Connecting to SnatchArr requires:
- Enabling the MCP server on the settings page (
/settings) via the Enable MCP server (/api/v1/mcp) toggle. - Generating a scoped bearer API key on the account page (
/account) under the API keys section.
See Module Toggle Switch and Authentication and Permission Scopes for full scope descriptions, challenge behavior, and write-tool activation instructions.
Export the connection environment variables in your shell:
Client Configuration¶
Codex manages MCP server connections using TOML configuration files or the codex mcp CLI.
Option A: Subprocess stdio Transport¶
To compile and install the host snatcharr CLI binary, see Install the proxy.
Configuration File (config.toml)¶
Add the snatcharr server block to ~/.codex/config.toml (global) or .codex/config.toml (workspace):
[mcp_servers.snatcharr]
command = "snatcharr"
args = ["mcp", "stdio"]
env = { SNATCHARR_URL = "http://localhost:8080", SNATCHARR_API_KEY = "your-snatcharr-api-key" }
For containerized deployments where the binary /snatcharr-api runs inside a container:
[mcp_servers.snatcharr]
command = "docker"
args = ["exec", "-i", "-e", "SNATCHARR_URL", "-e", "SNATCHARR_API_KEY", "snatcharr-api", "/snatcharr-api", "mcp", "stdio"]
env = { SNATCHARR_URL = "http://localhost:8080", SNATCHARR_API_KEY = "your-snatcharr-api-key" }
CLI Helper¶
Register the stdio server using the Codex CLI:
codex mcp add snatcharr --env SNATCHARR_URL="http://localhost:8080" --env SNATCHARR_API_KEY="${SNATCHARR_API_KEY}" -- snatcharr mcp stdio
Option B: Streamable HTTP Transport¶
Configuration File (config.toml)¶
Add the HTTP server block:
[mcp_servers.snatcharr]
url = "http://localhost:8080/api/v1/mcp"
bearer_token_env_var = "SNATCHARR_API_KEY"
[!IMPORTANT] In Codex TOML configurations,
http_headersonly accepts static string literals and does not support environment variable interpolation. Usebearer_token_env_varto supply your API key dynamically from the named environment variable without committing secrets to disk. For custom non-bearer headers, Codex providesenv_http_headersto map header names to environment variables.
CLI Helper¶
Register the server using the Codex CLI:
codex mcp add snatcharr --url http://localhost:8080/api/v1/mcp --bearer-token-env-var SNATCHARR_API_KEY
Agent Skills Installation¶
SnatchArr provides an official Agent Skills bundle complying with the agentskills.io standard at skills/snatcharr/ in the repository root (ADR-0021 section 8).
Copy the skill definition into your Codex skills directory:
- Global user path:
~/.agents/skills/snatcharr/SKILL.md(Codex skills) - Workspace project path:
.agents/skills/snatcharr/SKILL.md; Codex scans.agents/skillsin every directory from the working directory up to the repository root (Codex skills)
# Global installation
mkdir -p ~/.agents/skills/snatcharr
cp -r skills/snatcharr/* ~/.agents/skills/snatcharr/
# Or workspace installation
mkdir -p .agents/skills/snatcharr
cp -r skills/snatcharr/* .agents/skills/snatcharr/
Verification¶
To verify the connection and list available tools:
- Run the Codex MCP status command:
- Confirm that
snatcharris displayed as an active server and that standard read tools are discoverable: snatcharr_get_system_statussnatcharr_list_instancessnatcharr_list_runssnatcharr_get_hourly_caps
Official Documentation References¶
- OpenAI Codex MCP Documentation: OpenAI official reference (OpenAI MCP CLI Guide) (Codex skills) and
codex mcp add --help, checked 2026-10-24. - SnatchArr Architectural Record: ADR-0021: LLM access module.