MCP Fundamentals
Understand the Model Context Protocol architecture, primitives, and configuration for Claude Code
MCP Fundamentals
The Model Context Protocol (MCP) is an open standard that defines how AI applications connect to external data sources and tools. Released by Anthropic in November 2024 and donated to the Agentic AI Foundation (Linux Foundation) in December 2025, MCP has become the industry-standard protocol for giving language models access to the real world.
MCP is like USB-C for AI — a single, universal connector that replaces dozens of bespoke integrations. But it is more than a plug-and-play metaphor. MCP is a full client-server protocol built on JSON-RPC 2.0, with lifecycle management, capability negotiation, and typed primitives.
The Core Insight
Before MCP, every AI tool integration was a custom one-off. MCP replaces all of that with one protocol that any AI application can speak and any tool can implement. Build an MCP server once, and it works with Claude Code, Claude Desktop, VS Code, Cursor, ChatGPT, and every other MCP-compatible client.
The Host-Client-Server Architecture
MCP uses a three-layer architecture. This is not a simple "client talks to server" model — there is an important intermediary.
| Component | Role | Examples |
|---|---|---|
| Host | The AI application that coordinates everything. Creates MCP clients, manages connections, and mediates access between the LLM and servers. | Claude Code, Claude Desktop, VS Code, Cursor |
| Client | A connector within the host. Each client maintains a dedicated, isolated connection to exactly one MCP server. | Internal objects managed by the host (you do not interact with clients directly) |
| Server | A program that provides capabilities. Exposes tools, resources, and prompts over the MCP protocol. | Filesystem server, PostgreSQL server, GitHub server, custom servers you build |
Why three layers? The host acts as a security and coordination layer. It ensures each server connection is isolated (a compromised filesystem server cannot access your database server), that user consent is obtained before tool invocations, and that capability negotiation happens cleanly.
Transport Mechanisms
The transport layer defines how JSON-RPC messages travel between client and server.
| Transport | How It Works | When to Use |
|---|---|---|
| stdio | Host launches server as a subprocess. Messages flow through stdin/stdout. | Local tools: filesystem, databases, custom scripts. Zero network overhead. |
| Streamable HTTP | Server runs as an HTTP service. Client sends POST requests; server can stream via SSE. | Remote/cloud services: GitHub, Sentry, Notion. Supports OAuth authentication. |
SSE Transport is Deprecated
Older docs reference a standalone SSE transport. This has been deprecated in favor of Streamable HTTP. Use --transport http for remote servers.
Why MCP Matters
The Problem It Solves
Before MCP, connecting an AI to external data required custom glue code for every integration — an N-times-M problem:
Industry Adoption
| Milestone | Date |
|---|---|
| Anthropic releases MCP as open source | November 2024 |
| OpenAI adopts MCP for ChatGPT Desktop and Agents SDK | March 2025 |
| Google DeepMind confirms MCP support for Gemini | April 2025 |
| Streamable HTTP transport replaces SSE | Spec 2025-03-26 |
| Anthropic donates MCP to Agentic AI Foundation (Linux Foundation) | December 2025 |
| 97M+ monthly SDK downloads, 10,000+ active servers | Late 2025 |
What This Means for You
MCP gives Claude Code:
- Real-time data access — Query production databases, check Sentry errors, pull from GitHub, without copy-pasting
- Automation loops — Chain actions: "Find the bug in Sentry, create a GitHub issue, draft a fix, open a PR"
- Context persistence — MCP connections maintain state across your session
- Cross-tool composability — Combine any set of servers into a full development environment
The Three MCP Primitives
MCP servers expose three types of capabilities, each with a different control model.
Tools (Model-Controlled)
Tools are executable functions that Claude can invoke to perform actions. The model decides whether and when to call them based on conversation context.
Think of tools as the "hands" of the AI — they let it do things.
{ "name": "query_database", "description": "Execute a read-only SQL query against the analytics database", "inputSchema": { "type": "object", "properties": { "query": { "type": "string", "description": "SQL query to execute (SELECT only)" } }, "required": ["query"] }}Resources (Application-Controlled)
Resources are data sources that provide context. Unlike tools, they are not actions — they are information. The host decides how to incorporate resource data.
Think of resources as the "eyes" of the AI — they let it see things it could not otherwise access.
Each resource has a unique URI (e.g., file:///project/schema.sql, git://repo/main) and can support subscriptions for real-time updates.
Prompts (User-Controlled)
Prompts are pre-defined message templates that users explicitly select. They are the most "human-in-the-loop" primitive.
Think of prompts as "recipes" — structured workflows that a server author packages for common tasks. In Claude Code, they are accessible via /mcp__servername__promptname commands.
Summary: Who Controls What
| Primitive | Controlled By | Invoked Via |
|---|---|---|
| Tools | The AI model | tools/call (model decides automatically) |
| Resources | The host application | resources/read (app decides) |
| Prompts | The user | prompts/get (user selects explicitly) |
Configuring MCP in Claude Code
Adding Servers with the CLI
# Add a remote HTTP serverclaude mcp add --transport http github https://api.githubcopilot.com/mcp/ # Add a remote server with auth headerclaude mcp add --transport http sentry https://mcp.sentry.dev/mcp \ --header "Authorization: Bearer your-token" # Add a local stdio serverclaude mcp add postgres -- npx -y @modelcontextprotocol/server-postgres \ "postgresql://user:pass@localhost/mydb" # Add with explicit scopeclaude mcp add --transport http notion --scope project https://mcp.notion.com/mcpFlag Ordering
All flags (--transport, --env, --scope, --header) must come before the server name. The -- separates flags from the command arguments passed to stdio servers.
Management Commands
claude mcp list # List all configured serversclaude mcp get github # Get details for a specific serverclaude mcp remove github # Remove a serverclaude mcp restart # Restart all MCP servers/mcp # Check status inside Claude CodeThe Three Configuration Scopes
| Scope | CLI Flag | Stored In | Best For |
|---|---|---|---|
| Local | --scope local (default) | ~/.claude.json (under project path) | Personal dev servers, experiments |
| Project | --scope project | .mcp.json in project root | Team-shared servers (commit to git) |
| User | --scope user | ~/.claude.json (global section) | Personal utilities across all projects |
Precedence: Local wins over project, which wins over user.
Sharing with Your Team
Use --scope project to write configurations to .mcp.json at your project root. Commit this file so everyone gets the same MCP tools. Claude Code prompts each user for approval before using project-scoped servers.
Configuration File Format
.mcp.json (Project scope):
{ "mcpServers": { "github": { "type": "http", "url": "https://api.githubcopilot.com/mcp/" }, "postgres": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-postgres"], "env": { "DATABASE_URL": "${DATABASE_URL:-postgresql://localhost/mydb}" } } }}Environment Variable Expansion
The .mcp.json file supports environment variable expansion:
${VAR}— expands to the value ofVAR${VAR:-default}— usesdefaultifVARis not set
This works in command, args, env, url, and headers fields. Essential for sharing configs without hardcoding secrets.
The Complete Lifecycle
Here is what happens when you ask Claude a question that requires external data:
- You ask a question that requires external data
- Claude Code has already connected to your configured MCP servers
- Claude sees available tools and decides which to call
- The MCP client sends the request through the appropriate connection
- The MCP server executes the action and returns results
- Claude receives results and formulates a response
All of this happens automatically. You just ask in natural language.
Check Status Anytime
Type /mcp inside Claude Code to see all connected servers, their status, available tools, and authentication state. This is the quickest way to debug connection issues.
Next Steps
Now that you understand MCP fundamentals:
- Essential MCP Servers → — Install the top 10 servers
- Building Custom MCPs → — Create your own
- Workflows & Troubleshooting → — Real-world patterns
You Now Understand MCP!
MCP turns Claude from an assistant that only sees what you show it into an integrated development partner with direct access to your tools and data. The rest of this track is about putting that power to practical use.