EP6 MCP: give the AI hands. Write a tool once, use it from many AIs
MCP is the standard that connects AI to other systems. A 10-line MCP server, plugging it into Claude Code, and what to watch before an AI touches real systems.
- MCP is a standard plug. Write a tool as an MCP server once and every AI that speaks MCP can use it
- A tool's description matters as much as its code, because the AI uses it to decide when to call it
- Start with read-only tools, add write access later, and never install a server you do not know
For five episodes our AI has worked with files and commands on the machine. Real data usually lives elsewhere: a database, a content system, a document search. This episode gives the AI hands to use those systems, through a standard called MCP (Model Context Protocol). It is also the first door to working with other AIs, in the next episode.
The problem: wiring every pair
Without a standard, every time one AI needs one system, someone writes glue for that exact pair. Three AIs and three systems make nine sets, and switching AI means writing them again.
Electricity solved this with a standard plug. An appliance does not need to know which power station the current came from.
Principle: write a tool as an MCP server once, and every AI that speaks MCP can plug into it.
How MCP works
- An MCP server is a small program that announces its tools, each with a name, a description and the input it takes
- An MCP client is the AI, such as Claude Code, which connects to the server and sees the list of tools
- While working, the AI reads the descriptions, decides which tool to call, the server does the real work, and the result comes back
A server connects in one of two ways: run as a local program, or reachable over the network.
The smallest MCP server
Python with the official mcp library:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("notes")
@mcp.tool()
def search_notes(query: str) -> str:
"""Search meeting notes for a phrase and return the matching lines."""
with open("notes.txt", encoding="utf-8") as f:
return "".join(line for line in f if query in line) or "nothing found"
mcp.run()
Then plug it into Claude Code:
claude mcp add notes -- python server.py
From now on, ask “which meeting talked about the budget?” and the AI sees search_notes and calls it itself. Note that the docstring under the function name is the description the AI reads, as important as a skill’s description in EP2.
A real example: one server, two kinds of AI
We wrote three MCP servers for our own use: a search-by-meaning document finder, a media file manager, and an article manager. The last has 5 tools, such as creating and editing articles and fetching cover images, backed by a database.
What makes it interesting is that this one server is used by two kinds of AI at once. One is a team of agents running on local models, connecting over the network. The other is a different AI tool, connecting as a local program. One server codebase, no new glue for either. That is what a standard buys you.
What to watch
- Tools run with your permissions. If a tool can delete data, so can the AI. Start with read-only tools, add write access once you are confident, and have a person confirm anything irreversible.
- Never install a server you do not know. A server is a program running on your machine; treat it like any software install.
- Tool results are data, not instructions. If a tool pulls text from the web or a database others can write to, that text may contain sentences trying to steer the AI. A good setup never lets the AI follow instructions found in data.
- Keep keys out of code and CLAUDE.md. Read them from environment variables.
Try it in 10 minutes
- Make a
notes.txtwith a dozen lines, and createserver.pyfrom the example - Install with
pip install mcp, then runclaude mcp add notes -- python server.py - Open Claude Code and ask about something in the notes. Watch it call
search_notesitself - Make the docstring vague and ask again. You will see the description really does decide whether it gets used
Where a person is needed
A person decides which systems the AI may touch, and how far: read, write or delete. Giving an AI hands is giving it keys; give only what the job needs.
Next episode
With a common standard in place, the next question is: what if Claude is not the right model for every job? EP7 covers getting Claude to work with other AIs, both models running on your own machine and other providers’ models through a single doorway.
FAQ
How is MCP different from an ordinary API?
An API is made for programs to call. MCP wraps it in a shape an AI understands, with a name, a description and an input format for each tool, so the AI can find it and choose to call it without new glue code for every AI.
Can I use other people's MCP servers?
Yes, with the care you would give any program you install. A server runs with your permissions. Use ones from sources you trust, and read what they can reach first.
Commands and settings were tested on sample systems. Try them on a test machine before production.