Deepseek ArtifactsDeepseek Artifacts
MCP setup · 16 steps

Claude Code MCP Tutorial: Add Servers the Right Way

Connect Context7, Playwright or any MCP server to Claude Code — transports, scopes, the .mcp.json file, API keys and the /mcp panel, in one illustrated pass.

The short version

  • One command installs any server: claude mcp add name -- npx -y @scope/package for local servers, or claude mcp add --transport http name url for remote ones.
  • Three transports exist: stdio runs a command on your machine, SSE is the legacy remote form, and streamable HTTP is the modern remote option.
  • Three scopes decide who gets the server: local (just you), project (shared through .mcp.json) and user (all your projects).
  • Run /mcp inside a session to see status and tools; the first tool call asks for permission, and you can allow it once or always.

Claude Code Tutorial #7 - MCP Servers

Channel: The Net Ninja14:16

Watch on YouTube

Claude Code MCP: How to Add MCP Servers (Complete Guide)

Channel: Leon van Zyl17:58

Watch on YouTube

Model Context Protocol (MCP) — official Claude Code docs

Docs: code.claude.com/docs

Watch on YouTube

Screenshots come from The Net Ninja's chapter — a clean full-screen recording. The command breakdowns, scopes and Windows fixes follow Leon van Zyl's fuller walkthrough plus the official docs.

Frames belong to the respective creators and are credited here with deep links to the exact moments; the write-up is ours.

From zero to two working MCP servers

Part 1 · What MCP servers unlock

  1. 1

    See what MCP gives Claude Code

    Claude Code ships with built-in tools for files and shell, but everything outside your codebase is out of reach. MCP — the Model Context Protocol — is the Anthropic-standard way to plug in extra tools: a server exposes capabilities, and Claude Code calls them like any built-in tool.

    Course slide defining MCP, the Model Context Protocol Anthropic designed so Claude Code can interact with external data sources, services and APIs
    The course slide that defines MCP in one line.Watch at 0:52
  2. 2

    Pick servers that match the work

    Each server carries its own tools. The Supabase server can list tables, deploy edge functions and run SQL; Playwright drives a real browser; Context7 serves up-to-date framework docs. Start with the one that removes your most repeated chore.

    MCP servers diagram showing the Supabase MCP server giving Claude Code tools like list_tables, deploy_edge_function and execute_sql against a Supabase project
    The Supabase example: three tools, one external service.Watch at 1:24
  3. 3

    Find the install command in the server README

    Server authors publish a ready-made Claude Code command in their README — Context7 and Playwright both do. Directories like PulseMCP make it easy to browse what exists before you commit to anything.

    Playwright MCP server README listing its key features such as fast and lightweight browser automation with accessibility-tree input instead of screenshots
    The Playwright MCP README documents features and requirements.Watch at 2:02
  4. 4

    Know the three transport types

    The official docs split installs into local and remote. A stdio server runs a command on your machine — that is the default. SSE and HTTP servers are remote endpoints you connect to; SSE is legacy and streamable HTTP is its replacement. The claude mcp add syntax differs slightly for each.

    Official Claude Code documentation Installing MCP servers page comparing Option 1 local stdio servers with Option 2 and Option 3 remote SSE and HTTP servers
    The docs page comparing local stdio with remote SSE and HTTP.Watch at 3:02

Part 2 · Add your first server

  1. 5

    Add Context7 with project scope

    From the terminal: claude mcp add context7 --scope project -- npx -y @upstash/context7-mcp. The name is yours to choose, everything after the double dash is the command to run, and --scope project writes the server into the shared project config instead of your personal one.

    Windows PowerShell terminal running claude mcp add context7 --scope project -- npx -y @upstash/context7-mcp to register the Context7 docs server
    The exact add command for the Context7 docs server.Watch at 5:22
  2. 6

    Read the .mcp.json it created

    Project-scope servers land in a .mcp.json file at the repo root under the mcpServers key. Each entry records the type — stdio here — plus the command and its arguments: the same shape Cursor or Claude Desktop use.

    VS Code editor showing the mcpServers block inside a project .mcp.json file with type stdio, the cmd command and the Context7 npm package arguments
    Inside .mcp.json: type, command and args for the stdio server.Watch at 6:42
  3. 7

    Windows users: mind the cmd /c prefix

    On native Windows without WSL, stdio commands need cmd /c before npx so the shell closes cleanly after the server runs. The docs call this out in a warning box, and the walkthrough shows the exact edit.

    Claude Code documentation warning box telling Windows users to prefix MCP stdio commands with cmd /c so npx-based servers close the shell cleanly
    The official warning box for Windows stdio servers.Watch at 3:24
  4. 8

    Confirm the file landed in your repo

    After a project-scope add, .mcp.json shows up in the explorer as a new untracked file, ready to commit so teammates get the same servers. Local-scope servers never touch this file.

    VS Code explorer highlighting a new .mcp.json at the project root next to CLAUDE.md after Claude Code wrote the MCP server configuration to disk
    A new .mcp.json at the project root, untracked and ready to commit.Watch at 8:32
  5. 9

    Prefer remote? Use the HTTP transport

    When a stdio build misbehaves, the remote endpoint is the quick escape hatch: claude mcp add --transport http context7 --scope project https://mcp.context7.com/mcp. No local process and no npm — Claude Code talks to the URL directly.

    PowerShell terminal typing claude mcp add --transport http context7 --scope project https://mcp.context7.com/mcp to connect the remote Context7 endpoint
    The HTTP variant of the add command against the Context7 endpoint.Watch at 8:36
  6. 10

    Check the connection in /mcp

    Start Claude Code and run /mcp. Each server shows its status and tool list. A failed entry is usually fixed by the built-in reconnect; when it is not, the troubleshooting section below covers the common causes.

    Claude Code /mcp panel reporting context7 connected with a green tick after a reconnect, listing the resolve-library-id and get-library-docs tools
    The /mcp panel showing context7 connected with its two tools.Watch at 9:22

