TL;DR
The Model Context Protocol (MCP) connects Claude Code to external tools - GitHub, browsers, databases - via an open standard. This MCP cheatsheet gathers all essential commands to configure, secure, and leverage your MCP servers on a daily basis. Refer to it as a quick reference whenever you add or troubleshoot a server.
The Model Context Protocol (MCP) connects Claude Code to external tools - GitHub, browsers, databases - via an open standard. This MCP cheatsheet gathers all essential commands to configure, secure, and leverage your MCP servers on a daily basis. Refer to it as a quick reference whenever you add or troubleshoot a server.
MCP (Model Context Protocol) is a standardized protocol created by Anthropic that enables AI models to interact with tools, APIs, and external data sources via a unified interface. MCP has become the adopted integration standard by Claude Code v1.0.52, Cursor, Windsurf, and over 40 compatible editors. the protocol manages over 3,000 servers listed in the official community registry.
To master the fundamentals before tackling MCP, check the installation and first launch guide which covers the initial Claude Code configuration.
What are the fundamental concepts of the Model Context Protocol?
MCP is based on a lightweight client-server architecture. Claude Code acts as the MCP client and connects to one or more MCP servers that expose tools.
| Concept | Definition | Concrete example |
|---|---|---|
| MCP Server | Process that exposes tools via the MCP protocol | @modelcontextprotocol/server-github |
| MCP Client | Application that consumes tools from a server | Claude Code, Cursor |
| Tool | Callable function exposed by a server | github_create_issue, brave_search |
| Resource | Contextual data provided by a server | File content, query result |
| Transport | Client-server communication mode | stdio, SSE, streamable-http |
| Prompt template | Predefined prompt template exposed by the server | Code review template |
An MCP server is an independent process that communicates with Claude Code via one of the three supported transports. In practice, 90% of local servers use the stdio transport for its simplicity.
The complete guide on MCP details the internal architecture of the protocol and its advanced use cases.
Key takeaway: MCP is an open client-server standard that unifies the connection between Claude Code and any external tool.
How to add an MCP server to Claude Code?
Use the /mcp command in a Claude Code session or directly modify the JSON configuration file. Here is how to proceed depending on the chosen transport.
stdio transport (local servers)
The stdio transport launches a local process. This is the default mode for npm and Python servers.
# Add a stdio server via the slash command
claude /mcp add github -- npx -y @modelcontextprotocol/server-github
# Add a Python server
claude /mcp add my-server -- python3 -m my_mcp_server
# Add with environment variables
claude /mcp add github -e GITHUB_TOKEN=ghp_xxx -- npx -y @modelcontextprotocol/server-github
SSE transport (Server-Sent Events)
The SSE transport is suitable for remote servers accessible via HTTP. Specify the SSE endpoint URL.
# Add a remote SSE server
claude /mcp add my-remote-server -t sse -- https://mcp.example.com/sse
# Add with authentication header
claude /mcp add secure-server -t sse -h "Authorization: Bearer token123" -- https://api.example.com/sse
streamable-http transport
Since the MCP v2025-03-26 specification, the streamable-http transport is gradually replacing SSE. Prefer this mode for new deployments.
# Add a streamable-http server
claude /mcp add api-server -t http -- https://mcp.example.com/mcp
In practice, the configuration file is located at ~/.claude/settings.json for global scope or in .claude/settings.json for a project. Check the step-by-step MCP tutorial for a detailed guide with screenshots.
Key takeaway: three transports exist (stdio, SSE, streamable-http) - choose stdio for local, streamable-http for remote.
What are the essential MCP slash commands?
Here is the quick reference table of the most used MCP commands in Claude Code. Each entry is self-contained and citable.
| Command | Description | Example |
|---|---|---|
/mcp add | Add a new MCP server | /mcp add github -- npx -y @modelcontextprotocol/server-github |
/mcp remove | Remove a registered MCP server | /mcp remove github |
/mcp list | List all configured servers and their state | /mcp list |
/mcp status | Check the connection status of a server | /mcp status github |
/mcp reset | Restart all MCP servers | /mcp reset |
/mcp add -s project | Add a server with project scope | /mcp add local-db -s project -- node db-server.js |
/mcp add -e VAR=val | Pass environment variables | /mcp add gh -e GITHUB_TOKEN=xxx -- npx server-github |
In practice, the /mcp list command is the first to run when diagnosing a connection problem. If a server shows the error status, run /mcp reset to force a restart.
To discover all available slash commands, refer to the essential slash commands directory.
Key takeaway: /mcp add, /mcp list, and /mcp reset cover 80% of daily interactions with MCP servers.
How to configure MCP servers in the JSON file?
Open the file ~/.claude/settings.json (user scope) or .claude/settings.json (project scope). The mcpServers section contains the declaration of each server.
{
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_your_token"
}
},
"brave-search": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-brave-search"],
"env": {
"BRAVE_API_KEY": "BSA_your_key"
}
},
"remote-api": {
"type": "http",
"url": "https://mcp.example.com/mcp"
}
}
}
| Property | Type | Required | Role |
|---|---|---|---|
type | stdio / sse / http | Yes | Communication transport |
command | string | Yes (stdio) | Command to execute |
args | string[] | No | Command arguments |
env | object | No | Environment variables |
url | string | Yes (sse/http) | Remote endpoint URL |
headers | object | No | HTTP headers (auth, etc.) |
The project scope (.claude/settings.json) allows sharing the MCP configuration with your team via Git. In practice, 65% of teams use this approach to standardize available tools. Verify that tokens are never committed - use environment variables.
To dive deeper into shared context management between team members, explore the context management guide.
Key takeaway: the JSON file supports three transport types and accepts environment variables for secrets.
How to secure your MCP servers?
MCP security relies on the Claude Code permissions system. By default, each MCP tool triggers an approval request on the first call.
Permission levels
| Level | Behavior | Use case |
|---|---|---|
ask (default) | Asks for confirmation on each call | Sensitive tools (file write) |
allow | Automatically authorizes the tool | Read tools (search, fetch) |
deny | Systematically blocks the tool | Unwanted tools |
Security best practices
Apply these rules to protect your environment:
- Store tokens in environment variables, never in plain text in JSON
- Limit GitHub token scope to the minimum required (
reposcope only if necessary) - Audit exposed tools with
/mcp listbefore each sensitive session - Use project scope to restrict available servers per repository
- Verify the provenance of MCP servers - prefer packages from the official
@modelcontextprotocolregistry
stdio MCP servers run with the local system user permissions. A malicious server can access any file readable by your account. Systematically validate the source code of third-party servers.
The Claude Code permissions system applies uniformly to MCP tools and native tools. To finely configure these authorizations, check the permissions and security guide.
Key takeaway: only trust MCP servers from the official registry and store your secrets in environment variables.
What are the most popular MCP servers in 2026?
Here are the most popular MCP servers used with Claude Code. Each server is an npm or Python package installable with a single command.
| Server | Package | Main tools | Token required |
|---|---|---|---|
| GitHub | @modelcontextprotocol/server-github | Create issues, read PRs, search repos | GITHUB_TOKEN |
| Brave Search | @anthropic/mcp-server-brave-search | Real-time web search | BRAVE_API_KEY |
| Playwright | @anthropic/mcp-server-playwright | Web navigation, screenshots, tests | None |
| FileSystem | @modelcontextprotocol/server-filesystem | Read/write files outside project | None |
| PostgreSQL | @modelcontextprotocol/server-postgres | SQL queries, DB schema | Connection URL |
| Slack | @anthropic/mcp-server-slack | Read/send messages, list channels | SLACK_TOKEN |
Quick installation of the 3 essential servers
# GitHub - repository and issue management
claude /mcp add github -e GITHUB_TOKEN=ghp_xxx -- npx -y @modelcontextprotocol/server-github
# Brave Search - web search
claude /mcp add brave -e BRAVE_API_KEY=BSA_xxx -- npx -y @anthropic/mcp-server-brave-search
# Playwright - web navigation and testing
claude /mcp add playwright -- npx -y @anthropic/mcp-server-playwright
The official MCP registry lists over 3,000 community servers compatible with the MCP v2025-03-26 specification. the GitHub server has accumulated over 2 million npm downloads.
SFEIR Institute offers the one-day Claude Code training which includes hands-on labs on MCP server configuration, permissions management, and GitHub integration. You configure your environment end-to-end with an expert instructor.
The MCP troubleshooting guide covers common installation errors for these servers.
Key takeaway: GitHub, Brave Search, and Playwright cover the three most frequent use cases - code, search, and navigation.
How to use MCP tools during a session?
Once a server is connected, its tools are automatically available in your Claude Code session. Check availability with /mcp list, then use the tools in natural language.
Usage examples in conversation
# Use GitHub MCP
> Create an issue on the sfeir/claude-demo repo with the title "Bug: API timeout"
# Use Brave Search MCP
> Search for the latest Next.js 15 news
# Use Playwright MCP
> Open https://example.com and take a screenshot
Tool approval flow
When Claude Code invokes an MCP tool for the first time, a permission request appears in the terminal. You have three options:
- Accept once - authorizes this call only
- Always accept - authorizes this tool for the current session
- Decline - blocks the call and continues the conversation
Claude Code executes MCP tools with a default timeout of 60 seconds per call. In practice, Brave Search queries respond in 800 ms on average, while Playwright may need 5 to 15 seconds for rendering a full page.
In practice, you can chain multiple MCP tools in a single conversation. For example: search with Brave, open the result with Playwright, then create a GitHub issue with the collected information.
Explore the first conversations guide to discover how to structure your prompts with MCP tools.
Key takeaway: MCP tools are used in natural language - Claude Code handles the technical calls transparently.
How to troubleshoot an MCP server that is not responding?
MCP connection problems follow predictable patterns. Follow this 5-step diagnostic procedure.
| Step | Command / Action | Expected result |
|---|---|---|
| 1. Check status | /mcp list | All servers in running |
| 2. Restart | /mcp reset | Automatic reconnection |
| 3. Test manually | npx -y @modelcontextprotocol/server-github | Process starts without error |
| 4. Check logs | Inspect process stderr | Detailed error messages |
| 5. Reinstall | /mcp remove github && /mcp add github ... | Clean configuration |
Common errors and solutions
# Error: "spawn npx ENOENT"
# Solution: verify that Node.js 22+ is installed
node --version # should show v22.x or higher
# Error: "GITHUB_TOKEN is not set"
# Solution: pass the token via -e
claude /mcp add github -e GITHUB_TOKEN=$(gh auth token) -- npx -y @modelcontextprotocol/server-github
# Error: "Connection timeout"
# Solution: check network connectivity for SSE/HTTP servers
curl -I https://mcp.example.com/sse
70% of MCP errors stem from a missing or expired token. Check your environment variables first.
For an in-depth diagnosis, the MCP troubleshooting guide references the 15 most common errors with their solutions. You can also check the MCP checklist to validate your configuration point by point.
Key takeaway: 70% of MCP errors come from missing tokens - check env first.
Can you create your own custom MCP server?
Yes. The MCP SDK is available in TypeScript (Node.js 22+) and Python (3.12+). Create a minimal server in fewer than 50 lines of code.
// server.ts - Minimal MCP server with Node.js 22
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({ name: "my-server", version: "1.0.0" });
server.tool("hello", "Greet the user", { name: { type: "string" } },
async ({ name }) => ({
content: [{ type: "text", text: `Hello ${name}!` }]
})
);
const transport = new StdioServerTransport();
await server.connect(transport);
# Register your custom server in Claude Code
claude /mcp add my-server -- npx tsx server.ts
The TypeScript SDK @modelcontextprotocol/sdk v1.12.0 weighs 45 KB minified. The Python SDK mcp v1.8.0 installs via pip and supports asyncio natively.
To go further in creating MCP servers, the one-day AI-Augmented Developer - Advanced training from SFEIR Institute dedicates an entire module to creating custom MCP servers with guided labs. The AI-Augmented Developer training covers AI integration fundamentals over 2 days, with practical exercises using MCP in real workflows.
Find Git best practices for versioning your MCP servers in the Git integration guide.
Key takeaway: the TypeScript and Python MCP SDK lets you create a functional server in fewer than 50 lines of code.
What shortcuts and tips speed up working with MCP?
Optimize your MCP workflow with these advanced techniques.
| Tip | Command / Configuration | Benefit |
|---|---|---|
| Server alias | Short name in /mcp add | Faster typing |
| Token from CLI | -e GITHUB_TOKEN=$(gh auth token) | No copy-paste |
| Project scope | -s project | Shared team configuration |
| Targeted reset | /mcp reset after modification | Instant reload |
| Auto-approve read | Configure allow for read-only tools | Zero interruptions |
Recommended configuration for a typical project
{
"permissions": {
"allow": [
"mcp__github__search_repositories",
"mcp__github__get_file_contents",
"mcp__brave__brave_web_search"
],
"deny": [
"mcp__github__delete_repository"
]
}
}
This configuration automatically authorizes GitHub and Brave Search read tools while blocking destructive operations. In practice, you reduce the number of manual confirmations per session by 40%.
To master the full range of Claude Code productivity tools, the complete MCP guide serves as the central reference for the silo.
Key takeaway: combine project scope, selective auto-approve, and short aliases for a smooth MCP workflow.
Claude Code Training
Master Claude Code with our expert instructors. Practical, hands-on training directly applicable to your projects.
View program