Claude Code MCP Complete Guide
What is Claude Code MCP?
Claude Code is Anthropic's official AI command-line tool, while MCP (Model Context Protocol) is the protocol that allows Claude Code to connect to external tools and services.
Put simply, MCP turns Claude Code from an AI assistant that can only read and write local files into a super assistant that can access GitHub, databases, APIs, and cloud services.
Why use MCP in Claude Code?
Claude Code without MCP
What you can do:
✓ Read local files
✓ Edit code
✓ Run commands
✓ Use Bash tools
What you cannot do:
✗ View your GitHub Issues
✗ Access a cloud database
✗ Call external APIs
✗ Get real-time weather
Claude Code with MCP
What you can do:
✓ All original functions
✓ View / create GitHub Issues and PRs
✓ Query SQLite and PostgreSQL databases
✓ Access external services such as Notion and Slack
✓ Get real-time weather and map data
✓ Browser automation
✓ ...and more
Quick Start
Step 1: Understand where the config files live
Claude Code's MCP configuration files are located at:
| Level | Config file path | Scope |
|---|---|---|
| User level | ~/.claude.json | All projects |
| Project level | .claude/mcp.json | Current project |
It is recommended to use project-level config first, so different projects can use different MCP services.
Step 2: Add MCP servers with natural language
In Claude Code, you do not need to manually edit configuration files or memorize commands. You can describe what you want in natural language:
You: Help me add a GitHub MCP server. My token is ghp_xxx
Claude: I'll help you configure the GitHub MCP server...
[Automatically updates .claude/mcp.json]
You: Add a SQLite database server. The database file is at ./data/app.db
Claude: Okay, I'll configure the SQLite MCP server...
You: Add an HTTP-type MCP server with the address https://api.example.com/mcp
Claude: I'll add that remote MCP server...
Step 3: Verify the configuration
Ask Claude Code directly:
You: What MCP servers are available now?
Claude: Currently configured MCP servers:
• github - GitHub integration
• sqlite - SQLite database
• filesystem - Filesystem access
Or use the diagnostic command:
/doctor
Step 4: Start using it
Once configuration succeeds, you can call MCP functions directly with natural language:
You: Help me create an Issue on GitHub
Claude: I can help you create a GitHub Issue. Please tell me:
- the repository address, for example owner/repo
- the Issue title
- the Issue description
Natural-language management in Claude Code
View and manage MCP servers
You can interact with Claude Code entirely in natural language:
You: List all configured MCP servers
You: Check the connection status of the MCP servers
You: Delete the MCP server named notion
You: Update the token for the github server
Diagnose problems
When you run into problems:
You: Check what's wrong with the MCP connection
Claude: [will automatically run diagnostics, analyze configuration files, and check server status]
Configuration methods in detail
User-level config, global
Edit ~/.claude.json:
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/yourname/Documents"]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
}
}
}
}
Project-level config, recommended
Edit .claude/mcp.json in the project root:
{
"mcpServers": {
"project-db": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/app.db"]
}
}
}
Advantages of project-level config:
- Team members can share the config by committing it to Git
- Different projects can use different MCP services
- Configuration is more flexible and does not pollute global settings
Transport modes
Claude Code supports three transport modes:
STDIO, local process
{
"mcpServers": {
"local-tool": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
}
}
}
HTTP, remote service
{
"mcpServers": {
"remote-api": {
"url": "https://api.example.com/mcp",
"transport": "http",
"headers": {
"Authorization": "Bearer your-token"
}
}
}
}
SSE, server-sent events
{
"mcpServers": {
"streaming": {
"url": "https://api.example.com/sse",
"transport": "sse"
}
}
}