How to connect Codex to a server
Codex, OpenAI's coding agent, can work with a server in two ways: through an MCP server added to its settings, or by running SSH commands in your terminal. Here is how each one works, what can go wrong, and a way that needs no server of your own.
Try it on your own project
Choose AI Claude CodeCodexGoogle AntigravityCursorVS CodeAnother AI
Claude Code can add BitHut by itself. Paste this into it:
Add the BitHut MCP server for me: run “claude mcp add --transport http bithut https://api.bithut.app/mcp”.
Then restart Claude Code, type /mcp, pick bithut and sign in: sign in to BitHut in your browser and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Or run the command yourself
Run this command in a terminal.
claude mcp add --transport http bithut https://api.bithut.app/mcp
Start Claude Code, type /mcp, pick bithut and sign in. Sign in to BitHut in your browser and press Allow.
Already added BitHut in Claude, and you sign in to Claude Code with the same Claude account? Then BitHut is already in Claude Code.
Codex can connect BitHut by itself. Paste this into it:
Connect the BitHut MCP server for me: run “codex mcp add bithut --url https://api.bithut.app/mcp”, then “codex mcp login bithut”. The address must be exactly https://api.bithut.app/mcp: if a backslash got into it when pasting, remove it before adding.
A page opens in your browser: sign in to BitHut and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Or run the commands yourself
Run these two commands.
codex mcp add bithut --url https://api.bithut.app/mcp codex mcp login bithut
The second one opens a page in your browser. Sign in to BitHut and press Allow.
Antigravity can add BitHut by itself. Paste this into its agent:
Add the BitHut MCP server for me: in ~/.gemini/config/mcp_config.json, under “mcpServers”, add "bithut": {"serverUrl": "https://api.bithut.app/mcp"}.
When Antigravity asks, sign in to BitHut and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Or add it yourself
In the Antigravity editor, click … at the top of the agent panel, then MCP Servers, Manage MCP Servers, View raw config.
Under “mcpServers”, add this line and save the file.
"bithut": {"serverUrl": "https://api.bithut.app/mcp"}
When Antigravity asks, sign in to BitHut and press Allow.
Cursor can add BitHut by itself. Paste this into its chat:
Add the BitHut MCP server to Cursor for me: in ~/.cursor/mcp.json, under “mcpServers”, add "bithut": {"url": "https://api.bithut.app/mcp"}.
Then open Cursor Settings, find BitHut among the MCP servers, sign in and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Or add it yourself
In ~/.cursor/mcp.json, under “mcpServers”, add this line and save the file.
"bithut": {"url": "https://api.bithut.app/mcp"}
Open Cursor Settings, find BitHut among the MCP servers, sign in and press Allow.
Open the Command Palette (Ctrl+Shift+P, on a Mac ⇧⌘P) and run “MCP: Add Server”.
Choose HTTP, paste this address and name the server bithut.
https://api.bithut.app/mcp
When VS Code asks, sign in to BitHut and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Find where your AI app adds MCP servers. It may be called MCP servers, connectors or tools.
Add a remote (HTTP) server with this address.
https://api.bithut.app/mcp
If it asks how to sign in, choose OAuth. Sign in to BitHut and press Allow.
Ask it: “Show my BitHut projects.” If it answers, you are connected.
Can’t find the setting? Ask your AI: “How do I add a remote MCP server here?”
Copy the prompt into it: Put this project online on BitHut and give me the address
The short answer
Codex can reach a server in two ways.
- An MCP server. MCP (Model Context Protocol) is a standard way to give an AI a set of tools: “deploy”, “show logs”, “restart”. You add the server to Codex once, and from then on Codex calls those tools by itself. The server can run on your computer or sit at an internet address.
- SSH commands. Codex types
sshcommands in your terminal, logs in to the server and runs commands there, just as a person would.
For someone who doesn’t want to look after a server, the safer route is a service that already has an MCP server, such as BitHut. Codex then gets a short list of clear tools instead of full control over a machine.
Everything about Codex on this page comes from OpenAI’s own documentation, checked 23 November 2026.
Where Codex keeps its connections
Codex stores MCP servers in a settings file, ~/.codex/config.toml, and each server gets its own [mcp_servers.<name>] section (OpenAI, MCP). The Codex CLI, the Codex IDE extension and the ChatGPT desktop app share this setup on the same computer, so a server you add once shows up in all three. ChatGPT on the web is different: it doesn’t read these local files.
Commands worth knowing (OpenAI, CLI reference):
| Command | What it does |
|---|---|
codex mcp add <name> --url <address> |
adds a server that lives at an internet address |
codex mcp login <name> |
signs you in to that server, if it uses OAuth |
codex mcp list |
shows the servers Codex knows about |
codex mcp remove <name> |
deletes a server from the settings |
/mcp inside Codex |
shows the servers that are active right now |
Your own VPS, option A: let Codex use SSH
If you already have a VPS, the quickest start is to let Codex log in over SSH and run commands. It works, but think about what you are handing over.
- Codex acts as that user. Whatever the SSH user can do on the server, Codex can do too, including deleting files or stopping a database. Make a separate user with only the rights the job needs, not
root. - Keys, not passwords. Log in with an SSH key, so no password ends up in a chat or a script.
- Keep approvals on. Codex has two separate controls: the sandbox decides which files and network it can reach, approvals decide when it stops to ask you. In the default Auto mode Codex works freely in your project folder and asks before editing files outside it or using the network (OpenAI, approvals and security). An SSH connection needs the network, so you get to see the command first.
- Avoid full access. The
--dangerously-bypass-approvals-and-sandboxflag (also--yolo) turns off both the sandbox and the questions. OpenAI marks it “not recommended”. You can switch modes inside Codex with/permissions.
The catch with SSH is that you still run the server yourself: updates, the firewall, HTTPS certificates, backups, restarting things after a crash. Codex can type the commands, but deciding what is safe stays with you.
Your own VPS, option B: run an MCP server on it
The other way is to put an MCP server on the VPS and give Codex its address. Codex then sees only the tools that server offers, not the whole machine.
-
Run the server so it answers at an address. Codex connects to such servers over “Streamable HTTP” (OpenAI, MCP).
-
Add it to Codex:
codex mcp add myserver --url https://mcp.example.com/mcp -
Sign in. If the server uses OAuth, run
codex mcp login myserver; a sign-in page opens in your browser. If the server takes a fixed token instead,--bearer-token-env-vartells Codex which environment variable holds it, and Codex sends it with every request (OpenAI, CLI reference).
The command writes a section like this to config.toml, which you can also edit by hand:
[mcp_servers.myserver]
url = "https://mcp.example.com/mcp"
Other keys from the documentation: enabled = false switches a server off without deleting it, enabled_tools limits which tools Codex may use, startup_timeout_sec (10 seconds by default) and tool_timeout_sec (60 seconds by default) set how long Codex waits.
What you have to take care of on the VPS:
- HTTPS. The address is on the open internet, so traffic should be encrypted. That means a domain and a certificate.
- A sign-in check. Without one, anyone who finds the address can call your tools.
- Keeping it running. The server must restart after a crash or a reboot, or Codex loses its tools.
- The firewall. Open only the port the server needs.
This is the right choice if you are building tools of your own. If all you want is to put a project online, it is a lot of work before the first deploy.
The BitHut way: nothing to host
BitHut already runs an MCP server at https://api.bithut.app/mcp. You don’t set up a VPS, a domain or a certificate. You add BitHut to Codex once and sign in. Step by step, with a prompt Codex runs by itself: connect Codex to BitHut.
After that you talk to Codex as usual, and it uses BitHut’s tools:
- puts a project online and gives you its address: a site, a bot, a script on a schedule or a webhook receiver;
- stores keys and tokens apart from the code;
- reads logs and explains what went wrong;
- rolls back to an earlier version, pauses a project, restores data.
Sites start private behind a password page, and you open them when you want. One price for the account, any number of projects within the plan; see pricing.
If something doesn’t work
- Codex doesn’t see the server. Run
codex mcp list, or type/mcpinside Codex. If the server isn’t there, add it again. - The server is there, but its tools fail. Your sign-in may be missing or expired: run
codex mcp login <name>again. Without a browser on that machine, add--no-browserand open the printed link yourself. - The server takes too long to start. Raise
startup_timeout_secfor it inconfig.toml. - Added in the terminal, missing in ChatGPT on the web. That’s expected: the web version doesn’t read local Codex settings. The CLI, the IDE extension and the ChatGPT desktop app on the same computer do.
- Codex asks before every SSH command. That’s the approval mode at work. Keep it on for servers you care about.
Read next
Put it online today
Tell your AI “put it on BitHut”, then open the address it gives you.