Dev blog · Guides · 2026-11-25 · updated 2026-11-26
How to install MCP servers on Linux (Claude Code, Codex, Cursor, Gemini CLI)
Installing an MCP server on Linux is mostly the same as on any other system: one command, or one entry in a config file. The trouble starts afterwards. A server that runs fine in your terminal fails silently in Cursor, or Codex can’t find npx even though you just used it.
Almost all of that comes from three Linux habits: Node installed through nvm, editors launched from the app menu, and Flatpak sandboxes. This guide covers the install for each agent, then those three problems.
The short version:
# Claude Code (every project)
claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp
# Codex
codex mcp add context7 -- npx -y @upstash/context7-mcp
# Gemini CLI
gemini mcp add --scope user context7 npx -y @upstash/context7-mcp
Cursor has no add command for servers, so you edit a file. That’s below.
What you need first
Local MCP servers are programs your agent starts. Most are Node packages (started with npx) or Python packages (started with uvx).
node --version # 18 or newer for most servers
uvx --version # only for Python servers
If Node is missing or old, the version in your distro’s repos may be too old for some servers. nvm or your distro’s NodeSource packages get you a current one. For uvx, install uv from astral.sh/uv.
Remote servers (a URL ending in /mcp) need none of this. They run on the publisher’s machines.
Where each agent reads its servers
| Agent | Every project | One project |
|---|---|---|
| Claude Code | ~/.claude.json |
.mcp.json in the repo |
| Codex | ~/.codex/config.toml |
.codex/config.toml in the repo |
| Cursor | ~/.cursor/mcp.json |
.cursor/mcp.json in the repo |
| GitHub Copilot (VS Code and CLI) | ~/.copilot/mcp-config.json |
.mcp.json in the repo |
| Gemini CLI | ~/.gemini/settings.json |
.gemini/settings.json in the repo |
Codex, Copilot and Gemini CLI only load the project file after you trust the folder. If a project server doesn’t show up, that’s the first thing to check.
Cursor: edit mcp.json
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
Save it as ~/.cursor/mcp.json, then open Cursor Settings → MCP and check the server’s dot turns green. Claude Code’s .mcp.json uses the same shape, so the same block works there.
Codex: edit config.toml
The codex mcp add command writes this for you, but if you’d rather edit by hand:
[mcp_servers.context7]
command = "npx"
args = ["-y", "@upstash/context7-mcp"]
TOML is stricter than it looks. A server name with a dot in it needs quotes ([mcp_servers."my.server"]), and a duplicate table header stops Codex from reading the whole file.
Gemini CLI: settings.json
gemini mcp add writes this for you. By hand, Gemini keeps servers under mcpServers in its main settings file, next to everything else it stores there. Add the same command and args block as Cursor’s, and leave the rest of the file alone. Run /mcp inside Gemini CLI to see whether it connected.
The server works in the terminal but not in the editor
This is the Linux problem. nvm adds Node to your PATH in ~/.bashrc or ~/.zshrc. Programs started from the app menu or the dock don’t read those files, so Cursor and VS Code look for npx, don’t find it, and the server never starts.
The fix that always works is the full path:
which npx
# /home/you/.nvm/versions/node/v24.11.0/bin/npx
"command": "/home/you/.nvm/versions/node/v24.11.0/bin/npx"
The catch: that path changes when you switch Node versions. Starting the editor from a terminal (cursor .) also works, because then it inherits your shell’s PATH.
Flatpak and Snap editors
The Flatpak builds of VS Code and some other editors run in a sandbox that can’t see programs installed on the host. A server command like npx fails even with the full path, because inside the sandbox that path doesn’t exist.
Either install the editor from its .deb or .rpm instead, or use remote servers, which don’t start anything locally. Terminal agents (Claude Code, Codex, Gemini CLI) aren’t affected.
Servers that run in Docker
Some servers start with docker run. If your user isn’t in the docker group, the agent can’t start them and usually doesn’t say why. Check with:
docker run --rm hello-world
If that needs sudo, the agent’s server will fail too.
Keep keys out of shared files
Config files under your home folder are readable by your user only on most distros, but check: ls -l ~/.claude.json. Project files (.mcp.json, .cursor/mcp.json) end up in git. Put API keys in your environment and reference them, the way the Claude Code and Codex guide shows.
The Calyban way
Calyban is a desktop app that does all of the above from one window, and since 1.3.1 it runs on Linux as an AppImage or a .deb. You pick a server, pick which agents get it, and it writes each agent’s file in that agent’s own format: JSON for Cursor, TOML for Codex, the right key in Gemini’s settings.
Before it writes anything, it shows you the change and runs a safety check on the server. Removing it later puts the file back exactly as it was, byte for byte, if nothing else touched it.
What can go wrong
- The server shows as failed. Run its command in a terminal first. If it fails there, it’s the server or a missing key, not the agent.
- It works in Claude Code but not Cursor. Almost always the
PATHproblem above. - Codex ignores the whole config. A TOML syntax error.
codex mcp listwill usually say where. - A project server never appears. The folder isn’t trusted yet in Codex, Copilot or Gemini CLI.
On Windows instead? The Windows guide covers the cmd /c fix and Windows paths. Questions about a specific server on a specific distro go on Discord. Calyban is free. If it saves you an afternoon, a coffee keeps it going.