How-To/How to Set Up MCP Servers for Claude

How to Set Up MCP Servers for Claude

The Model Context Protocol (MCP) lets Claude reach beyond chat and use real tools: your filesystem, databases, GitHub, search, and custom internal services. By the end of this guide you will have at least one MCP server wired into Claude, verified that Claude can see its tools, and know how to debug it when something breaks. Anthropic created MCP, so support is first-class in both Claude Desktop and Claude Code.

Last updated: Jun 20, 2026

MCP is an open standard for connecting AI models to external tools and data. A server exposes capabilities (tools, resources, prompts); a client like Claude connects to that server and can call those capabilities mid-conversation. You run the servers, Claude consumes them. The setup is mostly editing one JSON config file and restarting the client.

Step 1: Decide where Claude will run

MCP works in two main places, and the config file differs. Pick the one that matches how you use Claude.

  • Claude Desktop: edit claude_desktop_config.json. On macOS it lives at ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows, %APPDATA%\Claude\claude_desktop_config.json.
  • Claude Code (the dedicated CLI): use the claude mcp add command, or edit the project .mcp.json file at the root of your repo so the server is shared with your team.
  • Both clients speak the same protocol, so a server you write works in either. Only the registration step changes.

Step 2: Install prerequisites

Most published MCP servers ship as Node or Python packages launched on demand. You do not pre-install them globally; the client launches them with a runner. Make sure the runner exists first.

  • Node.js 18+ if your server runs via npx (the most common case).
  • Python 3.10+ and uv (or pipx) if your server runs via uvx.
  • The actual server package itself usually does not need a manual install; npx and uvx fetch it on first run.

Step 3: Add your first server (the filesystem server)

The filesystem server is the best first test: it is official, it has no API keys, and you can instantly confirm Claude reads real files. In Claude Desktop, open Settings, go to Developer, and click Edit Config. Paste this, swapping in a real directory you are comfortable exposing.

{ "mcpServers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"] } } }

Save the file and fully quit and reopen Claude Desktop. The config is only read on startup, so a restart is mandatory.

Common mistake

A trailing comma or a missing brace in the JSON will make Claude Desktop silently skip the whole config, and no servers load. If your tools do not appear, run the file through a JSON validator before assuming the server is broken. Invalid JSON is the number one cause of a server that never shows up.

Step 4: Add a server in Claude Code

If you work in the terminal, Claude Code makes this a one-liner. The CLI registers the server and writes the config for you.

  • Run: claude mcp add filesystem npx -y @modelcontextprotocol/server-filesystem /Users/you/projects
  • Check it registered: claude mcp list
  • For a team-shared server, commit a .mcp.json at the repo root so everyone gets the same tools when they open the project.
  • Pass secrets as environment variables, not in the committed file. Use --env flags or reference an env var so keys never land in source control.

Step 5: Wire up a server that needs an API key

Most useful servers (GitHub, Slack, a database) need credentials. You supply them through an env block in the same config. Here is the shape for a server that reads a token from the environment.

{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "your_token_here" } } } }

Pro tip

Scope every token to the minimum it needs and treat the config file as a secret. An MCP server runs with whatever permissions its credentials grant, and Claude can call any tool the server exposes. For a database server, connect with a read-only role first. You can always widen access once you trust the workflow.

Step 6: Verify Claude can see the tools

Do not assume it worked. Confirm the connection before you build anything on top of it.

  • In Claude Desktop, look for the tools or connector indicator in the input area; it lists connected servers and their tool count.
  • In Claude Code, run claude mcp list and confirm the server shows a connected status, not failed.
  • Ask Claude a direct, tool-forcing question. For the filesystem server: 'List the files in my projects directory using your filesystem tools.'
  • If Claude answers from memory or says it cannot access files, the server did not connect. Go back to Step 3 and check the JSON and the restart.

Step 7: Match the model to the job

MCP gives Claude tools; the model determines how well it uses them. Start tool-heavy sessions on Sonnet 5, which is the default on Claude Free and Pro and is available in Claude Code and the API. Evaluate long autonomous runs and simple high-volume tool calls separately, and route only after each alternative meets your reliability and cost thresholds.

Step 8: Debug a server that will not connect

  • Validate the JSON. One stray comma stops every server from loading.
  • Confirm the runner is on PATH. Run npx --version or uvx --version in a fresh terminal; if the command is not found, Claude cannot launch the server either.
  • Fully restart the client. Editing config in a running Claude Desktop changes nothing until you quit and reopen.
  • Check the logs. Claude Desktop writes MCP logs you can open from the Developer settings; they show the exact launch error, usually a bad path or a missing dependency.
  • Use an absolute path. Relative paths in args are a frequent failure; spell out the full directory.
  • Test the server standalone. Run the same npx command in your terminal; if it crashes there, the problem is the server, not Claude.

Security note

Only install MCP servers you trust. A server can read whatever its credentials reach and can return content into Claude's context. Be cautious with community servers that touch sensitive systems, and never paste secrets into a config you plan to commit. Treat an MCP server like installing software with your account's permissions, because that is what it is.

THE CLAUDE INSIDER

Get the Claude playbook in your inbox.

One weekly email for Claude and Claude Code users. Real workflows, no hype. Subscribe and we send you The Claude Power-User Cheatsheet.

Frequently Asked Questions

RELATED