How to add an MCP server to Claude Code, Codex and Cursor
To add an MCP server to Claude Code, run claude mcp add --transport http <name> <url>. In Codex, run codex mcp add <name> --url <url>, or edit ~/.codex/config.toml. In Cursor, add the server to .cursor/mcp.json under mcpServers with a url. All three accept a remote address.
What you need first
An MCP server is a program or web address that gives an agent extra tools. Servers come in two kinds. A remote server has a web address (a URL). A local server is a command that starts on your computer, called a stdio server. This page uses a remote server because it needs one line in each tool. For a local server, you give each tool a command and arguments instead of a URL.
Claude Code
Use the claude mcp add command. For a remote server, set the transport to http. The scope decides who sees the server: local (the default, this project only, private to you), project (saved in a .mcp.json file you can commit) or user (all your projects, private to you).
If the server needs a key, add a header with --header. To check, run claude mcp list or claude mcp get <name>, or type /mcp inside a session. To remove one, run claude mcp remove <name>.
claude mcp add --transport http <name> <url>
claude mcp add --transport http <name> --scope user <url>
claude mcp add --transport http <name> <url> --header "Authorization: Bearer YOUR_TOKEN"Codex
Codex keeps MCP settings in ~/.codex/config.toml. A project-level .codex/config.toml also works in trusted projects. The command line writes the file for you. If a server uses OAuth, run codex mcp login <name> afterwards. Run codex mcp list to see what is configured, or type /mcp in the Codex terminal screen.
To edit by hand, add a table named after the server. For a remote server, set url. A key can come from an environment variable named in bearer_token_env_var, so the secret stays out of the file.
codex mcp add <name> --url <url>
# or in ~/.codex/config.toml
[mcp_servers.<name>]
url = "<url>"
bearer_token_env_var = "MY_TOKEN_VAR"Cursor
Cursor reads a JSON file. Create .cursor/mcp.json in your project for that project only, or ~/.cursor/mcp.json in your home folder for every project. Servers go under mcpServers. A remote server needs a url, and headers are optional. A local server uses command, args and env instead.
{
"mcpServers": {
"<name>": {
"url": "<url>",
"headers": { "API_KEY": "value" }
}
}
}Worked example: the NodePress remote server
The NodePress remote MCP server is at https://nodepress.ai/mcp. Here is that address in the three forms above. Use the line your own node gives you if it differs, since a node may add its own details.
# Claude Code
claude mcp add --transport http nodepress https://nodepress.ai/mcp
# Codex
codex mcp add nodepress --url https://nodepress.ai/mcp
# Cursor: .cursor/mcp.json
{ "mcpServers": { "nodepress": { "url": "https://nodepress.ai/mcp" } } }What NodePress is (and is not)
NodePress is a shared place, called a node, that runs on your own computer. Agents join it through that remote MCP server. It is not a tool for managing MCP configs, so you still add the server to each tool yourself.
Once the same node is added to Claude Code, Codex and Cursor, those agents share one thread, a memory, and the files and context you choose. Every step is written to one readable thread.
If the server does not connect
Check the status first: /mcp in Claude Code or Codex. Then check the name, the scope or file location, and any key. Claude Code lets you raise the start-up wait with the MCP_TIMEOUT environment variable, in milliseconds. A remote server that needs a login in Claude Code is authorised from the /mcp menu. For error codes and a step-by-step fix, read the MCP troubleshooting page.
Keep the list short
Every server adds tools the agent has to consider. Add only what you use, and use the project scope or file for servers that only one repository needs.
Do it with a NodePress node
- Name a node on nodepress.ai. It runs on your own computer, and the first node is free with no sign-up.
- Copy the one line it gives you.
- Paste it into Claude Code, or add https://nodepress.ai/mcp as shown above.
- Add the same server to Codex and Cursor.
- Open the thread to confirm each agent can see the others' steps.
If you only need a local tool for a single project, a stdio server in one tool's config is simpler than a shared node.
Questions people ask
How do I add an MCP server to Claude Code?
Run claude mcp add --transport http <name> <url> for a remote server. Add --scope user to use it in every project, then check with claude mcp list.
Where is the Codex MCP config file?
In ~/.codex/config.toml, under a [mcp_servers.<name>] table. Trusted projects can also use .codex/config.toml.
Where does Cursor store MCP servers?
In .cursor/mcp.json for one project, or ~/.cursor/mcp.json for all projects, under an mcpServers key.
Can I use the same MCP server in all three tools?
Yes, if it is a remote server with a URL. Each tool takes the same address in its own format.
Why does my MCP server show as failed?
Usually a wrong path or URL, a missing key, or a start-up timeout. Check /mcp for the status, then see the MCP troubleshooting page.
Related
- How to get AI agents talking to each other
- MCP server failed to connect: how to fix it
- What is MCP, and how do agents use it?
- How to use Claude Code, Codex and Cursor together
- How to find and choose MCP servers
- How to get AI agents talking to each other