In this categoryClaude Code · 45
- How to Install Claude Code on macOSStart
- How to Install Claude Code on Windows Natively (No WSL)
- How to Install Claude Code on Windows with WSL
- How to Start Your First Project with Claude Code
- How to Create a CLAUDE.md File for Your Project
- How to Configure Claude Code with settings.json
- How to Layer Global, Project, and Local CLAUDE.md Files
- How to Set Up a Permissions Allowlist in Claude Code
- How to Use Claude Code Inside VS Code
- How to Add a Custom Slash Command in Claude Code
- How to Create a Custom Slash Command in Claude Code
- How to Pass Arguments to a Claude Code Slash Command
- How to Use Claude Code Slash Commands (Full List + Examples)
- How to Add Custom Slash Commands to Claude Code (Arguments + Frontmatter)
- How to Fix command not found After Installing Claude Code
- How to Add Any MCP Server to Claude Code
- How to Connect an MCP Server to Claude Code
- Best MCP Servers for Coding in 2026
- How to Add a Filesystem MCP Server to Claude Code
- How to Connect the GitHub MCP Server to Claude Code
- How to Create Your First Subagent in Claude Code
- Context7 Alternatives: MCP Servers for Up-to-Date Docs
- How to Manage MCP Server Scopes in Claude Code
- How to Restrict the Tools a Subagent Can Use
- How to Debug a Failing MCP Server in Claude Code
- How to Generate Unit Tests for a Function with Claude Code
- How to Refactor a Long Function Safely with Claude Code
- How to Debug a Failing Test with Claude Code
- How to Review Your Own Diff Before Committing with Claude Code
- How to Rename a Symbol Across the Codebase with Claude Code
- How to Review a Teammate's Pull Request with Claude Code
- How to Raise Test Coverage on a Specific File with Claude Code
- How to Debug a Runtime Error from a Stack Trace with Claude Code
- How to Add an Integration Test for an API Route with Claude Code
- How to Teach Claude Code Your Test Conventions with CLAUDE.md
- How to Find Which Commit Broke a Test with Claude Code
- How to Set Up Hooks for Automation in Claude Code
- Claude Code Hooks Explained: Events, Config, and Blocking
- How to Block Risky Commands with a Claude Code Hook
- How to Auto-Format Files After Edits with a PostToolUse Hook
- How to Get a Notification When Claude Code Finishes a Task
- How to Give a Coding Agent a Clear Stop Condition
- How to Make an Agent Plan Before It Edits
- How to Keep an Agent Session Focused by Clearing Context
- How to Pin a Specific Model for One Project
How to Add Any MCP Server to Claude Code
Learn the claude mcp add command, the difference between stdio and remote servers, where the config lives, and how to verify a server with /mcp.
The Model Context Protocol (MCP) is an open standard that lets Claude Code talk to external tools through a small server, so the agent can read a database, drive a browser, or pull live docs. Once a server is added, its tools show up automatically. This guide covers the one command you need, the two kinds of server, where the config is stored, and how to confirm everything connected.
What you need
- Claude Code installed and signed in
- The command or URL for the MCP server you want to add
- Any token that server needs, ready to pass as an environment variable or header
- About 10 minutes
Step 1: Know the two kinds of server
Every MCP server connects over a transport. A stdio server is a local process Claude Code launches itself, usually through npx or uvx. A remote server already runs somewhere and you connect to it over HTTP (the current standard) or SSE (older, now deprecated). The transport decides the shape of the command.
| Transport | What it is | How you add it |
|---|---|---|
| stdio | A local process Claude Code spawns | claude mcp add <name> -- <command> |
| http | A remote server over streamable HTTP | claude mcp add --transport http <name> <url> |
| sse | A remote server over SSE (deprecated) | claude mcp add --transport sse <name> <url> |
Step 2: Add a stdio server
Use claude mcp add with a name, then a double dash, then the command that starts the server. The double dash is required: it separates Claude's own flags from the server's command so the rest passes through untouched. Pass any secret with --env so it is stored in config rather than typed into chat.
Step 3: Add a remote HTTP or SSE server
For a hosted server you give a URL instead of a command. Set the transport to http and pass any auth as a header. Many hosted servers use OAuth instead, in which case you run /mcp inside a session to sign in.
# token in a header
claude mcp add --transport http context7 https://mcp.context7.com/mcp \
--header "CONTEXT7_API_KEY: your-key-here"
# OAuth server: add it, then run /mcp in a session to authenticate
claude mcp add --transport http github https://api.githubcopilot.com/mcp/Step 4: Choose a scope
Where a server is saved decides who sees it. The default is local (just you, just this project). Use project to share a server with your team through a committed .mcp.json file, or user to make it available across all of your own projects.
| Scope | Flag | Stored in | Shared with team? |
|---|---|---|---|
| Local (default) | --scope local | ~/.claude.json (per project) | No |
| Project | --scope project | .mcp.json in the repo root | Yes, commit it |
| User | --scope user | ~/.claude.json (global) | No, but all your projects |
Step 5: Or edit .mcp.json by hand
Project-scoped servers live in a .mcp.json file at the repo root. You can write it directly instead of using the CLI. Use ${VAR} so secrets come from the environment rather than sitting in the file.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
},
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": { "CONTEXT7_API_KEY": "${CONTEXT7_API_KEY}" }
}
}
}Step 6: Verify the connection
List your servers to confirm each one is connected, then start a session and run /mcp to see the tools it exposes. A failed status almost always means a wrong command, a missing binary, or a bad credential.
Result: you can wire any MCP server into Claude Code with one command, pick the right scope, and confirm it connected before you rely on it. Adding the next server is the same three steps.
Related guides
Best MCP Servers for Coding in 2026
A short, verified list of the MCP servers worth adding to Claude Code for real coding work, with what each one does and the exact command to install it.
Context7 Alternatives: MCP Servers for Up-to-Date Docs
What Context7 does, when you might want something else, and the real MCP servers that keep Claude Code reading current documentation instead of stale guesses.
Watch related tutorials
12:05
33:14
18:47
1:42:18
28:14
41:09New guides in your inbox
Fresh step-by-step how-to guides as we publish them. One email a week, no more.