Blog · 工具技巧 · Published
What Is MCP: How the Model Context Protocol Works, How to Connect Claude Code, and How to Troubleshoot It
MCP (Model Context Protocol) is an open standard that lets AI assistants connect to external tools and data sources; it solves the problem of manually copying and pasting data from tools into the AI. This article explains what it is for, gives the four commands for adding, checking, using, and removing a server in Claude Code, a comparison table of the four connection methods, and the troubleshooting order when a connection fails. It closes with how readers in Hong Kong and Taiwan can complete the payment step for AI tool subscriptions using Alipay, WeChat, and RMB.
What Is MCP: How the Model Context Protocol Works, How to Connect Claude Code, and How to Troubleshoot It
Information updated 2026-11-18
MCP stands for Model Context Protocol, an open source standard that lets AI assistants connect to external tools and data sources. The core problem it solves: previously you had to manually copy and paste content from a ticketing system, monitoring dashboard, or database into the AI chat box before the AI could see it; once MCP is connected, the AI can read and act on those systems directly. Below we first cover what it is and what it can do, then give the four commands for connecting it in Claude Code, a comparison table of the four connection methods and the order for choosing among them, and the troubleshooting order when a connection fails. Finally, we explain how readers in Hong Kong and Taiwan can complete the payment subscription step for AI tools using Alipay, WeChat, and RMB.
What MCP is and what it can do: replacing "copy and paste" with "direct operation"
MCP addresses the limitation that the AI chat box can only see what you paste into it. As the official documentation puts it: when you find yourself copying data from another tool into the chat, that is when you should consider connecting an MCP server; once connected, Claude can read that system and act directly, rather than only processing what you paste in (Claude Code MCP documentation).
Three terms are explained here and used repeatedly later. A protocol is a set of communication rules agreed by both sides; MCP is the set of rules agreed between an AI client and a "tool server." An API (application programming interface) can be thought of as a restaurant's ordering window: programs call each other's functions by passing requests through this window and receiving results, and what an MCP server does is wrap the APIs of various tools into a list of tools that the AI can recognize directly. An MCP server is the party providing this interface; it can be a service hosted by someone else in the cloud, or a small program running on your own machine.
According to the official documentation, once an MCP server is connected, you can ask Claude Code to do these six kinds of things (Claude Code MCP documentation):
- Implement a feature from a ticketing system: for example, "implement the feature described in issue ENG-4521 and create a merge request on GitHub."
- Analyze monitoring data: for example, "check Sentry and Statsig for usage of the ENG-4521 feature."
- Query a database: for example, "find the email addresses of 10 random users in the PostgreSQL database who have used the ENG-4521 feature."
- Integrate design files: for example, "update the standard email template according to the new Figma design posted in Slack."
- Automate workflows: for example, "create Gmail drafts for these 10 users inviting them to give feedback on the new feature."
- Respond to external events: an MCP server can also act as a channel, pushing messages from Telegram, Discord, or webhooks into the session so Claude can respond while you are away.
What these six uses have in common: the AI no longer only processes text you copy in, but connects directly to the systems you actually use. Here is an explicitly labeled hypothetical scenario: you use Claude Code (Anthropic's coding assistant, which runs in the terminal) and want it to read GitHub issues, check Sentry errors, and draft an email in Gmail. Without MCP, you would have to open three websites manually and copy the content to Claude piece by piece; once the corresponding servers are connected, you can simply say "implement the feature described in issue ENG-4521 and create a merge request," and Claude reads and writes on its own. When choosing your first server, it pays most to start with the tool whose data you most often move by hand.
How to connect MCP in Claude Code: four commands
Claude Code manages MCP servers from the command line; the complete flow is add, check, use, remove (MCP quickstart). The first example in the official quickstart is connecting a documentation search server:
- Add the server. Run this in a terminal (not inside a claude session):
claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp. Breaking it down:claude mcp addregisters a server;--transport httpindicates the server is hosted at a URL;claude-code-docsis a name you choose; the last part is the server address. On success the command line printsAdded HTTP MCP server .... - Check connection status. Run
claude mcp list; each server has a status marker next to it, explained in the next section. - Use it in a session. After starting
claude, just ask Claude to use this server, for example "use the claude-code-docs server to look up what MCP_TIMEOUT does." You do not need to name it every time; Claude picks relevant tools on its own. If an authorization prompt appears on the first call, approve it. - Remove it when no longer needed. Run
claude mcp remove claude-code-docs. Each additional server consumes some context (Claude's memory space) with its tool names and descriptions, so deleting servers you do not use saves space.
Where server configuration is stored also matters: the default is local scope, which applies only to you and only in the current project; adding --scope user applies it to you across all projects; adding --scope project writes it to the .mcp.json in the project root, which can be committed with the code and shared with the team (MCP quickstart).
How to choose among the four connection methods: comparison table and decision order
There are four connection methods; which to use depends on where the server runs and whether it needs to actively push events (Claude Code MCP documentation):
| Connection method | When it applies | How to add | Notes |
|---|---|---|---|
| HTTP (remote) | Cloud-hosted services, officially recommended | claude mcp add --transport http <name> <URL> |
Widest support; first choice |
| stdio (local process) | Need access to local files, browser, or database | claude mcp add <name> -- <startup command> |
Default method; everything after -- is the startup command |
| SSE (remote) | When the service only provides an SSE endpoint | claude mcp add --transport sse <name> <URL> |
Officially marked deprecated; avoid if possible |
| WebSocket | The server needs to actively push events | Use JSON configuration, set type to ws | Authentication only supports request headers |
Decision order: if the service is in the cloud with a URL, use HTTP first; if you need to touch local files or start a local program, use stdio; only consider WebSocket when the service actively pushes messages to you; SSE is the older option. The official example of a local stdio server is connecting Playwright (a tool that lets Claude control a browser to navigate, click, and read pages), with the command claude mcp add playwright -- npx -y @playwright/mcp@latest (MCP quickstart).
When it will not connect: read the status marker first, then troubleshoot
The status markers given by claude mcp list correspond to different actions (MCP quickstart):
| Status marker | Meaning | Action |
|---|---|---|
✔ Connected |
Connected | Ready to use |
! Needs authentication |
Server is reachable but requires browser login or a token | Complete login or supply the token as the server documentation describes |
✘ Failed to connect |
Server is not responding | Check the error code attached to the status line, then verify the URL and network |
⏸ Pending approval |
A project-level server has not been approved | Run claude to approve interactively |
⊘ Disabled for this project |
Turned off by project configuration | Re-enable it in the /mcp panel |
Suggested troubleshooting order: first read the status marker, then take the action that marker calls for. For Failed to connect, first check whether the URL is complete and reachable from your machine, rather than rerunning the same command repeatedly; a stdio server may fail temporarily on first connection while downloading dependencies, so wait a moment and check again. Servers in a project-level .mcp.json prompt you for approval the first time they appear; this prevents a repository you cloned from starting local processes without your knowledge (Claude Code MCP documentation).
What to watch for when connecting external servers: trust and prompt injection
Before connecting, confirm that you trust the server. The official documentation explicitly warns that servers that fetch external content may carry prompt injection risk (text hidden in web pages or documents that the AI mistakenly treats as instructions) (Claude Code MCP documentation).
In practice: prefer connectors from the official directory or the service provider's own documentation that have been reviewed; for servers of unknown origin, first find out what it connects to and whether it reads your data, then connect. Project-level servers have an additional safeguard: a .mcp.json in someone else's repository does not take effect automatically; Claude Code prompts you for approval first, and a cloned repository cannot approve its own servers (Claude Code MCP documentation).
Readers in Hong Kong and Taiwan: completing the AI tool subscription step
MCP is an open standard, and the protocol itself has nothing to do with billing; what actually costs money is AI tools such as Claude Code and ChatGPT, and whether and how you pay is governed by their respective official subscription rules; this site does not promise official prices. Readers in Hong Kong and Taiwan often get stuck at the payment step rather than the technical one: official ChatGPT subscriptions are collected through Stripe and require a usable foreign-currency credit card; local Hong Kong credit cards usually work, but the charge is counted as a foreign-currency transaction, and some banks apply additional risk controls to subscription merchants (TopupCat homepage).
TopupCat provides top-ups for ChatGPT memberships: scan and pay in RMB with Alipay or WeChat, no foreign-currency credit card needed, and no account password required (TopupCat homepage). This site is an independent third-party service and is not affiliated with OpenAI; the Plus and Pro tiers topped up here cover use of Codex (ChatGPT's coding assistant). Information on this site in this section was updated on 2026-11-18.
To learn how to choose among ChatGPT membership tiers and how RMB pricing is calculated, see this pricing and tier overview; to place an order, see the top-up plans page; refund and warranty rules are governed by the terms of service page; for installing and logging in to Claude Code, see this tutorial.