Skip to content
Rate AI Agent
Open menu

How to add MCP servers to Claude Code

26 Oct 2026 · Rate AI Agent

MCP servers give a coding agent new abilities: drive a browser, read your issue tracker, query a database or fetch current library docs. Claude Code manages them from the terminal with one command. This guide covers adding a server, choosing where its configuration lives, checking that it works, and removing it again.

Before you start

  • Claude Code installed and signed in.
  • For local servers distributed through npm, Node.js on your machine (many servers start with npx).
  • Any account or API token the server needs, such as a GitHub token for a GitHub server.

If MCP is new to you, read what MCP is and how it works first. It takes five minutes and makes the rest of this guide easier to follow.

Add a local server

A local server runs as a process on your machine and talks to Claude Code over standard input and output. You give it a name, then the command that starts it after a double dash. For example, to add Playwright MCP for browser automation:

claude mcp add playwright -- npx @playwright/mcp@latest

Everything after -- is the server's own command and arguments, so flags meant for the server go there, not before it. If the server needs a secret, pass it as an environment variable with -e (for example -e API_KEY=...) rather than pasting it into a shared file.

Add a remote server

Some publishers host their server for you, so nothing runs locally. These use HTTP instead of standard input and output. Add them with the transport flag and the server's URL, which the publisher documents:

claude mcp add --transport http my-server https://example.com/mcp

Remote servers that need an account usually sign you in through the browser the first time you use them. Inside a Claude Code session, the /mcp command shows each server's status and starts that sign-in.

Choose a scope

The scope decides who gets the server and where its configuration is saved:

  • Local (the default): only you, only in the current project. Good for experiments and for servers that hold personal credentials.
  • Project (--scope project): saved to a .mcp.json file in the repository, so everyone who clones it gets the same servers. Claude Code asks each person to approve a project server before it runs. Keep secrets out of this file.
  • User (--scope user): you, in every project on this machine. Good for general tools such as a docs server.

Check that it works

  1. Run claude mcp list to see every configured server and whether it connects.
  2. Start Claude Code and type /mcp to see live status and the tools each server exposes.
  3. Ask for something only the server can do, such as “open example.com and tell me the page title” for Playwright. Claude Code asks permission before calling a new tool.

To remove a server, run claude mcp remove <name>.

Common problems

  • The server fails to start. Run its command on its own in a terminal. Missing Node.js, a typo in the package name or a missing environment variable shows up straight away.
  • Flags in the wrong place. Options for Claude Code go before --; options for the server go after it.
  • Too many tools. Every server adds tool descriptions to the agent's context. Add the servers a project actually needs rather than everything you can find.
  • Trusting unknown servers. A server can read whatever its tools reach. Prefer official servers from the service's own publisher, and read what a server does before adding it.

Commands and flags change between releases, so check claude mcp --help and the official documentation if anything here doesn't match your version.

Which servers to try first

Our tools directory lists MCP servers with what they connect to, which clients they work with and community ratings. Popular starting points for coding work include the GitHub MCP server, Context7 for current library docs and Chrome DevTools MCP for debugging pages.