Claude Code Tutorial

How to set up Claude Code MCP in 2026

Claude Code MCP is worth setting up when you want Claude to work directly with tools like GitHub, Sentry, or databases instead of making you paste context into chat. The key is choosing the right scope, sharing .mcp.json only when the whole project should inherit it, and keeping secrets out of version control.

Updated April 19, 2026 Official docs checked April 19, 2026 Tutorial

Start with local scope unless the whole repository needs a shared server. Move to project scope only when teammates should inherit the same tool setup through .mcp.json. Use user scope for personal utilities you want in every project. If a server needs secrets, pass them through environment variables instead of hardcoding them into the repo.

This tutorial is the learn-layer bridge from the Claude Code review into real implementation. It stays practical on purpose and avoids turning MCP into a generic standards essay.

Quick Answer

Claude Code MCP setup is mostly a scope and trust decision.

The command syntax is not the hard part. The real decision is what stays personal, what becomes shared project infrastructure, and how to keep repo-level config safe enough for a team to inherit.

  • Use local scope first if you are testing whether one server solves a real workflow problem.
  • Use project scope only when the repository should carry the setup through .mcp.json.
  • Use user scope for personal utilities you want available across projects on your machine.
  • Keep secrets in environment variables, not in .mcp.json.
  • Prefer HTTP transport when the server supports it instead of old SSE examples.
  • Keep the shared config small enough that reviewers can still explain why each server exists.

If you are still deciding whether Claude Code fits your workflow, read the Claude Code review first. If the real decision is Claude-first workflow versus open control, branch to Claude Code vs Cline.

Scope Chooser

Choose the right scope before you add anything.

Most Claude Code MCP setup problems start with the wrong scope. Pick the storage and sharing model first, then add the server.

Scope Best use Shared with team Stored in
Local Current project, just for you No ~/.claude.json
Project Current project, for the whole repo Yes .mcp.json in the project root
User Your personal tools across projects No ~/.claude.json

Use local scope as the default safe choice

Local scope is the right default when you are testing a server, using a personal utility, or trying to keep credentials and experiments out of version control. If you are not sure, choose local first.

Use project scope when the repository should carry the setup

Project scope writes to .mcp.json in the repo root and should be treated like reviewable infrastructure. Good candidates are shared internal docs, approved company services, or repo-specific workflows every contributor should inherit.

Use user scope for personal utilities you want everywhere

User scope is private like local scope, but it follows you across projects. Use it when the tool is personal and cross-project rather than personal and repo-specific.

First Safe Setup

Start with one local-scoped server before you share anything.

The clean rollout path is simple: prove one server matters in local scope, then promote it only if the whole repository should inherit it.

  1. Add one server in local scope.
  2. Confirm it solves a real workflow problem instead of a hypothetical one.
  3. Move it to project scope only if the full team should share it.
  4. Keep secrets in environment variables instead of hardcoding them into the repo.
  5. Keep .mcp.json small enough that reviewers still understand it.

A low-risk first command looks like this:

claude mcp add --transport http stripe --scope local https://mcp.stripe.com

That keeps the config private to your machine, loads only in the current project, and gives you a clean way to prove the tool is useful before you ask teammates to inherit it.

Project Scope

Treat .mcp.json as shared infrastructure, not a scratchpad.

Once the repository should carry the setup, project scope becomes the right move, but it also changes the trust model because other contributors will inherit and review the file.

When the whole repository should use the same server, switch to project scope:

claude mcp add --transport http paypal --scope project https://mcp.paypal.com/mcp

Claude Code then creates or updates a project-root .mcp.json file. The healthy use case is short, explainable, and reviewable. The unhealthy use case is a dumping ground for personal experiments, machine-specific paths, and credentials that should never land in version control.

Keep this file boring on purpose:

  • Default to one or two shared servers, not ten.
  • Require a plain-language reason for every shared server.
  • Prefer HTTP transport when available.
  • Test locally before you move anything into project scope.

