Get the free coreGet core

How to use MCP in Claude Code: commands, scopes and approvals

Updated 5 min readSection 05 / Threats
SHORT ANSWER

To use Claude Code MCP, add a server with claude mcp add, check it with claude mcp list or claude mcp get <name>, and take it out with claude mcp remove <name>. A URL in the command means a remote server, and a launch command means a program that runs on your machine. By default a new server loads only in the project where you added it. Verify that you trust each server before connecting it.

MCP means Model Context Protocol, an open-source standard for connecting AI applications to external systems. An MCP server is a program that exposes specific capabilities to AI applications such as Claude Code. If that is new, start with what is an MCP server.

01How to use Claude Code MCP: add a server

There are two kinds of command, depending on where the server runs. A remote one is reached by its web address. The documented example is:

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

claude mcp add is the command, --transport http tells Claude Code to reach the server over HTTP, notion is the name you give it, and the last part is the address.

A local one is started on your Mac by a launch command, and it can take an environment variable such as a key. This is the template from the docs, so replace the name example, the key and the package @example/mcp-server with the ones from the server's own instructions before you run it:

claude mcp add example --env API_KEY=your-key -- npx -y @example/mcp-server

The -- separates Claude's own options, such as --transport, --env and --scope, from the command and arguments that run the server. Everything after it is the launch command, a program that will run on your machine, so read it as carefully as you would read a script you were about to execute.

02Choose where it is stored

Each add command writes to the local scope unless you add --scope project or --scope user. A scope is the place a setting applies to. There are three:

ScopeCoversShared with othersStored in
Local (the default)The current projectNo~/.claude.json
ProjectThe current projectYes, through version control.mcp.json in the project root
UserAll your projectsNo~/.claude.json

For a server you are still testing, the default is the right place: it does not follow you into other projects and does not travel with the repository. A user-wide example from the docs is claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic.

03List servers and check them

To see what is configured, run this in your shell:

claude mcp list

The list shows a health status next to each server, such as Connected, Needs authentication or Failed to connect. For details of one entry, run claude mcp get <name>, which is also how you check that Claude Code connected to it. Inside a Claude Code session, /mcp checks server status. Anything on the list you do not recognize is worth tracing to whoever added it and to its scope. The same list is your first check after cloning a repository or after a teammate changes the project's config: if a name appears that you never added, find out which scope it came from before you start a session.

04Approve project servers with care

When a project's .mcp.json lists servers, Claude Code prompts for approval in interactive sessions before it uses them. An interactive session is one where you sit at the terminal and can answer. This matters when you clone a repository you do not know: a cloned repository cannot approve its own servers, and approvals committed to the project's .claude/settings.json are ignored in an untrusted folder.

One gap to know about. When Claude Code runs without a person at the keyboard, for example from a script with claude -p, it cannot show that prompt, so it loads project-scoped servers without asking. A session started in bypass mode can skip the prompt too. If you script Claude Code, read the project's .mcp.json yourself first.

If you said yes to something you now doubt, reset the choices:

claude mcp reset-project-choices

That resets the approval choices.

05Remove a server

To remove one:

claude mcp remove <name>

For a remote one, removing it also deletes the OAuth sign-in tokens and client registration Claude Code stored, but does not revoke the tokens at the service that issued them. To revoke them where that service supports it, run claude mcp logout <name> in your shell before claude mcp remove <name>.

06Block a server you do not want

If a project's .mcp.json brings a server you do not trust, add its name to disabledMcpjsonServers in your settings, which blocks it in every permission mode. To switch off one of your own servers in a project without deleting its configuration, toggle it off in the /mcp panel. Claude Code records that choice per project in ~/.claude.json, in the disabledMcpServers list, and does not connect to a server listed there.

07Decide whether to trust it first

This step comes before every command above, and it is the part of how to use Claude Code MCP that no command can do for you. Servers that fetch outside content can expose you to prompt injection. Anthropic reviews connectors against listing criteria before adding them to its directory, but does not security-audit or manage any MCP server. Ask three things: who wrote it, does it run on your Mac or at an address, and what can your agent do through it? A longer list is on MCP security, and a real case of a server that turned bad is on MCP tool poisoning.

Reading .mcp.json is a good habit but not the whole picture: it does not show everything a session can load. The sandbox does not cover MCP servers either; see Claude Code sandbox. Permission rules for the agent itself are on Claude Code permissions, and the broader view is on prompt injection in coding agents.

08How to use Claude Code MCP: the short version

Add one at a time and try it in a throwaway project first. Keep it in the default private scope while you test, read the launch command or address in full, and check the result with claude mcp list. Remove what you stop using, with claude mcp logout <name> first for a remote one.

If a project's .mcp.json starts something you did not expect, the free, open-source core of Artificial Immunity watches program starts on your Mac, including the ones a server launches, and reports what it finds.

FAQ

How to use Claude Code MCP safely?

Verify that you trust each server before connecting it, keep new ones in the default local scope, and answer the approval prompt for project servers as a real decision.

How do I add an MCP server to Claude Code?

Run claude mcp add with a name and an address, for example claude mcp add --transport http notion https://mcp.notion.com/mcp. For a local server, give it the launch command after --.

How do I list MCP servers in Claude Code?

Run claude mcp list in your shell. It shows a health status next to each server, such as Connected, Needs authentication or Failed to connect. Inside Claude Code, /mcp checks server status.

How do I check that Claude Code connected to a server?

Run claude mcp get <name>.

Does Claude Code ask before it uses a server from a project?

In interactive sessions, yes: it prompts for approval before using project-scoped servers from .mcp.json. In non-interactive runs and Agent SDK sessions it cannot show that prompt and loads them without asking.

How do I undo my approval choices for project servers?

Run claude mcp reset-project-choices.

How do I remove an MCP server from Claude Code?

Run claude mcp remove <name>. For a remote server, run claude mcp logout <name> first, so its sign-in tokens are revoked where the service supports it.

Sources

  1. Claude Code docs: MCP
  2. Claude Code docs: security
  3. MCP: getting started
  4. MCP: server concepts
  5. Artificial Immunity
A project can bring its own MCP servers. Artificial Immunity watches the Mac where your agents work.Get the free core