MCP Server Generator
Guide · Claude Desktop, Cursor, Claude Code, VS Code, Windsurf

Connect an MCP Server to Claude Desktop, Cursor, Claude Code, and VS Code

Claude Desktop, Cursor, Claude Code, VS Code, and Windsurf all launch a local MCP server from a JSON entry: a command plus args, spoken to over stdio. File names differ (claude_desktop_config.json, mcp.json, .mcp.json, mcp_config.json), and VS Code uses a top-level servers key instead of mcpServers. To skip hand-editing, the MCP config generator writes and validates the right shape for each host. Use absolute paths to the interpreter and entry file, reload the host, and your tools appear.

Steps

  1. Install the server's dependencies

    In the unzipped folder run npm install (TypeScript) or create a venv and pip install -r requirements.txt (Python).

  2. Test it outside the host

    Run npx @modelcontextprotocol/inspector npm start (or python server.py) and call a tool once.

  3. Write the mcpServers entry with absolute paths

    Point command at the project's tsx binary or venv Python and pass the absolute path to src/index.ts or server.py.

  4. Add it to the host config

    Claude Desktop: Settings → Developer → Edit Config. Cursor: ~/.cursor/mcp.json or .cursor/mcp.json. Claude Code: .mcp.json in the project root. VS Code: .vscode/mcp.json. Windsurf: ~/.codeium/windsurf/mcp_config.json.

  5. Restart the host and call a tool

    Fully quit and reopen Claude Desktop, reload in Cursor / Windsurf, start a new Claude Code session (then /mcp), or run MCP: List Servers in VS Code, then ask for something that needs your tool.

Don't have a server yet? Generate one with MCP Server Generator in TypeScript or Python (or start on Python with the Python MCP server generator); the examples below use its default weather-helper project. If your API already has a spec, the OpenAPI to MCP converter produces a server with the same config shape (form vs OpenAPI: which to use), and building an MCP server for an internal API covers tokens in the env block. New to the protocol? What is an MCP server explains what the host does with this entry.

Config that works for Claude Desktop, Cursor, Claude Code, and Windsurf

Replace /Users/you/mcp/weather-helper with your folder. Get it with pwd (macOS/Linux) or cd (Windows) inside the project. Paste this under mcpServers for those four hosts. For VS Code, use the servers + type example in the VS Code section below (or convert with the MCP config generator).

TypeScript project (after npm install)

{
  "mcpServers": {
    "weather-helper": {
      "command": "/Users/you/mcp/weather-helper/node_modules/.bin/tsx",
      "args": ["/Users/you/mcp/weather-helper/src/index.ts"]
    }
  }
}

Python project (after creating .venv and pip install)

{
  "mcpServers": {
    "weather-helper": {
      "command": "/Users/you/mcp/weather-helper/.venv/bin/python",
      "args": ["/Users/you/mcp/weather-helper/server.py"]
    }
  }
}

On Windows use node_modules\.bin\tsx.cmd and .venv\Scripts\python.exe, and write each \ as \\ inside JSON strings. Pointing at the venv's Python matters: a bare "python" may resolve to a system interpreter that does not have mcp installed.

Alternatives in the generated README

The README in every generated ZIP uses the absolute-path configs above (no cwd, which some Claude Desktop builds ignore) and adds one alternative per language:

TypeScript, compiled (after npm run build)

{
  "mcpServers": {
    "weather-helper": {
      "command": "node",
      "args": ["/Users/you/mcp/weather-helper/dist/index.js"]
    }
  }
}

Python with uv (no manual venv; uv installs mcp from pyproject.toml on first run)

{
  "mcpServers": {
    "weather-helper": {
      "command": "uv",
      "args": ["run", "--directory", "/Users/you/mcp/weather-helper", "server.py"]
    }
  }
}

If the host can't find node or uv, replace them with absolute paths from which node / which uv.

Claude Desktop specifics

  • File: macOS ~/Library/Application Support/Claude/claude_desktop_config.json, Windows %APPDATA%\Claude\claude_desktop_config.json. Settings → Developer → Edit Config opens it.
  • Restart: quit the app completely (not just the window) so it re-reads the file.
  • Logs: macOS ~/Library/Logs/Claude/mcp*.log, Windows %APPDATA%\Claude\logs. A server's stderr ends up here, including the generator's “running on stdio” line.

Cursor specifics

  • Global: ~/.cursor/mcp.json makes the server available in every project.
  • Per project: .cursor/mcp.json in the repo root; commit it only if the paths make sense for teammates.
  • Status: the MCP section of Cursor Settings lists each server, whether it started, and its tools. Toggle it off and on after editing the file.

Claude Code specifics

  • File: project-scope .mcp.json in the project root (team-shared). Personal local/user scope lives in ~/.claude.json instead — not under .claude/. Same top-level mcpServers shape as Claude Desktop and Cursor for local stdio servers.
  • Example (TypeScript, absolute paths):
{
  "mcpServers": {
    "weather-helper": {
      "command": "/Users/you/mcp/weather-helper/node_modules/.bin/tsx",
      "args": ["/Users/you/mcp/weather-helper/src/index.ts"]
    }
  }
}
  • Reload: start a new Claude Code session in that project, approve the server when prompted, then run /mcp to confirm tools.
  • Common failures: putting the file outside the project root; expecting a global Desktop-style path; remote URL entries without "type": "http" (those are skipped). For generate/validate across hosts, use the MCP config generator.