Approvals and Env Vars

Approval prompts and environment variables are part of the safe default.

Project-scoped servers trigger approvals because the repo can now change what Claude sees and can use. That friction is desirable because it forces an explicit trust step.

If a shared server depends on secrets or machine-specific values, use environment variable expansion instead of hardcoding them into .mcp.json. The documented patterns are ${VAR} and ${VAR:-default}, and expansion works in command paths, args, env values, URLs, and headers.

{
  "mcpServers": {
    "internal-api": {
      "type": "http",
      "url": "${API_BASE_URL:-https://api.example.com}/mcp",
      "headers": {
        "Authorization": "Bearer ${API_KEY}"
      }
    }
  }
}

Use /mcp inside Claude Code when a remote server requires OAuth. If the server needs an OAuth client secret, MCP_CLIENT_SECRET helps avoid typing it interactively. The other operational env vars worth knowing are MCP_TIMEOUT for slow startups and MAX_MCP_OUTPUT_TOKENS when responses get too large.

Common Mistakes

Avoid the setup mistakes that make team rollouts messy.

Most broken Claude Code MCP rollouts are not caused by missing commands. They come from over-scoping, secret leakage, or shared configs nobody can explain.

  • Using project scope too early before a server proves its value.
  • Treating .mcp.json like a secret store.
  • Adding too many servers before proving the workflow.
  • Forgetting that project-scoped servers trigger approvals.
  • Assuming every tool belongs at the project level.
  • Hardcoding machine-specific paths.
  • Using deprecated SSE examples when HTTP is available.

One practical edge case from the docs: if a required environment variable is missing and there is no default value, Claude Code can fail to parse the config. When a team says the setup is broken, check env var expansion before chasing stranger theories.

Wrong Next Step

Do not add MCP just because the feature exists.

MCP is the right next move only when the context gap is real. If the reader is still picking a tool or only needs ordinary code editing help, this is the wrong branch.

Skip setup for now if you are still deciding whether Claude Code fits your workflow at all, if you only need ordinary code editing help, or if your team has not agreed on which integrations belong at repo scope.

If the real question is tool choice rather than setup, branch back into the live cluster:

FAQ

Questions readers still ask before they wire Claude Code into real tools

The FAQ mirrors the tutorial verdict and provides the page's FAQ schema source.

What is MCP in Claude Code in plain English?

It is the system that lets Claude Code connect to outside tools and data sources, such as GitHub, Sentry, docs, or databases, so you stop pasting context into chat by hand.

Should I use local, project, or user scope for Claude Code MCP?

Use local scope for a private setup in the current project, project scope when the whole repo should share the configuration through .mcp.json, and user scope for personal tools you want across all projects.

What does .mcp.json do in Claude Code?

It stores project-scoped MCP server definitions in the project root so the configuration can be shared through version control.

Why does Claude Code ask for approval on project-scoped MCP servers?

Because project-scoped servers come from .mcp.json in the repo, and Claude Code requires explicit approval before using shared servers from version-controlled project config.

Can I put API keys in .mcp.json?

You should not. Use environment variable expansion instead so secrets stay out of version control.

What environment variable syntax works in .mcp.json?

The official docs show ${VAR} and ${VAR:-default}. Expansion works in command paths, args, env values, URLs, and headers.

What if my Claude Code MCP config will not parse?

One common cause is a required environment variable being missing with no default value. Check the variables your config references.

What command helps with authenticated remote MCP servers?

Use /mcp inside Claude Code to handle authentication flows for remote servers that require OAuth.

CTA

See whether Claude Code is the right tool first, then keep setup boring and safe.

Use this tutorial when the answer to Claude Code is already yes. If the real decision is still tool choice, go back to the live review and compare graph before you spread shared MCP config across a repo.

If you are deciding between terminal-first Claude workflows and a premium editor, read Cursor vs Claude Code. If you still need the shortlist, go back to the best AI coding tools roundup.

Explore Tools Compare