MCP server

Connect Codex

Connect Codex to Pitvi with OAuth or an API key.

Codex connects to Pitvi as a Streamable HTTP MCP server. The ChatGPT desktop app, Codex CLI and the Codex IDE extension share the MCP configuration stored by the same Codex host.

With OAuth

OAuth is the recommended option for an interactive Codex session. There is no key to copy: Codex opens Pitvi in your browser and stores the tokens after you approve the connection.

Add the server

codex mcp add pitvi --url https://api.pitvi.com/api/mcp

Sign in

codex mcp login pitvi

Keep the command running while you sign in to Pitvi and approve the connection in your browser.

Check it

codex mcp list

Restart the desktop app or IDE extension after adding the server. In a Codex conversation, /mcp shows the MCP servers available to that session.

After approval, your browser returns to a temporary callback on the device running Codex. This is expected: it delivers the authorization code to Codex, not back to the Pitvi website. Keep the login command open until it completes.

From the desktop app

Open Settings > MCP servers, select Add server, choose Streamable HTTP and enter:

https://api.pitvi.com/api/mcp

Save, restart the app, then select Authenticate beside Pitvi.

Equivalent config.toml

Codex stores MCP settings in ~/.codex/config.toml:

[mcp_servers.pitvi]
url = "https://api.pitvi.com/api/mcp"
auth = "oauth"
default_tools_approval_mode = "writes"
startup_timeout_sec = 20
tool_timeout_sec = 120

With an API key

Use a key for CI, scripts or any environment where a browser cannot complete the OAuth flow. Create one in Settings > Connections, put it in the environment of the process that starts Codex, and reference its variable name rather than writing the secret into config.toml.

[mcp_servers.pitvi]
url = "https://api.pitvi.com/api/mcp"
bearer_token_env_var = "PITVI_API_KEY"
default_tools_approval_mode = "writes"

The value of PITVI_API_KEY must be the complete pitvi_sk_... key.

If it will not connect

The browser cannot finish authorization. Run codex mcp login pitvi again and keep its terminal open until the redirect completes. Security software must allow Codex to listen temporarily on the loopback interface.

Needs authentication. Re-run codex mcp login pitvi, or check that the API key environment variable is visible to the Codex process and that the key has not been revoked.

Failed to connect. Confirm that the URL is exactly https://api.pitvi.com/api/mcp, then run codex mcp list to check the server's status.

See the official Codex MCP documentation for more Codex configuration options.