Skip to main content
The Model Context Protocol (MCP) lets Claude Code use tools beyond its built-in set, such as searching an issue tracker, querying a database, or controlling a web browser. These tools come from MCP servers, which run on your machine or as hosted services. This guide walks you through connecting one MCP server end to end with the Claude Code CLI. By the end, you’ll have a server connected and responding, know where its configuration lives on disk, and know how to fix the most common connection errors.
You can also add MCP servers from other surfaces, including the desktop app, VS Code, and the web. See Connect from other surfaces.
For every way to connect and configure MCP servers in Claude Code, see the MCP reference.

Before you begin

Make sure you have:
  • Claude Code installed and authenticated
  • A terminal open in a project directory. Any directory works, including an empty one.

Add and verify a server

The example below connects to the Claude Code documentation MCP server, a hosted server with full-text search over the Claude Code docs. It doesn’t require authentication or any special configuration, so it works well as a first server to test the setup flow with. The steps are the same for any server: add it, check the connection status, then use it in a session, with an optional cleanup step at the end. Some servers add a step, like a browser sign-in, shown in Additional MCP server examples. For more servers to connect, browse the Anthropic Directory.
1

Add the MCP server

Register the server with Claude Code. Run this in your terminal, not inside a claude session: you’re configuring the server before starting a conversation.
The parts of the command:
  • claude mcp add: registers a server with Claude Code.
  • --transport http: the server is hosted at a URL rather than run as a local process.
  • claude-code-docs: a name you make up. Calling the same server docs would work identically. Claude Code uses whatever name you pick to label the server’s tools in Claude’s output and to refer to the server in commands like claude mcp remove.
  • https://code.claude.com/docs/mcp: the URL where the server is hosted.
The command prints a confirmation like Added HTTP MCP server claude-code-docs with URL: https://code.claude.com/docs/mcp to local config, followed by a File modified: line showing the configuration file it wrote. The local config part means the server is registered to you, in this project: if you start Claude Code in a different project, this server isn’t active there. To register a server once for all your projects, add it at user scope, covered in Change server scope.
2

Check the connection status

Confirm the server appears in your server list and check its status:
The server appears with a status indicator:Some legacy Windows consoles, such as the default console on Windows 10, don’t support these Unicode glyphs and show and × in place of and .
3

Use the server

Start a session and ask Claude to use the new server by name:
You don’t normally need to name a server in your prompt, since Claude chooses relevant tools on its own. Naming it here guarantees the demonstration goes through the new server rather than another tool, such as web fetch, that could answer the same question.
If Claude Code asks for permission the first time Claude calls the server, approve it. The tool call in Claude’s output is labeled with the server name, which is how you confirm the answer came from the MCP server rather than Claude’s built-in knowledge.
4

Remove the server

This step is optional. When you’re done experimenting, you can remove the server:
The command confirms with Removed MCP server "claude-code-docs" from local config and a File modified: line showing the file it updated.
Each connected server takes some space in Claude’s context window because its tool names and server instructions load into every session. Removing servers you no longer use keeps that space free.

Where servers are saved

The claude mcp add command writes the server’s details to a configuration file. By default it registers the server at local scope: private to you, active only in the current project. Pass --scope user to register it once for all your projects, or --scope project to share it with teammates. Change server scope walks through both.
claude mcp add works the same in every shell, including PowerShell and Command Prompt. Inside a claude session, use the /mcp command to check and manage servers you’ve already added.
There are other ways to add a server, each covered later on this page: