How to Use MCP Servers in Claude Code
MCP servers let Claude Code connect to GitHub, databases, Slack, and hundreds of other tools. Set them up once and control everything through plain English conversation.
MCP servers connect Claude Code to external tools like GitHub, databases, Slack, and the web. You set them up by adding a few lines to your settings file or running an install command, and then Claude can access those tools through plain conversation. No coding required on your end.
This guide walks you through everything: what MCP is, which servers are most useful, and exactly how to install and configure them, even if you have never touched a terminal before.
What Is MCP (Model Context Protocol)?
MCP stands for Model Context Protocol. It's an open standard created by Anthropic that lets AI tools connect to external systems in a secure, standardized way.
Think of it like this: your phone can connect to thousands of different Bluetooth devices because they all speak the same protocol. MCP does the same thing for AI tools—it creates a common language so Claude Code can talk to hundreds of different services.
Without MCP: Claude Code works with files on your computer. That's it.
With MCP: Claude Code can access your GitHub repos, query databases, send Slack messages, browse the web, read Google Drive documents, and more—all through natural conversation.
Good news for non-technical users: You don't need to understand how MCP works under the hood. You just need to run a few commands to connect the servers you want. Then you interact with them using plain English.
Popular MCP Servers and What They Do
There are hundreds of pre-built MCP servers available, with new ones being added regularly. Here are the most useful ones:
| Server | What It Does | Transport |
|---|---|---|
| Filesystem | Read and write files in specific folders. Useful for giving Claude access to your Documents folder. | stdio |
| GitHub | Create repos, manage pull requests, review code, and work with issues. | HTTP |
| Postgres / MySQL | Query your databases directly. Claude can read data and run SQL queries. | stdio |
| Slack | Send messages, read channels, and interact with your workspace. | stdio |
| Notion | Read and update pages, databases, and knowledge bases. | HTTP |
| Sentry | Monitor errors, view stack traces, debug production issues. | HTTP |
| Google Drive | Access documents, spreadsheets, and files stored in Drive. | stdio |
| Puppeteer / Playwright | Browser automation, take screenshots, and interact with websites. | stdio |
| Stripe / PayPal | Manage payments, view transactions, handle disputes. | HTTP |
| Context7 | Access up-to-date documentation for any programming library. | stdio |
Anthropic maintains a live registry of compatible MCP servers at code.claude.com/docs/en/mcp.
How to Add Your First MCP Server
MCP servers can be added using three transport types: HTTP (for remote cloud services, recommended), SSE (for older remote servers), and stdio (for local processes). Let's start with a local example and then a remote one.
Example 1: Add a Local Filesystem Server (stdio)
Step 1: Open Terminal
On Mac, press Cmd+Space, type "Terminal", and press Enter. On Windows, search for "Command Prompt" or "PowerShell".
Step 2: Add the Filesystem Server
Copy and paste this command, then press Enter:
claude mcp add --transport stdio --scope user filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/Documents ~/Desktop
This tells Claude Code to add a local server called "filesystem" that can access your Documents and Desktop folders.
Step 3: Verify It Worked
Run this command to see all your connected servers:
claude mcp list
You should see "filesystem" in the list.
Step 4: Test It Out
Start Claude Code and try asking: "What files are in my Documents folder?" Claude will use the filesystem server to look at your files and respond.
What does each part of the command mean?
claude mcp add = add a new server
--transport stdio = runs as a local process
--scope user = available in all your projects
filesystem = the name you're giving it
-- = separates Claude's options from the server command
npx -y @modelcontextprotocol/server-filesystem = the actual server to run
~/Documents ~/Desktop = folders Claude can access
Example 2: Add a Remote HTTP Server (Notion)
Many cloud services now offer MCP servers over HTTP. These are even simpler to add:
claude mcp add --transport http notion https://mcp.notion.com/mcp
After adding, run /mcp inside Claude Code to authenticate with your Notion account through OAuth. No API tokens to manage manually.
HTTP vs stdio: HTTP servers connect to remote cloud services and often support OAuth authentication. Stdio servers run locally on your machine for tools that need direct system access. Use HTTP when available — it is the recommended transport for cloud-based services.
Setting Up the GitHub MCP Server
This is one of the most powerful integrations. Once set up, Claude can create repositories, review pull requests, manage issues, and more.
Step 1: Add the GitHub Server via HTTP
The recommended approach uses the HTTP transport with OAuth authentication:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
Step 2: Authenticate
Start Claude Code and run /mcp. Select "Authenticate" for GitHub and follow the browser login flow. Claude Code handles OAuth tokens automatically — no personal access tokens needed.
Step 3: Use It
Now you can ask Claude things like:
- "Show me open pull requests in my project repo"
- "Create a new issue for the login bug"
- "Review PR #456 and suggest improvements"
Alternative: Use a personal access token
If OAuth does not work for your setup, create a token at github.com/settings/tokens and use the stdio transport instead: claude mcp add --transport stdio --env GITHUB_TOKEN=your_token_here github -- npx -y @modelcontextprotocol/server-github
Setting Up a Database Connection
If you work with databases, this is incredibly useful. Claude can query your data and help you analyze it.
# For PostgreSQL
claude mcp add --transport stdio --scope user db -- npx -y @bytebase/dbhub \
--dsn "postgresql://user:password@localhost:5432/mydb"
# Alternative using the older server
claude mcp add --transport stdio --scope user postgres -- npx -y @modelcontextprotocol/server-postgres \
postgresql://user:password@localhost:5432/mydb
Security note: Never connect MCP servers to production databases with write access. Use read-only connections or connect to development/staging databases only.
Managing Your MCP Servers
Here are the essential commands for managing servers:
claude mcp list
Show all configured MCP servers and their status.
claude mcp get [name]
Test if a specific server is working. Shows connection details and any errors.
claude mcp remove [name]
Disconnect a server you no longer need.
Configuration File Locations
MCP servers can be configured at different levels:
| Scope | Location | Use Case |
|---|---|---|
| Local (default) | ~/.claude.json (under project path) |
Personal servers, private to you, for the current project only |
| Project | .mcp.json (in project root) |
Team-shared servers, checked into git so all collaborators get the same tools |
| User | ~/.claude.json |
Available across all your projects, personal utilities |
When you use --scope user in the add command, the server is saved to your user-level config and available everywhere. Use --scope project to save it in .mcp.json for the team. The default scope is local (private to you, current project only).
The .mcp.json file supports environment variable expansion using ${VAR} syntax, so teams can share configurations while each developer supplies their own API keys.
Real Use Cases for Non-Technical Users
Marketing Manager: Content from Anywhere
Connect Google Drive and Slack. Ask Claude to "pull the Q4 marketing report from Drive and summarize it, then post the summary to the #marketing channel."
Data Analyst: Natural Language Queries
Connect your database. Ask "Show me the top 10 customers by revenue this month" and Claude writes the SQL, runs it, and presents the results in a readable format.
Project Manager: GitHub Without the Interface
Connect GitHub. Ask "Create issues for each item in our sprint planning doc" and Claude reads the document and creates the issues for you.
Researcher: Web Access When Needed
Connect Perplexity or Puppeteer. Ask "What are the latest industry trends in renewable energy?" and Claude searches and summarizes current information.
Using Docker MCP Toolkit
If you want the easiest setup experience, Docker provides a toolkit with over 200 pre-built servers and one-click installation.
- Install Docker Desktop
- Open Docker Desktop settings
- Go to the MCP Toolkit section
- Enable Claude Code as a client
- Browse and install servers with one click
This is the recommended approach for non-technical users who want a visual interface.
Common Mistakes to Avoid
- Forgetting the scope flag: Use
--scope userto make servers available everywhere. Without it, the defaultlocalscope means the server only works in the current project for you. - Typos in server names: Server names are case-sensitive. Use exactly what's in the documentation.
- Expired tokens: If a server stops working, check if your API token expired. Generate a new one.
- Too many servers: Each server uses context space. If Claude seems slow or forgetful, remove servers you don't use.
- Production database connections: Never give Claude write access to production data. Use read-only connections to development databases.
- Windows npx errors: On Windows (not WSL), MCP servers using
npxrequire thecmd /cwrapper. Use:claude mcp add --transport stdio my-server -- cmd /c npx -y @some/package. Without this, you get "Connection closed" errors. - Option ordering: All options (
--transport,--env,--scope) must come before the server name. The--separator comes after the name and before the command.
Tool Search: Handling Many Servers
If you connect many MCP servers, Claude Code automatically enables Tool Search. Instead of loading all tools at once (which uses context space), Claude dynamically loads only the tools needed for your current request.
This happens automatically when your MCP tool definitions would consume more than 10% of the context window. You don't need to configure anything.
You can control this behavior with the ENABLE_TOOL_SEARCH environment variable:
auto(default) — Activates when tools exceed 10% of contextauto:5— Custom threshold (5% in this example)true— Always enabledfalse— Disabled, all tools loaded upfront
Note: Tool Search requires Sonnet 4 or later, or Opus 4 or later. Haiku models do not support tool search.
OAuth Authentication for Remote Servers
Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections. After adding an HTTP server, run /mcp inside Claude Code, select the server, and follow the browser login flow. Authentication tokens are stored securely and refreshed automatically.
Use "Clear authentication" in the /mcp menu to revoke access if needed.
FAQ
Do MCP servers cost money?
The MCP servers themselves are free and open source. However, some connect to paid services (like GitHub, which has free and paid tiers). Claude Code usage costs apply as normal.
Is my data secure with MCP?
MCP servers run locally on your machine. Data doesn't go through Anthropic's servers—it goes directly between your computer and the connected service. Always use secure tokens and avoid connecting to sensitive production systems.
Can I create my own MCP server?
Yes, developers can create custom MCP servers for any system or API. If you have a developer on your team, they can build servers for your internal tools.
Why isn't my MCP server working?
Run claude mcp get [server-name] to test the connection and see error messages. Common issues: expired tokens, wrong scope, or typos in the configuration.
How many MCP servers can I add?
There's no hard limit, but each server uses some context space. If you add too many, Claude may become slower or forget earlier context. Add only the servers you actively use.
Related Guides
- How to Use Skills in Claude Code — create custom commands
- How to Use Slash Commands — built-in shortcuts
- How to Use CLAUDE.md Files — configure Claude for your projects
- What Is Claude Code? — understand the basics
Like Claude Code? Meet Your Chief AI Officer
Watch me build a complete website using only plain English—no coding required. Then try it yourself.
Get the Free Blueprint href="/blueprint">Watch the Free Setup Video →rarr;