How to Connect MCP Servers to Claude Code: Your First claude mcp add
"I get what MCP is, but how do I actually connect one from the terminal?"
Short version: it's one line. Type claude mcp add --transport http name address in your terminal, and an MCP server gets registered. Check that it connected with claude mcp list; remove it with claude mcp remove name. What used to be picking a connector on the web, this one command handles from the terminal instead. If last lesson had you ask Claude Code your first question and get an answer, today's the day you wire an outside service into that same session. Just here to check the claude mcp add syntax? This lesson alone covers that.
- claude mcp add
The command that registers one MCP (Model Context Protocol) server with Claude Code. Once registered, the server's address gets written to a config file, and Claude Code adds that server's tools to its own tool list. What's a screen for turning on a connector on the web becomes this one line in the terminal.
How is a web connector different from a CLI connection?
The underlying spec is the same. The connector you used to link Drive to Claude in the AI Connect track runs on MCP too. The official docs state that connectors in Anthropic's directory use the same MCP infrastructure as Claude Code. Only where you plug it in changes.
| Comparison | Claude on the web (connector) | Claude Code (terminal) |
|---|---|---|
| Where you connect it | Pick from a list on the connector screen | One line in the terminal: claude mcp add |
| Scope | Your whole account | Local by default, just the current folder; --scope user for everywhere |
| A service not in the list | Register the address as a custom connector | Same command, just swap in the address |
| Checking the connection | The connector screen | claude mcp list, or /mcp inside a session |
Here's a nice bit of news. You don't have to reconnect anything you've already set up on the web. If you're logged in with a claude.ai subscription account, connectors you added on the web come along automatically. Type /mcp inside a session and you'll see them in the list, tagged as coming from claude.ai.
You already have commands. Why do you need MCP too?
Here's a point that trips people up. Claude Code already has hands, even before you connect any MCP server. Read for opening files, Edit for changing them, Grep for searching content, Bash for running commands: these built-in tools are there from the start. When last lesson's "what's in this folder?" got an answer, that was these built-in tools at work. So why would you ever need MCP?
The split comes down to one thing. If the job ends on your own computer, the built-in tools are enough. That covers searching folders and editing files. If you need data or functionality that an outside service holds, that's when MCP comes in. Things like a Notion doc or a ticket in your issue tracker, nothing that lives on your hard disk. It's the difference between grabbing something off your own shelf and having to call the person in charge next door.
There's overlap too. GitHub is the clearest case. You can install the gh command-line tool and call it through Bash, or connect the GitHub MCP server the official docs cover. When both are available, Claude picks whichever fits the situation on its own. Want a specific server to handle it? Just name that server in your question. You can tell which path it took from the response, since MCP tools carry a mcp__servername__toolname tag.
Still not sure which is which? Use these four criteria.
| Criteria | Built-in tools (commands) | MCP connection |
|---|---|---|
| Setup | Built-in tools need nothing extra; an outside tool like gh needs installing | Requires registration, and sometimes login too |
| Authentication | Whatever that command-line tool's own login uses | Browser login, or a token via --header |
| Undoing it | Decide case by case at the permission prompt | Remove the registration with claude mcp remove |
| Session cost | None | Tool names and descriptions take up space every session |
That last row is a cost the official docs spell out directly. It's why "just connect everything" isn't the right instinct.
Hands-on: connecting one server with claude mcp add
All you need is Claude Code, installed and logged in. If you haven't done that yet, go through the Claude Code install lesson first.
Today's server is the Claude Code docs MCP server, the same one the official docs use as their first example. Three reasons it's a good pick: no signup or API key required, it's a remote server so nothing installs on your own computer, and all it does is search documentation, so there's no risk of breaking anything.
Step 1: Register the server
Type this in your terminal, not inside a claude session. It's a setup step you do before the conversation starts.
claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcpLet's break it down piece by piece.
claude mcp add, the command that registers a server.--transport httpmarks this as a remote server you reach by address, not a program running on your own computer. Short form:-t http, same thing.claude-code-docs, a name you make up yourself.docswould work exactly the same. It shows up as the tool tag in responses, and you'll use this same name to remove it later.- The last part is the address where the server is listening.
On success, you'll see a line reading Added HTTP MCP server claude-code-docs with URL: ... to local config, along with a File modified: line pointing to the config file that just changed.
Step 2: Check that it connected
Seeing Added doesn't mean it's actually connected. This command only saves the configuration; it doesn't check whether the address or credentials are correct.
claude mcp listThe status shows up right next to the name. If today's server reads something like claude-code-docs: ... (HTTP) - ✔ Connected, you're set.
| Status | Meaning |
|---|---|
✔ Connected | Ready to use right now |
! Connected · tools fetch failed | Connected, but couldn't fetch the tool list |
! Needs authentication | The server is alive; it needs a login or a token |
✘ Failed to connect | The server isn't responding |
✘ Connection error | The connection attempt itself errored out |
⏸ Pending approval | A project-scoped server waiting on approval |
On an older console like Windows 10's default one, you'll see √ instead of ✔ and × instead of ✘. Same meaning.
Step 3: Ask a question through the connected tool
Now open a session and try it out.
claudeType this into the input box.
Using the claude-code-docs server, find out what MCP_TIMEOUT doesIf a permission prompt shows up, approve it. Normally you don't need to name the server at all, since Claude picks the right tool on its own. The reason to name it here is to keep the answer from drifting off to a different tool, like a web search. If the tool call carries a claude-code-docs tag, that's your proof the answer came from the MCP server.
✔ Connected in claude mcp list, and the response's tool call carries the tag of the server name you just made up, today's deliverable is done.Step 4: Checking and removing
You'll use checking and removing about as often as registering.
claude mcp list # every registered server and its status
claude mcp get claude-code-docs # details for one server, including its saved scope
claude mcp remove claude-code-docs # unregister itInside a session, type /mcp. You'll see the list, and you can pick a server to reconnect or authenticate. If you just want to turn it off for a while, toggling it off from this screen stops the connection without losing the configuration. Once you're done with this exercise, I'd recommend removing it. Even a server you're not using takes up space every session.
Where does a registered server get stored?
Without any options, claude mcp add saves to local scope: visible only to you, and active only in the folder where you registered it. The official docs call this a scope, and there are three of them.
| Scope | Where it's stored | Where it's active |
|---|---|---|
| Local (default) | That project's entry inside ~/.claude.json | Just you, only in the folder you registered it |
| Project | .mcp.json in the project folder | Everyone on the team who gets that folder |
| User | The mcpServers entry in ~/.claude.json | Just you, in every folder |
If you're working solo, local and user are the only two you need to know. Add --scope user to keep the connection with you no matter which folder you move to.
claude mcp add --scope user --transport http claude-code-docs https://code.claude.com/docs/mcpThe scope is locked in the moment you register. Changing it means removing the server and registering it again. On Windows, ~/.claude.json usually maps to C:\Users\your-username\.claude.json. You'll probably never edit it by hand, but knowing where it lives gives you somewhere to look if a server goes missing.
Common problems
/mcpshows "No MCP servers configured." You probably registered it from a different folder. Local scope is tied to the folder you registered it in. Register it again from your current folder, or use--scope userinstead.- It's registered, but you're seeing
✘ Failed to connect. Suspect the address first.claude mcp listshows the error the server returned right after the status. If you typed a path that doesn't exist and got a 404 back, selecting that server inside/mcpshows aMCP endpoint not found at ...message. Check the address withclaude mcp get name, then remove and re-register it. - You're seeing "Connection timed out." The default startup wait is 30 seconds. Try extending it in milliseconds, like
MCP_TIMEOUT=60000 claude. On PowerShell, write it as$env:MCP_TIMEOUT = "60000"; claude. - A server run through
npxwon't come up. A server launched vianpxneeds Node.js 18 or later. The first run can look like a brief failure just from downloading the package, so wait a moment and runclaude mcp listagain. - It's connected, but there isn't a single tool. This happens when an environment variable the server needs, usually an API key, is missing. Register it again with
--env KEY=valueadded. - Registration itself is blocked on a work account. An admin has restricted which servers can be used. You'll see a message that spells out the policy directly, something like
Cannot add MCP server "name": not allowed by enterprise policy. This isn't something you did wrong, so reach out to whoever manages that policy.
One safety rule worth calling out. Don't connect just any server. The official docs state plainly that while Anthropic reviews connectors against directory-listing criteria, it doesn't security-audit individual MCP servers. The more a server pulls in outside content, the more risk there is of a hidden instruction slipping in through that content. Only connect to servers officially run by companies you trust.
I ran into the terminal side of this first. Back then I had no confidence I was doing it right. I didn't know whether a connection, once made, stayed made, or whether I had to redo it every time, and I had no way to check whether it had actually worked, so I'd just try something and assume it had worked if nothing broke.
That's why I put step 3 into this lesson. One habit, running claude mcp list right after connecting, gets rid of that uncertainty completely. I didn't even know that command existed for a long time, so I went without checking for far too long.
The first time a server that needed authentication popped a browser window open on its own, that surprised me too. It felt strange that one line typed into a terminal could open a browser. Looking back now, that's exactly where the approval step belongs, since a human needs to actually see it and click it.
Track complete: six steps out of the browser
Let's look back at the steps this track walked through. Check whether all six of the following are done. If any of them are missing, go back to that lesson.
- 1. The Claude lineup, picked the one product that fits your work.
- 2. Desktop app and local folders, connected a folder on your own computer inside the app.
- 3. First steps in the terminal, opened a terminal and typed three basic commands.
- 4. Installing Claude Code, saw
claudelaunch already logged in. - 5. First run, asked a first question and got an answer.
- 6. Today, registered a server with
claude mcp addand confirmed✔ Connected.
If you've made it this far, you're done stepping outside the browser. The terminal probably felt unfamiliar when you started this track; now you're asking AI questions from that same screen and wiring in outside services besides. The story of editing files directly and running commands continues in the Claude Code track.
- Type
claude mcp add --transport http name addressin your terminal and an MCP server gets registered. This one command replaces picking a connector on the web. - If you're logged in with a claude.ai subscription account, connectors you added on the web come along automatically. No need to reconnect them.
- Claude Code already has built-in tools for reading files, editing, and running commands, even without MCP. What stays on your own computer goes to the built-in tools; data an outside service holds goes to MCP.
- Seeing
Addeddoesn't mean it's actually connected. The registration command only saves configuration, so confirm✔ Connectedwithclaude mcp list. - There are three storage scopes: local, project, and user. Local is the default, active only in the folder you registered it in, and
--scope usermakes it available in every folder. - A connected server's tool list takes up space every session. Remove servers you're not using with
claude mcp remove name.
Frequently asked questions
How do I connect MCP to Claude Code?
Run it in your terminal as claude mcp add --transport http name address. For example, claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp registers the Claude Code docs server. Run it in your terminal, not inside a claude session, and after registering, check that the status reads Connected with claude mcp list.
When do I use --transport with claude mcp add?
Use --transport http for a remote server you reach by address. Leave it off and stdio, which launches a program on your own computer, is the default. If a server's docs say SSE, use --transport sse, but the official docs no longer recommend SSE, so use HTTP whenever it's available. For a server that launches a program, write the launch command after two dashes, like claude mcp add name -- launch-command.
Where should I look first when an MCP connection isn't working?
Start with claude mcp list to check the status. If it says No MCP servers configured, you probably registered it from a different folder, since the default local scope is tied to the folder you registered it in. For Failed to connect, check the address with claude mcp get name. For Needs authentication, open /mcp to authenticate. If you're hitting a timeout, extend the wait with MCP_TIMEOUT=60000 claude.
How do I delete a registered MCP server?
Run claude mcp remove name. If the same name exists in more than one scope, you'll see an exists in multiple scopes message; specify the scope, like claude mcp remove name --scope local. If you just want to turn it off for a while instead of deleting it, open /mcp inside a session and toggle it off. That stops the connection without losing the configuration.
Can I use connectors I added in web Claude inside Claude Code too?
Yes. If you're logged in with a claude.ai subscription account, connectors you added on claude.ai show up automatically. Type /mcp and you'll see them tagged as coming from claude.ai. This doesn't happen, though, if you're authenticating with an API key like ANTHROPIC_API_KEY or through a different provider like Amazon Bedrock. If they're not showing up in the list, check your authentication method with /status.
Sources (8)Expand to see all sources
- Claude Code Docs, "Connect to MCP servers": first server registration walkthrough, the six status indicators, legacy Windows console glyphs, the Node.js 18+ requirement, session context cost, troubleshooting (checked 2026-08-21)
- Claude Code Docs, "Connect Claude Code to tools via MCP": syntax per transport, the three scopes and where they're stored, automatic claude.ai connector sync, directory connectors sharing the same infrastructure, prompt-injection warning (checked 2026-08-21)
- Claude Code Docs (Korean edition): cross-checked official terminology for scope and transport (checked 2026-08-21)
- Claude Code Docs, "Tools reference": the built-in tools list (checked 2026-08-21)
- Claude Code Docs, "Configure permissions": the MCP tool naming convention (checked 2026-08-21)
- Claude Code Docs, "Control MCP server access for your organization": the policy-blocked error message, explicit statement that Anthropic doesn't security-audit individual servers (checked 2026-08-21)
- Model Context Protocol official docs, "What is MCP": definition of MCP (checked 2026-08-21)
- GitHub CLI official site: the gh command-line tool (checked 2026-08-21)