VS Code specifics

  • File: workspace .vscode/mcp.json, or the user profile via the command palette MCP: Open User Configuration.
  • Shape: top-level servers (not mcpServers), and each entry needs "type": "stdio" for a local command. Copying a Cursor file without converting the key is the most common silent miss.
  • Example:
{
  "servers": {
    "weather-helper": {
      "type": "stdio",
      "command": "/Users/you/mcp/weather-helper/node_modules/.bin/tsx",
      "args": ["/Users/you/mcp/weather-helper/src/index.ts"]
    }
  }
}
  • Reload: run MCP: List Servers and start the server, or use the Start code lens above the entry in mcp.json.
  • Common failures: using mcpServers instead of servers; omitting type; relying on comments/trailing commas that work in VS Code but break when the same file is pasted into Cursor. Convert with the config generator.

Windsurf specifics

  • File: macOS/Linux ~/.codeium/windsurf/mcp_config.json; Windows %USERPROFILE%\.codeium\windsurf\mcp_config.json.
  • Shape: top-level mcpServers for local stdio (same command/args style as Cursor). Remote entries use serverUrl (Windsurf also accepts url).
  • Example:
{
  "mcpServers": {
    "weather-helper": {
      "command": "/Users/you/mcp/weather-helper/node_modules/.bin/tsx",
      "args": ["/Users/you/mcp/weather-helper/src/index.ts"]
    }
  }
}
  • Reload: open Cascade's MCP panel and press Refresh after saving the file.
  • Common failures: editing a project mcp.json that Windsurf does not read; wrong path under .codeium/windsurf/; invalid JSON. Validate and rewrite with the MCP config generator.

Using Codex instead? Codex (CLI, IDE extension and the ChatGPT desktop app) reads TOML from ~/.codex/config.toml, not JSON: each server is a [mcp_servers.<name>] table with the same command and args. Convert an mcp.json entry with the Codex config.toml generator, or run codex mcp add <name> -- <command>, then check it with /mcp.

Troubleshooting

SymptomLikely cause and fix
No servers load at allInvalid JSON. One trailing comma disables the whole file; run it through a JSON validator.
spawn npx ENOENT / command not foundThe app does not see your shell PATH. Use the absolute path to tsx, node or the venv Python (which node).
Server starts, then disconnectsSomething printed to stdout. Log with console.error or print(..., file=sys.stderr).
ModuleNotFoundError: mcpcommand points at a Python without the package. Use .venv/bin/python.
Tools listed but never usedVague descriptions. Say what the tool does and when to use it; mention it by name in your prompt to test. The MCP tool schema generator checks names, descriptions and inputSchema.
Works in Cursor, blank in VS CodeWrong top-level key. Convert mcpServers → servers and add "type": "stdio" on each entry.
Claude Code ignores the serverFile must be .mcp.json in the project you opened; start a new session and approve, then /mcp.
Windsurf does not see editsEdit ~/.codeium/windsurf/mcp_config.json (not a project mcp.json), then Refresh in Cascade's MCP panel.

Before you debug the host, check the server on its own: if it lists and calls its tools in the MCP Inspector, the problem is in the config. How to test an MCP server shows the Inspector CLI commands and a raw stdout probe.

Need a server to connect?

Generate a TypeScript or Python MCP server from a form; the README includes the mcpServers entry.

FAQ

Where is claude_desktop_config.json?

On macOS it is ~/Library/Application Support/Claude/claude_desktop_config.json and on Windows %APPDATA%\Claude\claude_desktop_config.json. In Claude Desktop, Settings > Developer > Edit Config opens it.

Where does Cursor read MCP servers from?

From ~/.cursor/mcp.json for servers available in every project, or .cursor/mcp.json inside a project for that project only. Both use the same mcpServers format as Claude Desktop.

Why use absolute paths instead of cwd?

Desktop apps start servers from their own working directory and do not load your shell PATH, and some Claude Desktop builds ignore the cwd field. Absolute paths to the interpreter and the entry file work either way.

My server does not appear. What should I check first?

Validate the JSON (a trailing comma breaks the whole file), confirm the command path exists, fully restart the host, then read the host's MCP log. On macOS Claude Desktop writes ~/Library/Logs/Claude/mcp*.log.

Can I use the same server in both Claude Desktop and Cursor?

Yes. Paste the same mcpServers entry into both config files; each host launches its own copy of the process over stdio. Claude Code .mcp.json uses the same mcpServers shape for local stdio; VS Code needs the servers + type shape instead.

Where is Claude Code .mcp.json located?

For project scope: .mcp.json in the project root (not inside .claude/). Personal local/user scope is stored in ~/.claude.json. Start a new session in that project, approve the server, then run /mcp.

Where is VS Code mcp.json, and why doesn't a Cursor file work there?

Workspace file: .vscode/mcp.json (or MCP: Open User Configuration for the user profile). VS Code uses a top-level servers object and a type on each entry; Cursor uses mcpServers. Copying one into the other usually fails silently until you convert the shape — the MCP config generator does that rewrite.

Where is the Windsurf MCP config file?

macOS and Linux: ~/.codeium/windsurf/mcp_config.json. Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json. After editing, press Refresh in Cascade's MCP panel.

How do I connect an MCP server to Claude Code?

Add an mcpServers entry with absolute command and args paths to .mcp.json in the project root, start a new Claude Code session, approve the server, and run /mcp. Use the MCP config generator if you want the file written or checked for you.