beginner
ai-engineering

What is Model Context Protocol?

An introduction to MCP, its architecture, and why it's revolutionizing AI integrations.

mcp fundamentals
10 min read

Introduction to MCP

The Model Context Protocol (MCP) is an open standard that enables AI models to securely connect to data sources, tools, and integrations. Developed initially by Anthropic, it acts as a universal bridge, standardizing how AI Assistants like Claude, Cursor, and custom agents fetch context from local or external environments.

Learning Objectives

  • Understand what MCP is and the problems it solves.
  • Learn the architectural difference between MCP Clients and Servers.
  • Recognize the three core capabilities: Resources, Prompts, and Tools.

Why Do We Need MCP?

Before MCP, AI developers had to build custom, tightly-coupled API wrappers for every new data source they wanted an LLM to access. This lead to scattered codebases, security risks (granting AI full API access), and a lack of interoperability.

MCP solves this by introducing a standardized client-server architecture:

  • Universal Protocol: Write an MCP Server once, and any MCP-compatible client (like Claude Desktop) can connect to it.
  • Security-First: The MCP Server retains full control over the data it exposes. The AI client cannot execute arbitrary code unless explicitly exposed as a "Tool".

Core Architecture

1. MCP Hosts / Clients

The AI application hosting the model. Examples include Claude Desktop, Cursor IDE, or your own custom LangChain wrapper. The client decides when to ping the server.

2. MCP Servers

Lightweight programs (written in TypeScript, Python, etc.) that connect directly to your databases, APIs, or local files. They expose capabilities back to the Client.

3. The Transport Layer

MCP relies on transport mechanisms (typically stdio for local servers executing as subprocesses, or SSE for remote network servers) using JSON-RPC messages.

Capabilities

  • Resources: Read-only data files. Think of it like giving the AI a URL file:///local/log.txt to read from.
  • Prompts: Reusable prompt templates. Instead of copy-pasting complex system messages, the server fetches pre-defined intelligent templates.
  • Tools: Executable functions (e.g., "query_database", "create_jira_ticket"). The AI asks to run the tool, the Server executes it, and sends the result back.

Next Steps

Continue Learning
Now that we understand the architecture, let's write our first TypeScript MCP Server from scratch.

Next Lesson

Creating your first MCP Server