Claude Code MCP
If Claude Code is an excellent typist (code generation) and tester (code verification), then adding MCP (Model Context Protocol) gives Claude real external senses and limbs - it is no longer confined to the current project's code files, but can proactively connect to resources and tools in the outside world, becoming your full-chain development collaboration partner.
What is MCP (Model Context Protocol)?
MCP is an open standardized protocol introduced by Anthropic, created to solve the core pain points of collaboration between AI and external tools.
MCP's core logic overturns traditional thinking: instead of having AI learn the usage rules of every tool one by one, all tools provide a unified interface to the AI.
This logic is like a universal power outlet in real life - instead of making appliances fit different outlets, as long as the outlet follows a unified standard, all appliances can be used directly.
After connecting an MCP server, you can have Claude Code:
- Fetch requirements from JIRA/ticketing systems and develop features, create GitHub PRs
- Analyze Sentry monitoring data, locate production environment errors
- Query data from databases such as PostgreSQL/MySQL
- Update code based on Figma designs, automatically generate email drafts, and more

Why does Claude Code need MCP?
Before MCP, Claude Code's capabilities were strictly limited to the project folder you currently had open, like a narrow-minded assistant that could only see the code in front of it and could not perceive any information outside the project. The emergence of MCP completely broke down this information silo, allowing Claude to participate deeply in the full development workflow:
A few intuitive scenario comparisons will help you quickly understand the value of MCP:
| Scenario | Without MCP | With MCP |
|---|---|---|
| Cross-repository analysis | Can only analyze code in the current folder, cannot relate to other repositories | Cross-repository collaboration: "Help me analyze repository A's API documentation, then write the corresponding calling method in repository B" |
| Requirements/discussion sync | Requires you to manually copy and paste requirement documents and team discussion records into the dialog | Real-time collaboration info sync: "Check the discussion history in the #feature-x channel on Slack and see everyone's suggestions for changes to this feature" |
| Database verification | Cannot directly verify code-database compatibility; can only manually check table structures | Direct database integration: "Go check the structure of the users table in MySQL and the first 5 rows, and determine whether my user query interface matches" |
| Automation workflows | Can only generate code snippets for you to copy and use manually | Automated execution: "Help me write a browser automation script, and execute it via MCP calling Puppeteer, to verify the interaction logic of the login page" |
In short, MCP transforms Claude Code from an assistant that passively receives information into a collaborative partner that proactively fetches information and performs actions.
Basic usage of MCP in Claude Code
Claude Code has built-in complete MCP management capabilities, with only one core command:
claude mcp
Common subcommands:
| Command | Purpose |
|---|---|
claude mcp add |
Add an MCP server |
claude mcp list |
View all configured servers |
claude mcp get |
View details of a server |
claude mcp remove |
Remove a server |
/mcp |
View status / authentication in Claude Code |
Install an MCP server
MCP servers support three connection methods: HTTP/SSE/stdio; HTTP is recommended (SSE is deprecated).
1. Remote HTTP server (recommended)
Suitable for cloud service tools, the most general approach:
# 基础语法
claude mcp add --transport http <服务器名称> <服务器URL>
# Example 1: Connecting to Notion
claude mcp add --transport http notion https://mcp.notion.com/mcp
# Example 2: HTTP server with authentication
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer Your token"
2. Remote SSE server (deprecated)
Only compatible with legacy tools; prefer HTTP as a replacement:
# 基础语法(仅兼容用)
claude mcp add --transport sse <服务器名称> <服务器URL>
# Example: Connect Asana
claude mcp add --transport sse asana https://mcp.asana.com/sse
3. Local stdio server
Suitable for tools that need local system access (such as local databases, custom scripts):
# 基础语法(注意:--前是Claude参数,--后是服务器命令)
claude mcp add --transport stdio [--env 环境变量] <服务器名称> -- <启动命令>
# Example: Connecting to Airtable (requires replacing your own API key)
claude mcp add --transport stdio --env AIRTABLE_API_KEY=你的密钥 airtable \
-- npx -y airtable-mcp-server
Key notes:
--transport/--envand other parameters must be placed beforethe server name,--used to separate Claude parameters from the server command to avoid parameter conflicts.
Managing MCP servers
After configuration, you can manage servers with the following commands:
# 列出所有已配置的服务器
claude mcp list
# View details of a specified server (e.g., github)
claude mcp get github
# Delete specified server
claude mcp remove github
# Check server status in Claude Code
/mcp
Configuration scope (controls server visibility)
You can specify the effective scope of an MCP server to suit personal/team use cases:
| Range | Purpose | Configuration command examples |
|---|---|---|
| local (default) | Available only to the current project, private configuration (such as sensitive keys) | claude mcp add --scope local ... |
| project | Team-shared (stored in .mcp.json, can be committed to the repository) | claude mcp add --scope project ... |
| user | Available to all projects (personal global configuration) | claude mcp add --scope user ... |
Priority: local > project > user (for servers with the same name, local configuration overrides shared configuration)
Practical Examples
Example 1: GitHub code review
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
In Claude Code:
> Review PR #456 and suggest improvements
> Show me all open PRs assigned to me
Example 2: Sentry production troubleshooting
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
> /mcp # 完成 OAuth 登录
> What are the most common errors in the last 24 hours?
Example 3: Query PostgreSQL directly
claude mcp add --transport stdio db \
-- npx -y @bytebase/dbhub \
--dsn "postgresql://readonly:pass@prod.db.com:5432/analytics"
> Show me the schema for the orders table
> Which users haven't purchased in 90 days?
Advanced ways to use MCP in conversations
1. Referencing MCP resources with @
> Analyze @github:issue://123 and suggest a fix
Supports comparison of multiple resources:
> Compare @postgres:schema://users with @docs:file://user-model
2. MCP Prompt as slash commands
MCP can expose commands:
/mcp__github__list_prs
/mcp__jira__create_issue "Login bug" high
Claude will execute them just like built-in commands.
Key points to note
- Authentication: Remote MCP servers (such as GitHub/Sentry) need to be executed in Claude Code
/mcpto complete OAuth 2.0 authorization; - Windows compatibility: If a local stdio server uses npx, you need to add
cmd /cas a wrapper (such as-- cmd /c npx -y 包名), otherwise you will get a "Connection closed" error; - Third-party risks: When using unofficial MCP servers, confirm the source is trustworthy to avoid prompt injection/security risks;
- Parameter order: When configuring a stdio server,
--the parameters before and after it cannot be reversed, otherwise execution will fail.