Claude Code MCP: How to Add MCP Servers (Step by Step)

Maximin
Published
3 min read
3 min read

Key takeaways

  • MCP (Model Context Protocol) is an open standard that connects Claude Code to tools, databases, and APIs.
  • Add a remote server with claude mcp add --transport http <name> <url>.
  • Add a local server with claude mcp add <name> -- <command>. Everything after -- goes to the server.
  • Choose a scope: local (default, just you, this project), project (shared through .mcp.json), or user (all your projects).
  • Log in to servers that need it by typing /mcp inside Claude Code.
  • Only connect servers you trust: a server that reads outside content can expose you to prompt injection.

Connect Claude Code to your tools

The free guide covers the install and the settings that make Claude Code work for you.

Get the free guide

What is MCP in Claude Code?

MCP, the Model Context Protocol, is an open standard for connecting AI tools to the outside world. With an MCP server, Claude Code can read your Notion pages, look up errors in Sentry, query your database, or work in your project tracker, without you copying anything into the chat.

I added an MCP server to Echo, my social listening tool, so you can ask Claude or ChatGPT about your brand mentions. New to Claude Code? Start with how to install it, or follow the full Claude Code guide.

Claude connected to an outside app through a connector
Connecting Claude to your apps. From my Claude Code video.

How to add an MCP server to Claude Code

Remote server (HTTP)

Most services host their server online. This is the recommended way. For example, Notion:

Terminal
claude mcp add --transport http notion https://mcp.notion.com/mcp

If the server needs an API key, add a header: --header "Authorization: Bearer your-token". The older SSE transport is deprecated: use HTTP when the service offers it.

Local server (stdio)

Some servers run on your computer as a program. Everything after -- is the command that starts it, passed untouched. For example, Airtable with its API key:

Terminal
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
  -- npx -y airtable-mcp-server

MCP scopes: local, project, or user

ScopeWorks inShared with your teamSaved in
local (default)This projectNo~/.claude.json
projectThis projectYes, through git.mcp.json at the project root
userAll your projectsNo~/.claude.json
Add --scope to choose who can use the server.

With the project scope, Claude Code writes a .mcp.json file you can commit. Your teammates are asked to approve it the first time:

.mcp.json
{
  "mcpServers": {
    "shared-server": {
      "type": "http",
      "url": "https://example.com/mcp"
    }
  }
}

Don't put secrets in .mcp.json. Reference an environment variable instead, like ${API_KEY}, and each person sets their own.

Log in to an MCP server with /mcp

  1. Add the server, for example claude mcp add --transport http sentry https://mcp.sentry.dev/mcp.
  2. Start Claude Code and type /mcp.
  3. Pick the server and follow the browser sign-in.
  4. Ask Claude something that uses it: "What are the top errors in Sentry this week?"

Get the free Claude Code guide

The install and the 5 settings to know, step by step, with every prompt ready to copy.

Download the guide

Claude Code MCP commands

CommandWhat it does
claude mcp listLists your servers and their status
claude mcp get notionShows one server's details
claude mcp remove notionRemoves a server
claude mcp add-json <name> '<json>'Adds a server from a JSON config
/mcpChecks status and logs in, inside Claude Code
@server:resourceMentions a server's resource in your prompt
Manage your servers from the terminal or inside a session.

Claude Code warns you when a tool returns more than 10,000 tokens, and cuts it at 25,000 by default. Raise the limit with the MAX_MCP_OUTPUT_TOKENS environment variable.

Frequently asked questions

What is MCP in Claude Code?

MCP, the Model Context Protocol, is an open standard that connects Claude Code to outside tools, databases, and APIs through MCP servers.

How do I add an MCP server to Claude Code?

Run claude mcp add --transport http followed by a name and the server URL. For a local server, put its start command after two dashes.

Where are Claude Code MCP servers saved?

Local and user servers are saved in ~/.claude.json. Project servers are saved in .mcp.json at the project root, so you can share them with git.

Are MCP servers safe?

Only as safe as their maker. Connect servers you trust, and be careful with servers that read outside content, which can carry prompt injection.

About the author

Maximin

I’m a software engineer, and I help businesses and individuals turn their ideas into real projects with AI agents.

Connect Claude Code to your tools

Get the free guideSee the project

Ready to Build
Your Project?

Get complete source code from my public builds.
Explore a project, study it, and make it your own.

Browse projects