Semlith

Connect OpenAI Codex to Semlith

How to connect OpenAI Codex to Semlith over MCP, the command or file that adds it, and how to check the connection works.

Every stanza writes ${SEMLITH_BIN} where the binary goes, the path which semlith prints. Set up your agent client explains it and the HTTP form.

OpenAI Codex — ~/.codex/config.toml, shared by the CLI, the IDE extension and the desktop app. The table is mcp_servers, with an underscore. A table with a url is a streamable-HTTP server, with the header in an inline http_headers table. codex mcp add has no scope flag: its usage is codex mcp add [OPTIONS] <NAME> (--url <URL> | -- <COMMAND>...) and it always writes the user-level ~/.codex/config.toml, which covers every project (see codex-rs/cli/src/mcp_cmd.rs in openai/codex). For HTTP it has no flag for an arbitrary header and reads the key from an environment variable, so put export SEMLITH_KEY="$SEMLITH_AGENT_KEY" in your shell profile and run codex mcp add semlith --url "http://127.0.0.1:7365/mcp" --bearer-token-env-var SEMLITH_KEY.

To replace an existing entry:

codex mcp remove semlith
codex mcp add semlith -- "${SEMLITH_BIN}" mcp
~/.codex/config.toml
[mcp_servers.semlith]
command = "${SEMLITH_BIN}"
args = ["mcp"]

Or against a daemon on another machine, over HTTP:

[mcp_servers.semlith]
url = "http://127.0.0.1:7365/mcp"
http_headers = { Authorization = "Bearer ${SEMLITH_AGENT_KEY}" }

Its user-level instructions file, read on every session, to which semlith setup --register-all appends the rule block — see https://developers.openai.com/codex/guides/agents-md.

~/.codex/AGENTS.md
${SEMLITH_RULES}