Posts

Build Your First MCP Server: Five Steps, One File

A hands-on Python walkthrough with FastMCP. Build a parts lookup server and connect it to Claude Code in five steps, one file, and about 15 minutes.

Aaron Murray, the Guy in the Hat, presents an MCP connector beside a laptop in the Hat in the Loop whiteboard style. Five steps, one file, about 15 minutes.

Everyone's talking about MCP. Almost nobody's showing how small it actually is.

Here's a hands-on walkthrough in Python with FastMCP. From empty folder to an AI calling your own code. Five steps, one file, about 15 minutes.

We're building a parts lookup. Small enough to understand. Useful enough to see where this could go.

First, what is MCP?

MCP stands for Model Context Protocol. Think of it as a standard plug.

You write a small server that says, "Here's what I can do." An MCP-aware AI tool, like Claude or Cursor, can connect, discover those tools, and use them.

Your code → MCP server → Any compatible AI tool.

Write the plug once. Not a custom integration for every AI tool.

Step 1: Set up

You'll need Python 3.10+ and uv. For Step 4, have Claude Code installed and signed in.

Open a terminal. Run these three commands.

uv init my-first-mcp
cd my-first-mcp
uv add fastmcp

uv also creates a main.py... ignore it.

Step 2: Write the server

Create server.py in your project folder.

from fastmcp import FastMCP

mcp = FastMCP("Parts Lookup")

PARTS = {
    "A-1042": "Hydraulic filter, 10 micron",
    "B-2210": "Drive belt, 48 inch",
}

@mcp.tool
def lookup_part(part_number: str) -> str:
    """Look up a part description by part number."""
    return PARTS.get(part_number, "Part not found")

if __name__ == "__main__":
    mcp.run(transport="http", port=8000)

That's it. That's the whole server.

The line that matters most

The most important line isn't the code that runs. It's the one-sentence description... the docstring.

That sentence becomes the tool's description. It helps the AI decide when to call it.

Vague:

"""Gets data."""

Clear:

"""Look up a part description by part number."""

Write it like you're explaining the tool to a new hire.

Step 3: Run it

In your project folder, run:

uv run server.py

Look for the Uvicorn startup message showing port 8000.

Your server is running.

Leave this terminal open. Open a second one for Step 4.

Step 4: Connect it

In a second terminal, open the same project folder. Add the server to Claude Code:

claude mcp add --transport http parts \
    http://localhost:8000/mcp

Start Claude Code by typing claude.

Ask: "What's part A-1042?"

Approve the tool call if prompted.

The answer: "Hydraulic filter, 10 micron."

Your data. Not the internet's.

Using Claude Desktop? Local servers use a different setup. Hosted connectors are another option... a topic for another post.

Step 5: Make it real

Swap the dictionary for something that matters. Your parts database. Your service manual index. Your CRM. Your ticket queue.

The pattern doesn't change: a function, a clear description, a decorator.

Start with one tool. Read-only. Something boring.

Boring is where the value is.

The lookup your team does 40 times a day beats anything flashy.

Reading: easier to trust.

Writing: a governance conversation.

Why is this so complicated, and does it have to be?

Turns out, not really.

What's the first thing you'd connect? Drop it in the comments and I'll tell you how I'd scope it.