What is an MCP server, and how to add one to Claude Code
Model Context Protocol explained: how MCP servers work, local vs remote, scopes, popular servers for developers (GitHub, Sentry, Figma, databases) and security.
An AI coding agent is only as useful as what it can reach. Out of the box, Claude Code can read your files and run commands — but it cannot look at your Sentry errors, read a Figma design or query your database. MCP servers close that gap. This guide explains what an MCP server is, how it works, and how to add one to Claude Code in a single command.
1. What is an MCP server
MCP stands for Model Context Protocol, an open standard for connecting AI applications to tools and data. An MCP server is a small program or web service that exposes a set of capabilities in that standard format — “search issues”, “read this design”, “run this SQL query” — so any MCP-capable agent can use them.
The easiest way to think about it: MCP is to AI agents what USB is to devices. The tool vendor writes one MCP server, and it works in Claude Code, Codex, Cursor, Claude Desktop and other clients without a separate integration for each.
2. How MCP works
There are three roles. The host is the application you use (Claude Code). It runs an MCP client for every connected MCP server. When the agent starts, each server tells it what it offers:
- Tools — actions the agent can call, such as
create_issueorquery. - Resources — data the agent can read, such as a document or a table schema.
- Prompts — ready-made instructions the server provides.
The agent then decides on its own when calling a tool helps with your request — just as it decides when to read a file.
3. Local vs remote MCP servers
- Remote (HTTP) — the server runs at the vendor, you connect with a URL and usually sign in with OAuth. This is the recommended option for services such as GitHub, Sentry or Notion.
- Local (stdio) — Claude Code starts the server as a process on your machine and talks to it over standard input and output. Typical for databases, local files or anything that should not leave your computer.
- SSE — an older remote transport, now deprecated in favour of HTTP.
4. How to add an MCP server to Claude Code
A remote server is one command — the name you choose, then the URL:
claude mcp add --transport http notion https://mcp.notion.com/mcp
If the server needs a sign-in, open Claude Code and run /mcp; it walks you
through OAuth in the browser. For a local server, put the command to start it after
--:
claude mcp add --transport stdio --env AIRTABLE_API_KEY=YOUR_KEY airtable \
-- npx -y airtable-mcp-server
Everything after -- goes to the server unchanged; without it, Claude Code
would try to read the server's own flags as its options. To manage servers:
claude mcp list # all servers and their health
claude mcp get notion # details of one server
claude mcp remove notion # remove it
5. MCP scopes: just you, the project, or everywhere
| Scope | Stored in | Who gets it |
|---|---|---|
local (default) | ~/.claude.json, under the project | you, in this project |
project | .mcp.json in the repository | everyone who clones it |
user | ~/.claude.json | you, in all projects |
Pick the scope with --scope. A project-scoped .mcp.json is
the way to share servers with your team — and secrets do not have to be committed,
because the file supports environment variables:
.mcp.json
{
"mcpServers": {
"api-server": {
"type": "http",
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
"headers": { "Authorization": "Bearer ${API_KEY}" }
}
}
}
In an interactive session, Claude Code asks you to approve servers from a project's
.mcp.json before it uses them.
6. Popular MCP servers for developers
- GitHub MCP server — issues, pull requests, reviews and Actions
without leaving the agent:
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \ --header "Authorization: Bearer YOUR_GITHUB_PAT" - Sentry — “why is this error happening?” with the stack trace and
context at hand:
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp - Databases — for example PostgreSQL through DBHub. Always connect
with a read-only user:
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \ --dsn "postgresql://readonly:pass@localhost:5432/app" - Figma MCP — design-to-code: the agent reads layout, components and variables from the actual design instead of a screenshot.
- Notion, Linear, Jira, Slack — specs and tickets as context, so you do not have to paste them in.
Vendors publish their own MCP servers more and more often; the first place to look is the vendor's documentation, not a random list.
7. MCP security: what to watch out for
- Only connect servers you trust. An MCP server runs code or acts with your credentials.
- Prompt injection. A server that fetches outside content — web pages, issue comments, emails — can bring instructions into the agent's context that you did not write.
- Least privilege. Read-only database users, narrowly scoped tokens, separate accounts for automation.
- Keep approvals on. Let the agent ask before tools that change something.
- Watch the context. Large tool outputs eat the context window;
Claude Code warns above 10,000 tokens and caps output at 25,000 by default
(
MAX_MCP_OUTPUT_TOKENSraises it).
8. MCP servers in coden
In coden, the Agent is Claude Code running on your own computer, in your project directory — so the MCP servers you configured for Claude Code are available to it too, including local ones that never leave your machine. By default every MCP tool call waits for your approval, and you give it from your phone with one tap — or grant a lasting permission once you trust the tool. Ask from the couch “what's behind the error spike in Sentry?” and approve the lookup when your phone buzzes.
Do you see it differently? Write to support@coden-app.com.