Beginner

Introduction to MCP

The Model Context Protocol (MCP) is an open standard by Anthropic that enables AI models to connect to external data sources and tools through standardized servers.

What is MCP?

The Model Context Protocol (MCP) is an open protocol created by Anthropic that provides a universal, standardized way for AI models to interact with external systems. Think of MCP as a "USB-C port for AI" — a single standard that lets any AI model connect to any data source or tool.

Before MCP, every AI integration required custom code. If you wanted Claude to read your database, you wrote a custom function. If you wanted it to search the web, you wrote another. MCP replaces this fragmented approach with a single protocol that works everywhere.

Key Insight: MCP is to AI what HTTP is to the web — a standard protocol that enables an entire ecosystem of interoperable tools and services.

The Problem MCP Solves

AI models like Claude are powerful, but they have limitations:

  • No real-time data: Models are trained on static data and cannot access live information on their own.
  • No tool access: Models cannot natively read files, query databases, call APIs, or interact with services.
  • Fragmented integrations: Every application builds its own custom connectors, duplicating effort across the ecosystem.
  • Security concerns: Ad-hoc integrations often lack proper access controls and sandboxing.

MCP solves all of these by providing a single, secure, reusable protocol for connecting AI to the outside world.

How MCP Works: Hosts, Clients, and Servers

MCP uses a client-server architecture with three key roles:

💻

MCP Host

The application that the user interacts with. Examples: Claude Desktop, VS Code with Cline, a custom chat app. The host initiates connections to MCP servers.

🔌

MCP Client

A protocol client inside the host that maintains a 1:1 connection with an MCP server. The client sends requests and receives responses using JSON-RPC 2.0.

MCP Server

A lightweight service that exposes capabilities (tools, resources, prompts) to the AI model. Servers connect to local or remote data sources.

MCP Architecture Flow
// How a typical MCP interaction works:

UserHost (Claude Desktop)
         ↓
   MCP Client ←→ MCP Server (filesystem)
   MCP Client ←→ MCP Server (database)
   MCP Client ←→ MCP Server (GitHub API)

// Each server exposes:
- Tools: Actions the AI can execute (e.g., "create_file", "run_query")
- Resources: Data the AI can read (e.g., files, database records)
- Prompts: Reusable prompt templates for common tasks

MCP vs Function Calling vs Plugins

Feature Function Calling Plugins (e.g., ChatGPT) MCP
Standard protocol No (vendor-specific) Partially Yes (open standard)
Reusability Per-application Per-platform Universal
Local data access Requires custom code Cloud only Local + remote
Security model Custom per integration OAuth Built-in capabilities & consent
Discovery Manual Plugin store Protocol-level capability exchange
Transport API calls HTTP stdio, HTTP/SSE

Why MCP Matters

📚
Standardization: Build one MCP server and it works with every MCP-compatible AI client — Claude Desktop, Cline, Kilocode, custom apps, and more.
  1. Ecosystem Reusability

    Instead of every AI application building its own database connector, one MCP server for PostgreSQL works everywhere. The community builds once, everyone benefits.

  2. Local-First Privacy

    MCP servers can run locally on your machine, keeping sensitive data (files, databases, credentials) entirely on-device. The AI model never sees data you do not explicitly share.

  3. Composability

    Connect multiple MCP servers simultaneously. Your AI assistant can access files, query a database, search the web, and post to Slack — all through separate, modular servers.

  4. Security by Design

    MCP includes capability negotiation, user consent flows, and sandboxing. Servers declare what they can do; clients confirm what they are allowed to do.

Real-World MCP Use Cases

📁

File System Access

Let Claude read, write, and search files on your local machine through the filesystem MCP server.

🗃

Database Queries

Connect Claude to PostgreSQL, MySQL, or SQLite databases to query and analyze data in real-time.

🌐

Web & API Access

Give Claude the ability to search the web (Brave Search), manage GitHub repos, send Slack messages, and more.

📄

Document Processing

Process PDFs, spreadsheets, and documents through specialized MCP servers for data extraction and analysis.

Important: MCP servers can perform real actions on your system (reading files, executing queries, calling APIs). Always review the capabilities of any MCP server before connecting it, and understand what permissions you are granting.

What's Next?

In the next lesson, we dive deep into the MCP architecture — transport layers, message formats, capability negotiation, and the full connection lifecycle.