Part 3 · Use servers in real work

  1. 11

    Call the server from a real prompt

    Ask for something the built-in tools cannot do and name the server: check the latest Tailwind docs against my global CSS file — use context7. Attaching the file with an @ mention keeps the answer grounded in your code.

    Claude Code prompt asking to check the latest Tailwind docs for theme variables in the global CSS file, explicitly telling the agent to use context7 with globals.css attached
    The prompt that requests current Tailwind docs via context7.Watch at 9:38
  2. 12

    Approve the tool call

    The first time a server tool runs, Claude Code asks permission. Approve once, or pick the always-allow option for servers you trust so later calls skip the prompt.

    Claude Code permission card asking to run the Context7 resolve-library-id MCP tool for Tailwind CSS v4 with yes and always-allow options
    The permission card for Context7's resolve-library-id tool.Watch at 10:00
  3. 13

    Read the grounded answer

    The tool returns the relevant docs — the Tailwind v4 theme-variable guidance here — with the token cost shown, and Claude Code applies it to your file. That is the whole point: answers from current documentation instead of training-data guesses.

    Context7 get-library-docs tool response confirming Tailwind CSS v4 theme variables are properly structured, with code snippets and a token usage count
    The get-library-docs response confirming the theme setup.Watch at 10:15
  4. 14

    Pin the habit in CLAUDE.md

    Type the hash symbol to add a project memory such as: use Context7 for up-to-date docs when implementing new libraries or frameworks. The line lands in CLAUDE.md and every later session inherits it.

    CLAUDE.md project memory gaining the line use Context7 to check up-to-date docs when implementing new libraries or frameworks
    A one-line CLAUDE.md memory that makes Context7 the default.Watch at 10:42
  5. 15

    Add a second server: Playwright

    Repeat the pattern for browser automation: claude mcp add playwright --scope project -- cmd /c npx @playwright/mcp@latest — and drop the cmd /c part on macOS or Linux. One repo, several servers, one config file.

    Windows terminal adding the Playwright MCP server with claude mcp add playwright --scope project -- cmd /c npx @playwright/mcp@latest
    Adding the Playwright MCP server with project scope.Watch at 11:22
  6. 16

    Watch it drive the browser

    Ask Claude Code to open a page and summarize it — Playwright navigates, clicks and reads, then reports back. Between Context7's docs and Playwright's browser, most external chores are now one prompt away.

    Claude Code session where the Playwright MCP navigates to netninja.dev and returns a structured summary of the site content
    The Playwright MCP navigating to a site for a summary.Watch at 12:42

Env vars, headers and API keys

Remote servers and authenticated APIs need credentials. Claude Code takes them as environment variables on stdio servers and headers on remote ones — no config file editing required.

  • 1Stdio servers: claude mcp add myserver -e API_KEY=your-key -e ZONE=your-zone -- npx -y @some/mcp-server — repeat the -e flag for each variable, placing the flags right after the server name.
  • 2Remote HTTP servers: claude mcp add --transport http myserver https://example.com/mcp --header "Authorization: Bearer your-key" — the header is sent with every tool call.
  • 3Scope refresher: local keeps the server for you in this project, project shares it through .mcp.json, and user installs it across all your projects. Set it with -s or --scope when adding.
  • 4Removing a server: claude mcp remove name — for project scope, commit the .mcp.json change so teammates stop receiving the server too.

Values passed with -e are stored in plain text inside the config file. Prefer narrowly-scoped keys where the API allows it, and never commit real credentials in a project-scope .mcp.json.

When /mcp shows failed

Most MCP failures on Claude Code trace back to a handful of roots. Work down this list before you delete and re-add anything.

  • 1Unknown option -y on Windows: some terminals choke on the npm flag. Run the add command from PowerShell or Command Prompt, or drop -y, add the server, then put -y back into the args array in .mcp.json by hand.
  • 2Native Windows stdio fails: prefix the command with cmd /c — for example cmd /c npx -y @some/package@latest. Without WSL this is required, and the @latest tag avoids stale cached builds.
  • 3Status shows failed: open /mcp and reconnect — transient failures usually clear on the second attempt. If not, the panel shows the server's log location for the real error.
  • 4Server missing in another project: that is scoping working as designed. Project-scope servers live in that repository's .mcp.json; switch to user scope for a machine-wide install.
  • 5Server connects but is never used: name it in the prompt — use context7 to check the docs — or add a CLAUDE.md memory, because models reach for familiar built-in tools unless told otherwise.

When everything else fails: claude mcp remove name, restart the terminal, and add the server again with the transport you know works — the remote HTTP variant is the most predictable.

Claude Code MCP FAQ

Related Claude Code guides