---
title: "What Is MCP? Model Context Protocol Guide and Claude Code Setup"
description: "Learn what MCP (Model Context Protocol) is, what host, client and server do, how to add your first MCP server in Claude Code, and a security checklist."
url: https://cdnping.org/en/blog/what-is-mcp-model-context-protocol
language: en
published: 2026-11-23
category: "AI concepts"
tags: ["MCP","Claude Code","AI tools","beginner guide","security"]
source: cdnping.org
license: Free to quote and summarize with a link to the url above.
---
# What Is MCP? Model Context Protocol Guide and Claude Code Setup

MCP stands for Model Context Protocol. It is an open protocol Anthropic introduced in late 2024 that defines a standard way for AI applications to connect to external tools and data. In short, you no longer have to write a separate integration for every application and every data source: a data source implements MCP once, and any AI application that supports MCP can use it.

If you're wondering what MCP is, think of it as a "universal interface spec" for AI tools. Below we cover the problem it solves, who the roles are, and then walk through adding a server in Claude Code.

## What problem does MCP solve?

A large language model only processes the text you give it. To let it read local files, query a database, or call a SaaS API, someone has to wire those capabilities in. Without a shared protocol, every AI application builds its own integration for every external system, so M applications and N systems means M×N integrations.

MCP turns this into "one side implements the protocol, and the other side implements it too." The data source or tool provider implements a server, the AI application implements a client, and the two talk according to the protocol. That is why MCP is often compared to a "USB port," though it's only an analogy: the protocol itself says nothing about how the device works.

## What are the three roles in MCP?

- **Host**: the AI application you use directly, such as Claude Code, the Claude desktop app, or an AI assistant inside an editor.
- **Client**: the component inside the host that maintains the connection to one particular server. One host can connect to several servers at once.
- **Server**: the program that exposes capabilities. This answers "what is an MCP server": a small program that exposes capabilities via the MCP protocol. It can run on your own machine or be a remote service.

A server usually offers three kinds of things:

| Type | Meaning | Example (illustrative) |
| --- | --- | --- |
| Tools | Functions the model can request to call | Query a database, create a ticket |
| Resources | Data that can be read | File contents, document pages |
| Prompts | Pre-written prompt templates | A code review template |

In practice, tools are the most common. For exact fields and details, defer to the official MCP specification (modelcontextprotocol.io).

## How do servers and clients communicate?

Two transports are common today:

1. **stdio (local process)**: the host starts a child process on your computer and communicates over standard input and output. Good for local files and local tools.
2. **HTTP (remote service)**: the host connects to a remote address over the network. Good for services offered by cloud SaaS products, and usually requires authorization.

The spec and each host's transport support change over time, so check the official documentation of the tool you use to decide which to pick.

## How do I add my first MCP server in Claude Code?

The example below uses a local filesystem server with a controllable scope. Command syntax follows the official Claude Code documentation and may differ between versions.

**Step 1: Check your environment.** This example launches the server with npx, so Node.js must be installed first. Claude Code must also be installed and starting normally.

**Step 2: Add the server.** In a terminal, run the following (replace the path with a directory you're willing to expose):

```bash
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem /path/to/allowed-dir
```

Everything before `--` is arguments for Claude Code itself; everything after is the command that launches the server. Adding a remote HTTP server looks similar, in the form `claude mcp add --transport http <name> <URL>`; check the official documentation for the exact parameters.

**Step 3: Check the status.**

```bash
claude mcp list
```

Inside Claude Code you can also type `/mcp` to see the connected servers and the tools they provide.

**Step 4: Try it.** Tell Claude Code, "List the files in the allowed directory." It will ask for your permission before calling the tool and run it only after you confirm.

**Step 5: Understand the scope.** Claude Code's MCP configuration can apply only to the current project, to all of your own projects, or be written to a `.mcp.json` file in the project to share with your team. Before sharing a config, make sure it contains no secrets. See the official documentation for the names and parameters of each scope.

## What should I check before connecting an MCP server?

An MCP server can read data and perform actions, with permissions equal to the scope you grant it. Go through this checklist before connecting one:

| Check | What to do |
| --- | --- |
| Is the source trustworthy? | Prefer servers from the vendor or well-known maintainers; look at the source, the changelog, and whether it is still maintained |
| What can it access? | For local servers, expose only the directories needed; for remote servers, grant only the necessary authorization scopes |
| Does it have write operations? | Confirm delete, send, and payment tools one call at a time; don't auto-approve everything |
| Where do keys go? | Don't put API keys in config files that get committed to a repository |
| Can content "command the model in reverse"? | Web pages and documents returned by a server may contain malicious instructions (prompt injection); stay wary of externally sourced content |
| Where does the data go? | A remote service receives whatever you have the model send; read the provider's privacy terms first if the data is sensitive |

A simple rule: grant the minimum permissions, and try it first on an unimportant directory or test data.

## Do I need an API to use MCP?

MCP itself is a protocol and is free. But the model that drives it has to come from somewhere: you can sign in to Claude Code with an official Claude subscription or an API, or supply a model some other way. If you're not sure what an API is, start with [What is an AI API: a one-page explainer for beginners](/en/blog/what-is-ai-api-beginner). To see the different ways to get started with Claude, read [How beginners can use Claude: web app, official API, and third-party gateways](/en/blog/claude-for-beginners-ways-to-use). If you need an official API key, see [How to get a Claude API key: the official Anthropic Console process](/en/blog/how-to-get-claude-api-key). If your company uses a cloud provider's model service, you may also want [Claude Code with Google Vertex AI: setup steps and common errors](/en/blog/claude-code-vertex-ai-setup).

If you don't have an overseas credit card, you can also look at AGI Plan (AGI Plan is a commercial partner of cdnping). It is a multi-provider LLM aggregation gateway with monthly subscriptions, payment in RMB, and no overseas credit card required. You keep using tools like Claude Code and Codex and only change one endpoint address, and one subscription can switch between multiple capability groups. Some models are marked "overseas only"; the [models page](https://agiplan.dev/models) is authoritative, and the site also states that it is not an officially authorized channel. The entry point is the [AGI Plan getting-started page](https://agiplan.dev/startup).

## What if it won't connect or nothing happens after I add it?

- First run `claude mcp list` or `/mcp` to check the server status and confirm the process started successfully.
- If a local server reports that a command can't be found, it is most likely that Node.js or the relevant runtime isn't installed, or the path is wrong.
- If a remote server won't connect, it could be a network problem or unfinished authorization; it could also be fluctuation in the model service itself, which you can rule out with [Claude Code availability](/en/down/claude-code) and [Anthropic API status](/en/status/anthropic).
- If the tools don't show up after you add the server, restart the Claude Code session and try again.

## Summary and next steps

MCP is a unified protocol for AI applications to connect to external tools and data, made up of a host, a client, and a server. The fastest way to get started is to install a scope-limited local server in Claude Code, call it by hand once, and then use the checklist above to decide whether to connect more. As a next step, read the official MCP documentation, pick a server you will actually use (for example, one that reads project docs or queries a database), add it in a test environment, and watch the permission prompt on each request.
