PHASE 09 · MCP

Standardize your tools

Goal: Make tools portable across agents and clients.

What this is

MCP (Model Context Protocol) is an open standard from Anthropic for how agents talk to tools. Before MCP, every framework had its own tool format — you'd write a tool for LangChain, then rewrite it for Claude Code, then rewrite it again for your own agent.

With MCP, you write a tool once as a small server. Any MCP-compatible client (Claude Desktop, Cursor, Claude Code, your custom agent) can plug in and use it. The protocol covers tools (actions), resources (read-only data), and prompts (templated requests).

The big win is the ecosystem. There are hundreds of community MCP servers — filesystem, GitHub, Slack, Gmail, Postgres, Linear. Once your agent speaks MCP, you can bolt on any of them for free.

The plan

  1. Read the MCP spec (it's short — server, client, tools, resources, prompts). Skim Anthropic's intro doc.
  2. Pick one of your tools — the Phase 5 text-to-SQL tool is a great candidate — and rewrite it as an MCP server using the mcp Python SDK.
  3. Install your server in Claude Desktop's config and verify it works there: ask Claude to query your DB.
  4. Connect the same server to your agent code. Proof: the same server works across multiple clients.
  5. Add a community MCP server (filesystem, GitHub, or Brave search) to your agent. You just gained a capability without writing any code.

Ask your coding assistant

  • MCP introduction — modelcontextprotocol.io. What problem does it solve?
  • Show me a minimal MCP server in Python.
  • What's the difference between MCP, OpenAI function calling, and ChatGPT plugins?
  • Where do I find community MCP servers? What are the highest-quality ones?
  • How do MCP resources and prompts work (not just tools)?

What you'll have when you're done

  • Your tools are now portable — any MCP client can use them.
  • You can plug community MCP servers into your agent for free capability.
  • You understand the boundary between capability (the server) and agent code (the client).
  • You can contribute back to the open MCP ecosystem.

Deliverable

sql_mcp_server/ — A custom MCP server your agent consumes alongside one community server.

Concepts unlocked: tool portability · MCP ecosystem · capability vs. agent code

Intuition

Your agent has come a long way: it calls tools (Phase 4), answers questions straight from your database (Phase 5), and remembers people across sessions (Phase 8). The tools are the part everyone else wants. You'd like your text-to-SQL tool inside Claude Desktop — the Claude chat app you install on your computer. A teammate wants it in Cursor, a coding app. The snag: every app expects tools wired up in its own format. Same tool, three formats, three copies. Fix a bug in one, and you have to remember to fix it in all three.

You've lived this exact problem before — in a drawer at home. Before USB-C, every gadget had its own plug: one cable for the phone, another for the camera, a chunky barrel plug for the laptop, plus a tangle of adapters for the combinations. Then everyone agreed on one plug shape, and suddenly any charger fits any device. MCP (Model Context Protocol) is that agreement, for AI tools. (A protocol is just an agreed format for how two programs talk to each other.)

Here's how the “write once” part works. You wrap your tool in a small server — and that word needs rescuing first: a server is not a big humming machine in a basement. It's just a small program that sits there waiting to be asked for things. Yours can run right on your laptop. And “any app can plug in” isn't magic either: MCP fixes the exact format for the two questions every app needs to ask — “what tools do you have?” and “run this one, with these arguments.” Any app that can say those two sentences in the standard format can use any server that answers them.

If that handshake sounds familiar, it should. In Phase 4 you saw that the LLM never sees your real code — the harness hands it a description of each tool, and the LLM replies “call this tool, with these args.” Tools are not new, and MCP didn't invent them. What MCP adds is a standard for how one program offers its tools to another — so the offering works even between programs that have never heard of each other.

Why this matters compounds fast. Three apps and three tools, each pair wired by hand, is 3 × 3 = 9 custom connections to build and keep in sync. With one standard, each app implements the plug once and each tool implements it once: 3 + 3 = 6 pieces of work, ever. At a company with 5 apps and 20 tools, that's 100 hand-wirings collapsing to 25. Here's the before-picture — every app wired to every tool, separately:

And the after-picture, once everyone agrees on the plug. Same three apps, same three tools — but every line now speaks the same language, so the tangle collapses:

What MCP is. MCP (Model Context Protocol) is an open standard — a public rulebook anyone can read and implement, tied to no single company's product — created by Anthropic for how apps talk to tools. Write a tool once as a small server (a program that waits to be asked for things), and any MCP-compatible app can plug in and use it. USB-C for AI tools.

How MCP works

So a server sits there waiting to be asked. The app doing the asking is called the client — Claude Desktop, Cursor, Claude Code, and your own agent.py are all clients. And a server can offer more than just tools. MCP covers three kinds of things, and the names are worth keeping straight:

  • Tools — actions the model can ask to run. Your query_db from Phase 5 is a tool: it does something and returns the result.
  • Resources — read-only data the client can load into the model's context. Example: Zentara's holiday-calendar file, so the agent can check “is Friday a company holiday?” before promising a delivery date. Nothing runs — it's just a file to read.
  • Prompts — saved, ready-made request templates. Example: the support team's “summarize this ticket” prompt — written carefully once, then offered to every app so nobody retypes (or mistypes) it.

One server can offer all three at once. Here's a single Zentara support server, and the menu any connected client sees:

Keeping the three straight. Tools do, resources know, prompts say. An action to run, data to read, a request template to reuse.
The real prize is the ecosystem. There are hundreds of ready-made MCP servers — filesystem, GitHub, Slack, Gmail, Postgres, Linear. Once your agent speaks MCP, you can bolt any of them on without writing a line of tool code. You write one server, and in exchange you get everyone else's.

Build an MCP server

Time to prove “write once, use anywhere” with your own tool: turn the Phase 5 text-to-SQL tool into an MCP server, use it from Claude Desktop and your own agent, then bolt on a community server for free.

Two quick introductions before you paste the prompt. You met Claude Desktop in the intuition — the Claude chat app you install on your computer, and itself an MCP client. Its config file is a small settings text file where you list the MCP servers it should connect to: add your server there, restart the app, and your tool appears in Claude's toolbox. Your assistant will edit that file for you — you just need to know it exists.

Read what it builds — remember, you never have to write this yourself; your assistant does. A whole tool server is just a few lines:

# sql_server.py — your text-to-SQL tool, as an MCP server
from mcp.server.fastmcp import FastMCP
import text_to_sql

mcp = FastMCP("sql")

@mcp.tool()
def query_db(question: str) -> str:
    """Answer a question by running read-only SQL on the company database."""
    return str(text_to_sql.ask(question))   # your Phase 5 tool

mcp.run()   # any MCP client (Claude Desktop, Cursor, your agent) can now use it

One line deserves a spotlight: @mcp.tool(). That label, sitting right above the function, tells the MCP library “offer this to any connected app as a tool.” That's the entire publishing step — the label puts query_db on the server's menu, and the sentence in quotes under its name becomes the tool description the model reads. The same description idea from Phase 4, now in a standard wrapper.

Deliverable — sql_mcp_server/. A custom MCP server your agent consumes alongside one community server. You wrote a tool once and it works in every MCP client — and you gained a new capability without writing any tool code at all.