Skip to content

OpenAI Codex

Codex is OpenAI’s command-line coding agent. Being a CLI, it can reach the Datamesh MCP server either way — a remote streamable-HTTP endpoint or a local stdio server — configured in ~/.codex/config.toml (or a per-project .codex/config.toml in a trusted project). Codex chooses the transport from the keys present: url for HTTP, command for stdio.

Add a streamable-HTTP server with the Datamesh endpoint and an X-DATAMESH-TOKEN header:

[mcp_servers.oceanum-datamesh]
url = "https://mcp.oceanum.io/datamesh"
[mcp_servers.oceanum-datamesh.http_headers]
X-DATAMESH-TOKEN = "your-datamesh-token"

Replace your-datamesh-token with your Datamesh token. The http_headers table maps header names to static values; to keep the token out of the file, set it in an environment variable and reference it from an [mcp_servers.oceanum-datamesh.env_http_headers] table instead.

The hosted server is read-only and returns query_data results inline (up to ~50 MB). For larger results, Codex can call export_query, which on the hosted server returns a time-limited download link to the full result — the link needs no token, so treat it like a password. The local server below writes export_query output to a file instead.

Note: some Codex releases have had rough edges with streamable-HTTP MCP servers. If the connection misbehaves, use the local stdio server below — it is the most reliable transport for a CLI agent.

For full read/write, and to have export_query write results straight to a file on your machine, run the server locally:

[mcp_servers.oceanum-datamesh]
command = "uvx"
args = ["--python", "3.13", "oceanum-mcp", "datamesh"]
[mcp_servers.oceanum-datamesh.env]
DATAMESH_TOKEN = "your-token-here"

Or add it from the command line:

Terminal window
codex mcp add oceanum-datamesh --env DATAMESH_TOKEN=your-token-here -- uvx --python 3.13 oceanum-mcp datamesh

This requires uv on your PATH. The --python 3.13 argument has uv run the server on Python 3.13 (downloading it if needed), as some of the server’s dependencies don’t yet install on Python 3.14. List configured servers with codex mcp list.

Your Datamesh token grants access to all of your organisation’s permissioned datasources — including the ability to modify or delete them. Treat it as a secret, and prefer the hosted read-only server for exploratory use.