How to Add & Configure MCP in Cursor: Complete mcp.json Setup Guide [2026]
Learn how to connect any Model Context Protocol server to Cursor IDE, fix common mcp.json syntax errors, and automate tool injection using the 1-click AIStoreHub CLI.
A complete step-by-step handbook for locating and configuring Model Context Protocol servers in Anthropic Claude Desktop on Windows (%APPDATA%\Claude) and macOS without crashing your client.
Anthropic's Claude Desktop allows developers to attach Model Context Protocol (MCP) servers to local frontier models, enabling autonomous file management, database queries, and API orchestration. However, manual setup requires navigating hidden OS directories (~/Library/Application Support/Claude on macOS, %APPDATA%\Claude on Windows), and non-login shells frequently trigger spawn ENOENT path failures. This guide provides exact JSON schemas, fixes common environment variable mistakes, and shows how to automate configuration with AIStoreHub CLI.
$ aihub mcp install community/postgres-mcp --client cursorpip install aistorehubCLI DocsAnthropic's release of the Model Context Protocol (MCP) transformed Claude Desktop from a passive conversational chat window into an autonomous developer command center.
With MCP servers enabled, Claude Desktop can read and write files directly to your local file system, run queries against local PostgreSQL and SQLite databases, inspect GitHub repositories, and execute API calls—all without copy-pasting raw text back and forth.
However, configuring Claude Desktop manually remains a notorious pain point. Because Claude Desktop runs as a GUI application, it does not inherit your interactive shell's $PATH or environment variables, leading to cryptic errors like spawn npx ENOENT or silent client boot crashes when a JSON comma is misplaced.
In this guide, we break down the exact configuration schema, pinpoint config file locations across operating systems, solve the top 4 Claude MCP runtime errors, and demonstrate how to automate your entire setup with zero JSON editing.
Registry Fast-Track: Skip manual JSON debugging. Explore the AIStoreHub MCP Server Catalog to discover, test, and 1-click install 250+ verified MCP servers for Claude Desktop, Cursor, and Windsurf.
Claude Desktop stores all registered server configurations in a single JSON file named claude_desktop_config.json.
By default, this file resides in hidden system directories depending on your operating system:
| Operating System | Exact File Location | Quick Terminal Shortcut |
|---|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json | open ~/Library/Application Support/Claude |
| Windows | %APPDATA%\Claude\claude_desktop_config.json | explorer %APPDATA%\Claude |
| Linux (Proton / Wine) | ~/.config/Claude/claude_desktop_config.json | xdg-open ~/.config/Claude |
Pro Tip: If this file does not exist yet in your Claude directory, you must create it manually as valid JSON, or let an automated tool like AIStoreHub CLI generate it for you.
Claude Desktop expects a top-level object containing a mcpServers dictionary. Each key in this dictionary represents a unique server name, and its value defines the command, execution arguments, and optional environment variables.
Here is a production-ready configuration containing a local SQLite database server and the official GitHub tool:
json{ "mcpServers": { "sqlite-analytics": { "command": "uvx", "args": [ "mcp-server-sqlite", "--db-path", "/Users/username/data/analytics.db" ] }, "github-tools": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-github" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_personal_access_token_here" } } } }
./data.db or ~/data.db) fail because Claude Desktop's working directory is the application root, not your user home. Always provide absolute paths."C:\\Users\\username\\data.db" or forward slashes "C:/Users/username/data.db".The single most common bug reported by Claude Desktop users is:
textError: spawn npx ENOENT at Process.ChildProcess._handle.onexit (node:internal/child_process:286:19)
When you open Terminal or iTerm, your shell profile (.zshrc or .bash_profile) loads NVM, Homebrew, or fnm into your $PATH.
However, when you launch Claude Desktop by clicking its desktop or dock icon, macOS/Windows launches it with a minimalist system $PATH (typically /usr/bin:/bin:/usr/sbin:/sbin). Because /opt/homebrew/bin or your NVM Node directory is omitted, Claude cannot find the npx or uvx executable.
Find the absolute path to your executable in your terminal:
bash# On macOS / Linux which npx # Returns: /opt/homebrew/bin/npx (or ~/.nvm/versions/node/v20.x/bin/npx) which uvx # Returns: ~/.cargo/bin/uvx
Then update your claude_desktop_config.json to reference the absolute binary:
json{ "mcpServers": { "filesystem": { "command": "/opt/homebrew/bin/npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Desktop" ] } } }
Many MCP servers (like GitHub, Brave Search, Postgres, and Linear) require API keys or database connection strings.
Inside claude_desktop_config.json, supply them under the env key:
json{ "mcpServers": { "postgres-db": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "postgresql://postgres:secretpassword@localhost:5432/production" ], "env": { "DEBUG": "mcp:*" } }, "brave-search": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-brave-search" ], "env": { "BRAVE_API_KEY": "BSA_your_brave_api_token" } } } }
Security Warning: Because claude_desktop_config.json is stored in plaintext on your disk, never commit this file to public git repositories or share raw screenshots of your config screen.
Here are the top 4 essential servers tested for stability with Claude Desktop:
Editing nested JSON files manually and resolving binary paths is fragile.
The open-source AIStoreHub CLI (pip install aistorehub) automates Claude Desktop configuration with a single command:
bash# 1. Install the CLI pip install aistorehub # 2. Inject verified MCP server directly into Claude Desktop aihub mcp install community/postgres-mcp --client claude # 3. View all active servers in Claude aihub list --client claude
npx and uvx to their absolute system binary paths to prevent spawn ENOENT crashes.claude_desktop_config.backup-<timestamp>.json) before modifying a single line.Explore hundreds of verified MCP servers, community tools, and autonomous agents in the AIStoreHub Registry.
Verified packages installable directly via terminal into Cursor, Claude Desktop, and Python runtimes.
Inspect schema, explain queries, and generate zero-downtime migrations in Cursor.
Autonomous prospecting, cold emails, and meeting booking with zero API token bills.
Scan charts, calculate risk/reward brackets, and backtest setups via Claude Code.
Essential clarifications for developers and engineering teams building and operating AI systems.
AIStoreHub is the open registry and 1-click CLI for discovering, running, and installing production-grade AI systems, Model Context Protocol (MCP) servers, and autonomous agents.
Continue learning how to build, monetize, and operate AI systems effectively.
Learn how to connect any Model Context Protocol server to Cursor IDE, fix common mcp.json syntax errors, and automate tool injection using the 1-click AIStoreHub CLI.
Learn how Model Context Protocol (MCP) bridges frontier models with local developer environments. Complete setup instructions for Claude Desktop, Cursor, and Windsurf with 1-click CLI installation.
Discover the top 10 essential open-source Model Context Protocol (MCP) servers in 2026 for database querying, browser automation, Git intelligence, and memory retention.