Skip to main content

MCP Fundamentals

Understand the Model Context Protocol architecture, primitives, and configuration for Claude Code

30 minutes
5 min read
Updated February 11, 2026

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 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.

MCP Architecture
Host creates isolated clients for each server
ComponentRoleExamples
HostThe 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
ClientA 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)
ServerA 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.

TransportHow It WorksWhen to Use
stdioHost launches server as a subprocess. Messages flow through stdin/stdout.Local tools: filesystem, databases, custom scripts. Zero network overhead.
Streamable HTTPServer runs as an HTTP service. Client sends POST requests; server can stream via SSE.Remote/cloud services: GitHub, Sentry, Notion. Supports OAuth authentication.
Transport Comparison

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:

Before and After MCP

Industry Adoption

MilestoneDate
Anthropic releases MCP as open sourceNovember 2024
OpenAI adopts MCP for ChatGPT Desktop and Agents SDKMarch 2025
Google DeepMind confirms MCP support for GeminiApril 2025
Streamable HTTP transport replaces SSESpec 2025-03-26
Anthropic donates MCP to Agentic AI Foundation (Linux Foundation)December 2025
97M+ monthly SDK downloads, 10,000+ active serversLate 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.

MCP Primitives

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.

JSON
{
"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

PrimitiveControlled ByInvoked Via
ToolsThe AI modeltools/call (model decides automatically)
ResourcesThe host applicationresources/read (app decides)
PromptsThe userprompts/get (user selects explicitly)

Configuring MCP in Claude Code

Adding Servers with the CLI

Bash
# Add a remote HTTP server
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
# Add a remote server with auth header
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp \
--header "Authorization: Bearer your-token"
# Add a local stdio server
claude mcp add postgres -- npx -y @modelcontextprotocol/server-postgres \
"postgresql://user:pass@localhost/mydb"
# Add with explicit scope
claude mcp add --transport http notion --scope project https://mcp.notion.com/mcp

Management Commands

Bash
claude mcp list # List all configured servers
claude mcp get github # Get details for a specific server
claude mcp remove github # Remove a server
claude mcp restart # Restart all MCP servers
/mcp # Check status inside Claude Code

The Three Configuration Scopes

ScopeCLI FlagStored InBest For
Local--scope local (default)~/.claude.json (under project path)Personal dev servers, experiments
Project--scope project.mcp.json in project rootTeam-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.

Configuration File Format

.mcp.json (Project scope):

JSON
{
"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 of VAR
  • ${VAR:-default} — uses default if VAR is 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:

MCP Lifecycle
  1. You ask a question that requires external data
  2. Claude Code has already connected to your configured MCP servers
  3. Claude sees available tools and decides which to call
  4. The MCP client sends the request through the appropriate connection
  5. The MCP server executes the action and returns results
  6. Claude receives results and formulates a response

All of this happens automatically. You just ask in natural language.


Next Steps

Now that you understand MCP fundamentals:

  1. Essential MCP Servers → — Install the top 10 servers
  2. Building Custom MCPs → — Create your own
  3. Workflows & Troubleshooting → — Real-world patterns

Share this article