What you'll get out of this post
MCP (Model Context Protocol) is everywhere right now, but most introductions open with a definition and an architecture diagram, and you finish them still not knowing why it exists in the first place. This post works the other way around:
- We start from one concrete need -- getting AI to manage my WordPress site -- and reason step by step until you arrive at "we need something like MCP" on your own
- We cover what MCP solves, and what it doesn't solve (the part almost nobody talks about)
- We pin down the real relationship between the four roles -- MCP server / MCP client / LLM / host -- and settle the question "is Claude Code or Codex actually an LLM?"
- We cover MCP's three primitives -- Tools / Resources / Prompts -- and when to use MCP versus when to just write tools directly
This is part one (the theory)
By the end of this post, you'll understand MCP. Part two, Hand-Writing a WordPress MCP, walks you through building the server and client from scratch until "publish a post with one sentence" actually works -- by the end of that one, you'll be able to do it. The two posts share one real, runnable experiment; full code is on GitHub: github.com/stanleyyylau/wp-mcp.
The setup: I want AI to manage my WordPress
Let's nail down the scenario first -- everything that follows builds on it.
I have a WordPress site. I want to tell an AI "write a post about autumn, add a cover image, and publish it" and have it actually create the post, upload the image, and hit publish. Not hand me a wall of text to copy-paste, but actually operate my site.
The core tension here fits in one sentence:
The fundamental limitation of LLMs
A language model only generates text. It can't reach the network, read your database, call your APIs, or touch your WordPress. Everything it emits is just a string of characters.
So if you want AI to "operate" anything, there's really only one way: we write the code that does the real work (functions) outside the model, then find a way for the model to "decide" when to call which function with what arguments. The model supplies the plan; our code supplies the hands.
That mechanism is
Key Concept
Function Calling / Tool Use
create_post with arguments {...}"; your code executes it, feeds the result back to the model, and the model decides what to do next. The model never touches any tool itself -- it only emits a structured statement of intent about which tool it wants called.Version one: weld the tools straight into the agent
The simplest approach -- and one that works perfectly well -- is a single script that defines both the tool's description (for the model) and the tool's implementation (the code that actually calls the WordPress REST API).
// Tool menu: the "catalog" the model gets to see
const tools = [{
name: "create_post",
description: "Create and publish a post on WordPress",
parameters: {
type: "object",
properties: {
title: { type: "string" },
content: { type: "string" },
},
required: ["title", "content"],
},
}];
// Tool implementation: the code that does the real work
async function createPost(args) {
return fetch("http://my-wp.com/wp-json/wp/v2/posts", {
method: "POST",
headers: { Authorization: BASIC_AUTH, "Content-Type": "application/json" },
body: JSON.stringify({ ...args, status: "publish" }),
}).then((r) => r.json());
}
// Agent loop: model decides -> I execute -> feed back -> repeat
while (true) {
const reply = await llm.chat(messages, tools);
if (!reply.tool_calls) break; // model is done calling tools
for (const call of reply.tool_calls) {
const result = await createPost(call.args); // do the work
messages.push({ role: "tool", content: JSON.stringify(result) });
}
}
That's a working AI agent. You say "publish a post", the model writes the title and body, decides to call create_post, and your code really publishes it. It genuinely works.
Hold on to this conclusion
If it's just you, one application, and three to five tools -- stop here. You don't need MCP at all. Welding the tools straight into the agent is the simplest, most efficient approach. We'll come back to this point in detail later.
So where does it break down? It breaks down because the world isn't "one application x a handful of tools".
Version two: when both sides start multiplying
Zoom out. In practice, two things grow at the same time:
The tool side grows. You don't just want WordPress. You also want AI to query your database, read your GitHub, send Slack messages, drive Notion, hit internal company APIs... and each one needs its own "tool description + tool implementation" pair.
The application side grows too. You're not using this in just one script. You want it in Claude Desktop, in Cursor, in Claude Code, in your own support bot, in your coworker's Python project...
Now put them side by side:
The real cost of hardwiring: M x N
Every app writes its own integration code for every single tool below
↓
M x N copies of duplicated glue code
M applications, each integrating N tools, means M x N sets of integration code. And every one of them re-solves the same problems: how to describe a tool, how to translate the model's intent into a real call, how to handle auth, how to feed results back.
Three things make it even worse:
- Tools get locked inside applications. The WordPress integration you wrote for your support bot is useless to Cursor -- it lives in another process, in another language.
- Whoever writes a tool has to understand AI. If the WordPress team wants their product to be "operable by AI", they'd have to study every AI application's tool format and submit code to each one separately. That simply doesn't scale.
- There are no boundaries. Tool descriptions, implementations, and the API format of one specific model are all tangled together -- switch models or switch apps and you rewrite everything.
At this point, anyone who's done real engineering instinctively asks the key question --
By now, the answer is practically writing itself
Can we decouple the "tool provider" side from the "tool consumer" side? Let providers expose their capabilities through one shared standard, and let applications integrate through that same standard -- so neither side needs to know anything about the other's internals?
This is a pattern computer engineering has validated over and over: when M x N gets too expensive, insert a standard protocol in the middle and turn it into M + N. Two classic examples make it concrete:
- USB solved "peripherals x computers". Before USB, every device category had its own connector and driver story: mice on PS/2, printers on parallel ports, modems on serial ports, plus a pile of proprietary plugs. Every pairing of device and computer platform was its own integration. USB replaced all of it with one contract -- a device implements USB once, a computer provides USB once, and any device works with any host.
- LSP (Language Server Protocol) solved "editors x programming languages". Editor intelligence -- autocomplete, go-to-definition, error squiggles -- requires code that deeply understands each language. Before LSP, that code had to be rewritten inside every editor, for every language: VS Code needed its own TypeScript engine, Vim a separate plugin, Emacs a third, then multiply by Python, Go, Rust... With LSP, each language ships one language server (
goplsfor Go,pyrightfor Python) and each editor implements one generic LSP client -- and any editor gets smart about any language.
MCP is the same playbook applied to "AI applications x tools/data sources".
By the way, this trick is older and runs deeper than either example -- the same move is behind TCP/IP, LLVM, JDBC, even shipping containers. I've pulled the principle apart in its own post, The M x N Problem: One Pattern Behind USB, LSP, and MCP. Internalize it once, and MCP stops being "a new thing to learn" -- it's basic engineering fundamentals wearing this year's costume.
What MCP is: turning M x N into M + N
Key Concept
MCP (Model Context Protocol)
An open protocol that defines how to talk between "the party that wants to give AI capabilities" and "the AI application that wants to use them". The provider wraps itself as an MCP Server that exposes tools and data per the standard; the AI application embeds an MCP Client that connects, discovers, and calls per the same standard. Both sides speak only the protocol -- never each other's implementation.
Insert that layer, and the diagram above changes:
With MCP: M + N
M apps, each implementing 'speaks MCP' exactly once
↓
↓
N tools, each implementing an MCP Server exactly once
The key shift: the WordPress MCP Server is written once, and every application that speaks MCP can use it. Conversely, as long as your bot speaks MCP, it can connect to every MCP Server in the world without writing per-tool glue. M x N becomes M + N.
That widely quoted analogy -- "MCP is USB-C for AI" -- should now click for a real reason, not just because it sounds good: before USB-C, every device shipped its own charging port and cable (M x N); after USB-C, devices just expose a Type-C port, hosts just provide a Type-C port, and one cable in the middle handles everything (M + N). MCP is that "standardized connector shape" for the AI world.
⚡ Iron Rule #1
MCP is fundamentally decoupling, not new capability
MCP gives AI no ability it couldn't already have -- Function Calling could invoke tools long before MCP existed. What MCP solves is an engineering problem: decoupling tool providers from tool consumers, so a capability can be written once and reused everywhere. When deciding whether to use MCP, always start by asking "do I actually have an M x N reuse problem here?"
The four roles: who's who, once and for all
This is where most people get tangled up, so let's pin down all four roles using the WordPress example.
The four roles in one 'have AI publish a post' run
| Header | Meaning | Example |
|---|---|---|
Host | The application you interact with directly; orchestrates everything and owns the conversation | Claude Desktop / Claude Code / Cursor / the CLI we hand-write in part two |
MCP Client | A piece of code inside the Host -- one per connected Server -- that speaks the MCP protocol | The part of the Host that talks to the WordPress Server |
LLM (the brain) | The model that decides which tool to call with what arguments; it can't touch any tool itself | Claude / DeepSeek / GPT |
MCP Server | The party that does the real work, wrapping a system's capabilities as tools/resources | WordPress MCP Server (calls the WP REST API underneath) |
Here's how they chain together:
The complete data flow of one 'publish a post' run
↓
↓
↓
↓
↓
Once you can read this chain, you can answer the question that trips everyone up:
So is Claude Code or Codex an LLM?
No. They're Hosts (with MCP Clients inside), not LLMs.
Claude Code CLI, Codex CLI, Claude Desktop, Cursor -- they're all fundamentally MCP Hosts: they manage the conversation, call out to an LLM, and embed MCP Clients to connect to MCP Servers. They use LLMs (Claude Code uses Claude, Codex uses GPT), but they are not models themselves.
Keeping them separate from the LLM buys you something concrete: the same MCP Server works no matter which brain is behind it. The WordPress Server we hand-write in part two can be driven by our DeepSeek-powered CLI, or dropped as-is into Claude Desktop and driven by Claude -- because they all speak the same protocol. The Server couldn't care less which model is on the other side.
There's one more point that's easy to miss but matters a lot: the LLM doesn't understand MCP, and the Server doesn't understand the LLM. The LLM only knows the "tool menu" in its own API format; the MCP Server only knows the MCP protocol. The thing that bridges them -- doing the "format translation" -- is precisely the client code inside the Host. Note that the LLM side of this translation is provider-specific: Anthropic, OpenAI, and Gemini each have their own function-calling dialect, so a multi-provider Host needs a translator per dialect (part two shows why that's far less painful than it sounds). Which is exactly why part two is hand-written end to end: it's the only way to see, on a specific line of code, where that translation happens.
Three primitives: MCP is more than "remote function calls"
If MCP could only expose "tools", it really would just be remote Function Calling. But the protocol defines three kinds of capability (called "primitives"), each solving a different class of problem. Covering only the first one sells MCP short.
MCP's three primitives (in WordPress terms)
| Header | Meaning | Example |
|---|---|---|
Tools | Let the LLM 'take actions' -- usually with side effects, invoked at the model's discretion | Create a post, upload an image, build a menu, delete a post |
Resources | Let the Host 'read context' -- read-only data, identified by a URI | wp://posts/123 = a post's body; wp://site/info = site config |
Prompts | Reusable workflow templates baked into the Server, triggered by the user in one click | /weekly_digest = roll recent posts into a weekly digest draft |
The split between them comes down to who initiates, and whether there are side effects:
- Tools are "actions". The model reads the tool descriptions and decides on its own whether and which to call. Creating a post changes your site -- that's a side effect.
- Resources are "read-only data". They solve a different problem: "how do I feed external data to the model as context?" Say you want the AI to "write a new post in the style of post #123" -- the Host can read
wp://posts/123first and stuff it into the conversation. Semantically it's read-only; nothing gets modified. - Prompts are "templates". This is the most overlooked primitive. It's not a "system prompt" -- it's a set of preset, user-triggerable actions the Server offers to the Host. In Claude Desktop they show up as slash commands. The point is to capture how an expert would use this Server so that a regular user can just click, instead of figuring out how to compose the tools themselves.
Why the distinction matters
Because each primitive has a different locus of control inside the Host: Tools are invoked when the model decides; Resources enter the context when the application/user decides; Prompts fire when the user triggers them. Separating "reading data" from "taking actions" is also a security design -- you can comfortably expose a pile of Resources for the model to read, while gating side-effecting Tools behind an extra confirmation.
In part two we implement all three primitives against WordPress and run them for real -- it'll feel much more tangible.
Honestly: what MCP doesn't solve
There's no shortage of articles hyping MCP. But to make a real technical decision, you need to know where its boundaries are.
MCP is not a silver bullet
MCP is a protocol/plumbing layer. It makes capabilities reusable, but it doesn't make either end any smarter, and it takes no responsibility for security. None of the problems below are solved by MCP.
- It doesn't make the model smarter. Picking the wrong tool, filling in bad arguments, failing to call a tool when it should -- those are all LLM capability problems. MCP only guarantees "the model's intent gets faithfully delivered to the Server"; whether that intent is any good is not its department. In fact, the more tools you expose, the easier it is for the model to pick wrong.
- It doesn't solve auth and security. "Just hand over an admin URL and a password" sounds great, but it also means: once an MCP Server holds your credentials, it -- and the model driving it -- can do anything those credentials allow. A tool that can modify your site and read your database, paired with a model that can be talked into things via prompt injection, is a real risk. Authentication, permission boundaries, and auditing are yours to build into the Server.
- It adds a layer of latency and complexity. One more process, one more protocol handshake, one more round of serialization. For a small tool that only ever serves one application, that overhead is pure cost.
- The protocol is still young. Transports (stdio / HTTP), auth specs, and version compatibility are all still evolving, and the maturity of ecosystem tooling is uneven.
So: when do you use MCP, and when do you just open up tools?
Condensing everything above into one actionable decision table:
Decision table
| Header | Meaning | Example |
|---|---|---|
Only one application uses it | No M, so there's no M x N to speak of | -> Weld the tools into the agent; skip MCP |
Three to five highly specific tools | Low reuse value; the wrapping cost isn't worth it | -> Just write the tools directly |
Multiple apps need to reuse the same capabilities | Classic M x N scenario | -> Use MCP; write the Server once, plug in everywhere |
You want others (incl. Claude/Cursor) to integrate your capabilities | You're building the 'integrated-into' side | -> Use MCP; this is exactly its home turf |
Capabilities must be reused across languages/processes | A hardwired setup can't do this | -> Use MCP; process isolation + language-agnostic |
Extremely latency-sensitive, trivially simple logic | An extra protocol layer is pure overhead | -> Write the tools directly, or inline the functions |
⚡ Iron Rule #2
Ask 'is there reuse?' before deciding on MCP
MCP's payoff comes from reuse (M+N < M x N) and standardization (being integrable by any Host). Without either of those needs, plain Function Calling is simpler and faster. Don't wrap a single-app, three-tool project in a protocol layer just because MCP is trendy. Conversely, the moment you're designing a capability to be integrated by many AI applications, MCP is essentially the only right answer.
Wrapping up: you should get it now
Pulling the chain of reasoning together:
- LLMs only generate text; to act on the real world, you need external tools + Function Calling.
- With one application and few tools, welding the tools straight into the agent is all you need.
- Once both apps and tools multiply, hardwiring becomes M x N copies of duplicated glue, with tools locked inside applications.
- The standard engineering fix is to insert a protocol layer and turn it into M + N -- that's MCP.
- Four roles: the Host contains the Client, uses an LLM, and connects to Servers; Claude Code/Codex are Hosts, not LLMs.
- MCP has three primitives: Tools (take actions) / Resources (read data) / Prompts (templates).
- MCP doesn't make models smarter and doesn't handle security -- and it isn't the right call for every scenario.
In the next post, we put all of this theory into practice: spin up a real WordPress in Docker, hand-write an MCP Server (all three primitives) and an MCP Client (with an agent loop against the official DeepSeek API), get "publish a post with a cover image from one sentence" actually working, and finally plug that same Server into Claude -- you'll watch all four roles cooperate line by line in your terminal.
See you in part two