# How to install MCP servers on Windows (Claude Code, Codex, Cursor, Gemini CLI)

> Add MCP servers to Claude Code, Codex, Cursor and Gemini CLI on Windows: the cmd /c fix for npx, where each config file lives, and escaping Windows paths.

Published by Calyban (https://calyban.com/blog/install-mcp-servers-windows), 2026-11-26.

**Short answer:** on Windows, an MCP server started with `npx` needs to be launched through `cmd /c`, because `npx` is a `.cmd` script there, not a program. Write `"command": "cmd"` and put `/c`, `npx` and the rest in the arguments. Everything else works the same as on Mac or Linux.

That one detail is behind most "MCP server failed to start" reports on Windows. This guide covers the fix, where every agent keeps its config on Windows, and the path-escaping rules that trip up hand edits.

## Why does npx fail on Windows?

On Windows, `npx`, `npm`, `pnpm`, `bunx` and `yarn` are installed as `.cmd` shim files. A terminal runs them happily. An agent that starts a server directly, without a shell, can't, so the server never starts and the agent shows it as failed.

The fix is to launch the shell first and let it run `npx`:

```json
"context7": {
  "command": "cmd",
  "args": ["/c", "npx", "-y", "@upstash/context7-mcp"]
}
```

Claude Code's own documentation gives the same instruction for native Windows. Python servers started with `uvx` and hosted servers (a URL) don't need it.

## The short version, per agent

```powershell
# Claude Code (every project)
claude mcp add --scope user context7 -- cmd /c npx -y @upstash/context7-mcp

# Codex
codex mcp add context7 -- cmd /c npx -y @upstash/context7-mcp

# Gemini CLI
gemini mcp add --scope user context7 cmd /c npx -y @upstash/context7-mcp
```

Cursor has no add command, so you edit its file. Paths for every agent are below.

## Where each agent keeps its config on Windows

`%USERPROFILE%` is your home folder, usually `C:\Users\<you>`.

| Agent | Every project | One project |
|---|---|---|
| Claude Code | `%USERPROFILE%\.claude.json` | `.mcp.json` in the repo |
| Codex | `%USERPROFILE%\.codex\config.toml` | `.codex\config.toml` in the repo |
| Cursor | `%USERPROFILE%\.cursor\mcp.json` | `.cursor\mcp.json` in the repo |
| GitHub Copilot (VS Code and CLI) | `%USERPROFILE%\.copilot\mcp-config.json` | `.mcp.json` in the repo |
| Gemini CLI | `%USERPROFILE%\.gemini\settings.json` | `.gemini\settings.json` in the repo |
| Claude Desktop | `%APPDATA%\Claude\claude_desktop_config.json` | none |

One Windows-only twist: the Microsoft Store version of Claude Desktop keeps its config in `%LOCALAPPDATA%\Claude-Data\claude_<package id>\` and leaves `%APPDATA%\Claude` empty. If your edits seem to do nothing, check there.

## Writing Windows paths by hand

Paths are where hand-edited config files break.

**JSON** (Claude Code, Cursor, Copilot, Gemini CLI, Claude Desktop): every backslash must be doubled, or use forward slashes, which Windows accepts too.

```json
"args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\Users\\you\\projects"]
```

**TOML** (Codex): use single quotes, which take backslashes literally.

```toml
[mcp_servers.filesystem]
command = "cmd"
args = ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", 'C:\Users\you\projects']
```

## The Calyban way

[Calyban](/#download) is a free desktop app for Windows and Linux that writes all of this for you. Pick a server, pick your agents, and each one gets its own file in its own format, with the `cmd /c` wrapper added automatically for `npx`, `npm`, `pnpm`, `pnpx`, `bunx` and `yarn`, and every path escaped correctly. It finds the Store version of Claude Desktop's config on its own.

Every install runs a safety check first, and Undo puts each file back exactly as it was. [Measured: under 2 seconds from click to done](/blog/install-mcp-server-under-2-seconds).

## What can go wrong

- **"Failed to connect" right after adding a server.** Check the `cmd /c` wrapper first. Then run the same command in a terminal: if it fails there, it's the server or a missing API key.
- **The server works in PowerShell but not in the agent.** Same cause: the terminal finds `npx.cmd`, the agent doesn't.
- **Claude Desktop ignores your edit.** Fully quit it from the system tray, not just the window, and check you edited the right file (Store version above).
- **Codex stops reading its config.** A TOML syntax error, usually an unescaped backslash in a double-quoted path.

On Linux instead? [The Linux guide](/blog/install-mcp-servers-linux) covers its own problems. Questions about a specific server go on [Discord](https://discord.gg/pHDNtgYvWn). Calyban is free. If it saves you an afternoon, [a coffee](https://buymeacoffee.com/calyban) keeps it going.
