MCP · Lesson 8 of 120
Your First Server
One tool.
Let's build a server with one tool. Northwind customers want to know if delivery is free. We'll write a normal Python function, and turn it into an MCP tool with one decorator.

- One tool
- A normal function
- One decorator
A delivery cost tool
MCP server creates a server named Northwind. The tool decorator turns the function into a tool. The docstring becomes its description. And run starts the server, using standard IO by default.
northwind.pypython
from mcp.server.mcpserver import MCPServer
mcp = MCPServer("northwind")
@mcp.tool()
def delivery_cost(order_total: float) -> str:
"""UK delivery cost for an order total in pounds."""
return "free" if order_total >= 50 else "£4.99"
if __name__ == "__main__":
mcp.run()What the decorator does
The tool decorator reads the function's name, type hints, and docstring. From those it builds the tool's name, input schema, and description. You write plain Python, and the SDK handles the protocol.
| key | value |
|---|---|
| Name | from the function |
| Inputs | from type hints |
| Description | from the docstring |
| Protocol | handled for you |
Summary
A server is an MCP server object, with functions marked as tools. Next, calling our tool from a client.
Key takeaways- MCPServer
- @mcp.tool()
- mcp.run()
Next up: Your First Client — call it in-process