← All posts

How to add an MCP server to Claude Code: commands, scopes and sign-in

Add an MCP server to Claude Code with one claude mcp add line: remote HTTP or local stdio, which of the three scopes to pick, sharing it with a team in .mcp.json, and signing in with /mcp.

QueryScope team · · 7 min read · claude code mcp setup developers

You add an MCP server to Claude Code with one terminal command, claude mcp add. A remote server takes a name and a URL. A local server takes a name, a --, and the command that starts it. A scope flag decides who else gets it. Then you sign in with /mcp inside Claude Code if the server asks for an account.

The examples below use a real remote server, the Search Console one this site runs, and every flag is from Claude Code's own docs and its --help output.

TL;DR:

  • Remote server: claude mcp add --transport http <name> <url>. Leave out --transport http and the CLI treats the URL as a local command, because the transport defaults to stdio.
  • Local server: claude mcp add <name> -- <command> [args...]. Everything after -- goes to the server untouched.
  • Scope: local (the default, you in this project), project (everyone, through .mcp.json in the repo) or user (you, in every project).
  • Sign in: run /mcp in a Claude Code session to finish OAuth for servers that need it.
  • Check it: claude mcp list, claude mcp get <name>, and /mcp for live status.

How do you add a remote MCP server to Claude Code?

Give it a name and the server's URL, and say the transport is HTTP. Claude Code's docs call HTTP "the recommended option for connecting to remote MCP servers."

claude mcp add --transport http queryscope https://mcp.queryscope.dev/mcp

The flag matters more than it looks. claude mcp add --help lists -t, --transport <transport> as "Transport type (stdio, sse, http). Defaults to stdio." Without it, the CLI reads the URL as a program to run, and the server never connects.

If the server wants a key instead of a sign-in, pass it as a header:

claude mcp add --transport http my-api https://api.example.com/mcp \
  --header "Authorization: Bearer your-token"

Some older servers still use SSE. The docs say plainly that "The SSE (Server-Sent Events) transport is deprecated. Use HTTP servers instead, where available." Reach for --transport sse only when a server offers nothing else.

How do you add a local (stdio) server?

Put the command that starts the server after a double dash. Claude Code starts it as a process on your machine and talks to it over standard input and output.

claude mcp add my-server -e API_KEY=xxx -- node ./my-server.js

The docs explain the split: "the -- (double dash) separates Claude's own options, such as --transport, --env, and --scope, from the command and arguments that run the server. Everything after -- is passed to the server untouched."

One trap is in the same section. --env takes several KEY=value pairs, so "If the server name comes directly after --env, the CLI reads the name as another pair and rejects it." Put another option between them, or put -e after the name as in the example above.

Which scope should you pick?

Pick by who should have the server. claude mcp add --help describes the flag as -s, --scope <scope>, "Configuration scope (local, user, or project) (default: "local")". The docs define the three:

  • local: "available only to you in the current project". The default. Good for a server you are trying out.
  • project: "shared with everyone in the project via the .mcp.json file". Good for a server the whole team should have when they open the repo.
  • user: "available to you across all projects". Good for a server you use everywhere, such as a docs or issue tracker server.

A server like Search Console belongs to one site, so on a single repo local or project is the usual choice. If you run several sites, a user server that takes the site as a parameter on each call saves adding it once per repo. QueryScope works that way: every tool takes a site, and the agent reads it from the repo it has open.

When the same name is defined in more than one scope with different endpoints, the docs say Claude Code "warns about the conflict in claude mcp list output and in /mcp." Remove the copy you do not want with claude mcp remove <name> --scope <scope>.

Try it

Point an SEO agent at your own site, not just an essay about one.

QueryScope holds the plan for your site, reads your real Search Console, and hands the coding agent you already have one change at a time to rank for the searches you decided to win. From $49/month, everything included.

How do you share a server with your team in .mcp.json?

Add it with --scope project. Claude Code writes it to .mcp.json in the repo root, and you commit that file like any other config.

claude mcp add --transport http queryscope --scope project https://mcp.queryscope.dev/mcp

Two things follow from it being in the repo. Teammates are asked to approve a project server before Claude Code uses it, and an unapproved one shows as pending until they run claude and accept it. And nothing secret should go in the file. Keep keys in environment variables and refer to them, for example "Authorization": "Bearer ${API_KEY}", so the committed file holds the name of the key and not the key.

How do you sign in to a server that needs an account?

Start a Claude Code session and run /mcp. The docs: "Use /mcp to authenticate with remote servers that require OAuth 2.0 authentication." It opens your browser, you approve access, and the token is stored for that server.

For the Search Console server, that approval is Google's own consent screen. You grant read-only access (the webmasters.readonly scope) and pick which site the connection defaults to. You can revoke it from your Google account at any time. From a shell, claude mcp login <name> does the same, and claude mcp logout <name> clears it.

How do you check the server is connected?

Three commands, from the docs:

claude mcp list          # every configured server and its status
claude mcp get queryscope   # one server's details
claude mcp remove queryscope   # take it out again

Inside a session, /mcp shows each server's live status. A server that is listed but not connected is usually one of three things: a remote URL added without --transport http, a sign-in that was never finished, or a project server nobody approved yet.

The server is connected and the agent still ignores it

That is the most common report after a successful install, and it is not a bug. An MCP server is a list of tools the model may call, and it weighs them against everything else it knows. If it also knows an older habit, such as asking you for an export file, it may follow the habit. A short instruction in CLAUDE.md that names the server as the source for that kind of question fixes it, because an instruction in the repo outranks a tool description. Claude Code SEO walks through the case we hit ourselves.

Adding Search Console to Claude Code

The worked example above is the whole setup for QueryScope: one claude mcp add line, a read-only Google sign-in on the first call, and then you ask your agent about a search from the site's repo. Connect Search Console to Claude Code has the three steps, the CLAUDE.md rule to paste, and what the agent does on its first run. The same URL works in Cursor, Cline and Windsurf.

Sources

  • Claude Code docs, Connect Claude Code to tools via MCP (HTTP "the recommended option for connecting to remote MCP servers"; the -- separator and the --env ordering note; SSE "is deprecated"; the local, project and user scope descriptions; .mcp.json for project servers and their approval prompt; ${VAR} expansion; /mcp for OAuth; claude mcp list, get, remove, login and logout; the duplicate-scope warning).
  • claude mcp add --help, Claude Code CLI, read 2026-11-29 (--transport "Defaults to stdio"; --scope default local; -e, --env; -H, --header).

Try it

Put an SEO agent in your editor.

Ask your coding agent what to work on. QueryScope reads your real Search Console, holds the searches you decided to win, and hands back one move at a time with the proof it worked. From $49/month, everything included. 1, 3 or 10 sites.