What Is MCP? The Model Context Protocol Explained
The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external tools and data. Instead of every assistant needing a custom, one-off integration for every API or database it talks to, MCP defines one protocol that any assistant and any tool can speak, so the two sides only need to be built once each.
The Problem It Solves
Before a shared protocol, giving an AI assistant access to, say, your CMS or your database meant writing bespoke integration code for that specific assistant. Build a second assistant, or swap providers, and you'd write the integration again. MCP decouples the two: a server exposes your tools and data once, and any MCP-compatible host can connect to it without custom glue code.
The Three Pieces
- Host — the application the user interacts with (an AI assistant like Claude, an IDE, a chat app).
- Client — the part of the host that speaks MCP, embedded inside it, managing one connection to one server.
- Server — a lightweight process that exposes a specific capability: tools to call, resources to read, or prompts to reuse. A server might wrap a database, a SaaS API, or — as with this portfolio's own CMS — a content management system.
A host can connect to many servers at once, giving the assistant one coherent set of tools assembled from several independent integrations.
What a Server Exposes
MCP defines three main primitives:
- Tools — functions the assistant can call, each with a name, description, and a JSON Schema for its parameters. This is how an assistant creates a database record or sends a request.
- Resources — readable data, identified by a URI, that the host can fetch and hand to the assistant as context (a file, a document, a query result).
- Prompts — reusable, parameterized prompt templates a server can offer, so common workflows don't need to be re-written by every user of that server.
Transports: stdio and HTTP
MCP messages are JSON-RPC 2.0, and the protocol defines two common transports for them:
- stdio — the host spawns the server as a local subprocess and talks over standard input/output. Simple, and the default for local tools since there's no network exposure to think about.
- Streamable HTTP — the server runs as its own process (local or remote) and the client talks to it over HTTP, which is what lets a server be shared across machines or deployed centrally rather than spawned fresh by every host.
Moving a server from stdio to HTTP is mostly a transport-layer change — the tool definitions and the logic behind them stay the same.
A Minimal Tool Definition
Conceptually, a single MCP tool looks like this (TypeScript SDK shape):
server.registerTool(
"get_weather",
{
description: "Get current weather for a city",
inputSchema: { city: z.string() },
},
async ({ city }) => {
const data = await fetchWeather(city);
return { content: [{ type: "text", text: JSON.stringify(data) }] };
}
);
The schema is what lets the assistant know the tool exists, what it's for, and exactly what arguments to send — it's doing the same job an OpenAPI spec does for a REST API, just scoped to one callable action.
Where It Shows Up in Practice
A concrete example: this site's own CMS exposes an MCP server with tools like create_post, update_project, and list_services. That's what let an AI assistant draft and publish blog posts, services, and project entries directly through conversation — the assistant never touches the database directly; it calls the same tool interface a human developer could call from any other MCP-aware client.
Security Considerations
- Scope tools narrowly. A tool should do one specific thing, not expose a raw query interface that lets the assistant do anything to your data.
- Validate every input server-side. The schema describes the expected shape, but the server still needs to validate and authorize each call — never trust that a well-typed request is automatically a safe one.
- Treat tool results as untrusted where relevant. If a tool reads external or user-generated content back into the conversation, that content should be treated as data, not as instructions the assistant should follow.
Summary
MCP's core idea is small: a standard way for an AI host to discover and call tools, and read resources, from independent servers — instead of every assistant-to-tool pairing needing its own custom integration. Once a server exists for a system, any MCP-compatible assistant can use it, which is exactly what makes building one worth the effort.
