Configure OpenAI Codex CLI
Connect the OpenAI Codex CLI to your Datasentinel MCP server on Linux, sign in, install the Datasentinel Skill, and verify the configuration.
This page shows how to wire the OpenAI Codex CLI to your Datasentinel platform on a Linux host: add the MCP server, sign in once, install the Skill that tells the assistant how to use it, and check that everything is connected.
The same pattern applies to other MCP-and-Skill-capable assistants. The commands below are specific to the Codex CLI (the codex command), OpenAI's open-source terminal coding agent.
Before you start
The Codex CLI is installed and you can run
codexfrom a terminal. If it is not yet installed, follow the steps below.Your Datasentinel MCP server is reachable over HTTPS at
https://<public-host>/mcp. See MCP Server Setup if it is not yet running.
Install the Codex CLI
Codex CLI is a native binary (written in Rust) and runs on Linux, macOS and Windows. For the full instructions, see OpenAI's Codex CLI guide.
On Linux, download and run the official installer:
curl -fsSL https://chatgpt.com/codex/install.sh | shFor other installation methods (npm install -g @openai/codex, Homebrew, the PowerShell installer for Windows), see the Codex CLI installation guide.
Once installed, start the CLI and sign in:
codexOn first launch you choose how to authenticate: sign in with ChatGPT (Codex is included with Plus, Pro, Business, Edu, and Enterprise plans), or export an API key before launching:
export OPENAI_API_KEY=<your-key>Set it up
Add the Datasentinel MCP server
Register the server with its HTTPS URL:
Codex treats any server that has a url as a remote streamable-HTTP server, so there is no separate transport flag to set. For more on connecting Codex to MCP servers, see the Codex MCP guide.
When Codex detects that the server uses OAuth, codex mcp add starts the sign-in at once (Detected OAuth support. Starting OAuth flow…) and opens your browser: that is the next step, done in one go. On a host without a browser, write the entry by hand in config.toml instead (shown below), then sign in as described in Without a browser. Running codex mcp add again for the same name replaces the whole entry, including any settings you added to it by hand.
You can also edit the configuration file directly. Servers live in ~/.codex/config.toml, each under an [mcp_servers.<name>] table:
Self-signed or invalid certificate
Codex validates the /mcp certificate against the host's system trust store and offers no switch to turn validation off. Using a valid TLS certificate is highly recommended: provision one from a public authority, or from an internal CA installed in the system trust store, so validation stays on. When the CA is not in the system store, point Codex at a PEM bundle with CODEX_CA_CERTIFICATE (Codex falls back to SSL_CERT_FILE when it is unset); it applies to all of Codex's outbound HTTPS connections:
See Custom CA bundles in OpenAI's documentation. codex doctor --network-only (Codex 0.166) checks connectivity and the TLS setup. The sign-in below also opens the login page in your browser, so the browser must trust the certificate too.
For details, see MCP Server Setup and the Codex CLI configuration reference.
Sign in to the platform
With a browser
Start the sign-in for the server you registered:
Codex prints the link and opens the Datasentinel login page in your browser. Sign in with your platform login and password, the same ones as the Datasentinel web interface. The page names the assistant that is asking; after the sign-in the browser hands the session back to Codex, which confirms with Successfully logged in. Inside an interactive session, /mcp shows the server's authentication state, and since Codex 0.161 /mcp login datasentinel-production runs the same sign-in without leaving the session.
You sign in once. Codex stores the session in the OS keyring, or in a file under ~/.codex/ when the host has no keyring, and renews it by itself. It asks again only after ten days without using the server, or when an administrator ends the session. Your password goes to the login page only; Codex never sees it and never asks for a token. codex mcp logout datasentinel-production ends the session on this host.
Since Codex 0.148, codex mcp login has an --oauth-client-registration option (auto, cimd or dcr). Keep the default, auto: Codex uses dynamic client registration, which is what the Datasentinel server offers, unless the authorization server advertises client ID metadata documents (CIMD).
Without a browser
On a server without a browser (an SSH session, a build machine), the sign-in still runs in the browser of your laptop, through an SSH port forward. Codex picks a random callback port unless you fix one, so first set the port in ~/.codex/config.toml on the server. The key is a top-level one: put it above the first [mcp_servers...] header, or it would be read as part of that table.
To fix the port for this server only, use callback_port = 19876 under a [mcp_servers.datasentinel-production.oauth] table instead.
Then open the SSH session from your laptop with that port forwarded, and start the sign-in inside that session:
Codex prints the authorization link (and fails to open a browser, which is expected). Open the link in the laptop's browser and sign in; the way back to 127.0.0.1:19876 travels through the tunnel to Codex on the server, which confirms with Successfully logged in. If you are already connected without the option, log out and reconnect with it before running the login. This procedure was verified with Codex 0.155.0. The general procedure is in How authentication works.
For a script or a scheduled run
Where nobody can sign in, register the server with a user token as an authorization header instead. The token is the platform's 24-hour user token. Codex reads it from an environment variable, so the token is never written in the configuration:
The resulting entry in ~/.codex/config.toml sends Authorization: Bearer <token> on every call:
A server registered this way never opens the login page; when the token expires, the calls fail until a fresh one is set. See Refresh the user token automatically to keep it current.
Install the Datasentinel Skill
The Datasentinel Skill is made of several files (a SKILL.md entrypoint plus supporting files) and ships as a single archive, datasentinel-skill.zip. Download it from https://app.datasentinel.io/ds-api/download/datasentinel-skill.zip.
Skills in Codex are file-based: there is no install command. Create the Skills directory if it does not exist yet, then unzip the archive into it so it produces a datasentinel/ folder. Codex detects new Skills automatically; if it does not show up, restart Codex.
You should end up with ~/.agents/skills/datasentinel/SKILL.md (or .agents/skills/datasentinel/SKILL.md) alongside the Skill's supporting files. Each Skill lives in its own directory whose SKILL.md is the entrypoint. Its frontmatter carries the description the assistant uses to decide when to apply the Skill:
Check your configuration
List the configured servers from the terminal:
Inside an interactive codex session, the /mcp command shows the active MCP servers:
A healthy server appears with its tools available. A server you have not signed in to yet is shown as needing authentication: go back to the sign-in step. If a server shows an error, check the URL in config.toml and that the server is up.
Approve the Datasentinel tools
The first time the assistant calls a Datasentinel tool, Codex asks you to approve it: Allow, Allow for this session, or Always allow. Always allow saves approval_mode = "approve" for that one tool in ~/.codex/config.toml (it is offered in the default auto mode only). To stop the prompts for every tool of the server at once, set the approval mode of the server in the same file:
The modes are approve (never ask), prompt (ask for every tool), writes (ask for tools not marked read-only, which is every Datasentinel tool today), and auto (the default). A single tool can differ from the server, under [mcp_servers.datasentinel-production.tools.<tool>] with approval_mode. The Datasentinel tools only read monitoring data, so approving the whole server is safe.
Do not rely on approval_policy = "never" for this: it removes the prompts, but under the default sandbox an MCP call that needs approval is then denied (MCP tool call requires approval, but approval policy is never), so the Datasentinel tools fail. For a non-interactive run, combine it with default_tools_approval_mode = "approve" on the server. The fields are in the Codex MCP guide.
Once the server is connected and the Skill is in place, run through the checks below to confirm the end-to-end flow.
How the Skill loads
The Datasentinel Skill loads on demand. Codex reads every Skill's name and description up front, and applies the full instructions automatically when your prompt relates to Datasentinel: asking about PostgreSQL performance, instances, sessions, or the platform itself is enough. One Skill serves every platform, because it discovers all the datasentinel-* MCP servers you registered, so adding a second platform needs no Skill change.
If Codex answers generically instead (no Datasentinel tool calls in the response), load the Skill manually:
Type
$in the composer and pickdatasentinelto mention the Skill explicitly in your request.Or run
/skillsto browse the discovered Skills and invoke it from there.Or name it in the prompt:
Use the datasentinel skill to check the platform status.
If the Skill does not appear under /skills, re-check the unzip location from the setup step and restart Codex. See OpenAI's Build Skills reference for the invocation details.
Test the MCP server and Skill
Run these checks inside an interactive codex session.
You exercise the Skill by asking in plain language and letting it drive the MCP tools (see How the Skill loads above). The Datasentinel Skill recognises four built-in checks. Run them in order:
datasentinel help
Displays the Skill's help, listing the available commands.
datasentinel platforms
Lists every MCP server (platform) the Skill discovered by its datasentinel- prefix.
datasentinel status
Checks the platform status, confirming the MCP server answers.
datasentinel whoami
Shows who you are signed in as, your privilege and the session expiry.
These four are the setup checks. The full command list, with what each one needs, is in the Skill commands reference.
Start with datasentinel help to confirm the Skill responds. Then run datasentinel platforms to verify your server is discovered: each datasentinel-* MCP server you registered should appear in the list. Then run datasentinel status to confirm the platform is reachable and the MCP tools return live data. Finally, datasentinel whoami confirms the session belongs to your platform user, with the privilege you expect.
Last updated