October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Connect an MCP Server to Claude Code With claude mcp add

Connect a local or remote MCP server to Claude Code with claude mcp add, including transport forms, env variables, scopes, verification and security checks.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To connect an MCP server to Claude Code, run claude mcp add with a name you choose, followed by either the launch command for a local server or the URL of a remote one. For most servers that is a single line. The exact arguments depend on how the server runs, whether it needs credentials, and which scope you want it stored in, so start by identifying the server’s transport.

Choose the form that matches how the server runs

Anthropic’s Claude Code MCP documentation gives three basic forms. Pick the one that matches the server’s publisher instructions.

As an Amazon Associate I earn from qualifying purchases.

Transport Command shape Typical situation
Local stdio claude mcp add <name> <command> [args...] The server runs as a process on your machine, often started with npx
Remote HTTP claude mcp add --transport http <name> <url> The server is hosted and reached at an HTTP endpoint
Remote SSE claude mcp add --transport sse <name> <url> The server is hosted and uses the SSE transport

Add the server in four steps

  1. Identify the transport. If the publisher gives you a command to run, it is a local stdio server. If it gives you a URL, it is remote, and the publisher’s instructions will say whether it is HTTP or SSE.
  2. Run the matching form. For a local server, put Claude Code options such as --env before a -- separator, and put the server’s command and its own arguments after it. The separator stops Claude Code from reading the server’s flags as its own.
  3. Handle authentication. Remote servers that require headers can be configured with the --header option; check the guide for the exact value format. For a server that uses OAuth, start the sign-in from the /mcp command inside Claude Code.
  4. Confirm it was added. Run claude mcp list, or claude mcp get <name> to see one entry in detail.

Local server example

A local server with no credentials needs only its name and launch command:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
claude mcp add my-local-server -- npx -y some-mcp-package

If the server needs an API key, pass it with --env before the separator:

claude mcp add my-local-server --env API_KEY=YOUR_KEY -- npx -y some-mcp-package

The package name and the variable name depend on the server. Commands typed on the command line can end up in your shell history, so if that matters to you, keep the real key out of shared notes and check whether the server can read it from a setting you already manage on your machine.

Remote server example

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

This is a syntax illustration, not a working endpoint. Replace the name and URL with the values from the server publisher’s current documentation, and follow their authentication steps.

Choose a scope

Scope decides who can use the server and where its configuration is stored.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Scope Use it when Who gets the server Notes
local (default) The server is project-specific or uses credentials you do not want to share You, in the current project only Not shared with the team
project The whole team should use the same server setup Anyone who works in the project Saved in .mcp.json; Claude Code may ask for approval before using project-scope servers
user You want a personal utility available everywhere you work You, across all your projects Stored for your user account, not in the repository

If the same server name is defined at more than one scope, the order of precedence is local, then project, then user. Use distinct names when you want two configurations to coexist.

Verify, inspect and remove

  • claude mcp list shows the configured servers.
  • claude mcp get <name> shows one server’s details, which is the quickest way to check that a URL or command was stored as you typed it.
  • claude mcp remove <name> deletes the entry.
  • Inside Claude Code, /mcp manages remote authentication.

Troubleshooting

  • The server behaves as if it received the wrong flags. Check the position of --. Options for Claude Code belong before it, and the server’s own flags belong after it.
  • A local npx server fails on native Windows. Anthropic’s documentation notes that local npx commands may need a cmd /c wrapper on native Windows. This does not apply to WSL. Place the wrapper after the separator and confirm the exact form in the guide.
  • A remote server asks for sign-in or returns an authorization error. Open /mcp inside Claude Code for OAuth, or confirm that the required header is present if the publisher uses header-based credentials.
  • The server you expected is not the one that runs. Check for a same-name entry at a higher-precedence scope, using claude mcp list.

Security before you connect

Anthropic states that third-party MCP servers are used at your own risk and that it has not verified the correctness or security of every server. It specifically warns about prompt injection: a server that can retrieve untrusted content, such as web pages, tickets or messages, can pass instructions to the model that you did not write. Before adding a server, confirm who publishes it, read what it can access, and be cautious with servers that combine broad permissions with content from outside your control. Keep credentials out of project files that are committed to a shared repository.

What MCP is

MCP is the Model Context Protocol. Anthropic’s overview describes it this way: “MCP is an open protocol that standardizes how applications provide context to LLMs.” That standard is why one client can connect to many different servers, but it does not guarantee that any given server is safe or well maintained.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What is and is not established

  • Setup time. The title’s “2 minutes” is an editorial estimate. Anthropic’s documentation does not publish a measured setup time. The add step itself is one command once you have the launch command or URL; credentials, sign-in and approvals take extra time.
  • Version and date. The publication date of Anthropic’s Claude Code MCP guide and the Claude Code release it describes could not be confirmed when this article was written. Flag names and syntax can change between releases, so check claude --help and the current guide before you rely on a specific option.
  • Per-server details. Package names, environment variable names, header formats and OAuth steps are set by each server’s publisher, not by Claude Code.

For most servers, the working sequence is: confirm the transport, run the matching claude mcp add form, choose the scope, then check the result with claude mcp list.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.