What Is MCP? Model Context Protocol Explained
What the Model Context Protocol is, the host–client–server architecture, and why MCP became the standard way to connect AI to tools.
What is MCP?
The Model Context Protocol (MCP) is an open standard for connecting AI applications to tools and data. Think of it as "USB-C for AI": instead of writing a custom integration between every AI app and every service, you build one MCP server for your service, and any MCP-compatible app can use it.
Before MCP, connecting 5 AI apps to 10 services meant up to 50 custom integrations. With MCP, each service ships one server and each app implements one client — 5 + 10 pieces that all work together.
Why developers care about MCP
- Write once, use everywhere — the same server works in desktop AI assistants, IDEs, coding agents and your own apps.
- A shared vocabulary — tools, resources and prompts mean the same thing in every client.
- Separation of concerns — the team that owns the database builds the server; AI app developers just connect to it.
- A big ecosystem — there are MCP servers for GitHub, file systems, databases, browsers, Slack and much more.
For students, MCP is one of the most practical AI skills to learn right now: it sits right where backend development meets AI engineering.
The architecture: host, client, server
| Part | What it is | Example |
|---|---|---|
| Host | The AI application the user interacts with | A desktop AI assistant, an IDE, your chatbot |
| Client | A connector inside the host; one per server | Created by the host for each configured server |
| Server | A program that exposes capabilities over MCP | A "GitHub" server, a "Postgres" server, your own server |
┌──────────── Host (AI app) ────────────┐
│ LLM ⇄ MCP client A MCP client B │
└─────────────┬───────────────┬─────────┘
│ MCP │ MCP
┌──────▼─────┐ ┌─────▼──────┐
│ Files │ │ Database │
│ server │ │ server │
└────────────┘ └────────────┘
The host decides which servers to connect to and when the model may use them. The server never talks to the LLM directly — it only answers the client's requests.
The three primitives
MCP servers expose three kinds of capabilities:
| Primitive | Controlled by | Purpose | Example |
|---|---|---|---|
| Tools | The model | Actions the model can call | create_issue, run_query, send_message |
| Resources | The application | Read-only data loaded into context | A file, a database schema, a config document |
| Prompts | The user | Reusable templates the user picks | "Review this pull request", "Explain this error" |
You'll build all three in the Tools, Resources & Prompts lesson.
Transports: how client and server talk
MCP messages are JSON-RPC 2.0. They travel over a transport:
- stdio — the host starts the server as a local subprocess and talks through standard input/output. Simple, secure by default, perfect for local tools.
- Streamable HTTP — the server runs as a web service that many clients connect to over the network. Used for remote and hosted servers, and needs proper authentication.
The lifecycle of a connection
- Initialize — client and server exchange protocol versions and capabilities.
- Discover — the client lists the server's tools, resources and prompts.
- Use — the host lets the model call tools and reads resources as needed.
- Shutdown — the connection closes when the host is done.
MCP vs tool calling vs APIs
- Tool calling is how a model asks for a function to run.
- An API is how programs talk to a service.
- MCP is the standard wrapper that turns a service into tools, resources and prompts any AI host can discover and use — the model still uses tool calling under the hood.
Common mistakes
- Thinking MCP replaces your API. An MCP server usually calls your existing API; it doesn't replace it.
- Exposing everything as a tool. Read-only context often belongs in a resource; reusable instructions belong in a prompt.
- Using HTTP when stdio would do. For local, single-user tools, stdio is simpler and has a smaller attack surface.
- Ignoring security. Every MCP server is a door into your system — see the security lesson before publishing one.
Key takeaways
- MCP is an open protocol that standardises how AI apps connect to tools and data.
- Hosts contain clients; clients connect one-to-one to servers.
- Servers expose tools (model-controlled), resources (app-controlled) and prompts (user-controlled).
- Local servers use stdio; remote servers use Streamable HTTP.