You want to build an MCP server in Python. What do you install and what does the API look like?
Install the `mcp` package from PyPI. The SDK exposes FastMCP, a decorator-driven API that auto-generates JSON Schema from type hints, uses docstrings as tool descriptions, and ships stdio plus streamable HTTP transports.
Imagine you write a small Python file with a few functions that do useful things: add numbers, list files, query a database. The MCP Python SDK is a tiny library that lets you put one decorator above each function and turns the file into a server that any MCP host (Claude Desktop, Cursor, Zed) can connect to and call. The library reads your type hints to figure out what arguments each function expects, so the AI knows how to call you. You write normal Python; the SDK turns it into a tool server.
Detailed answer & concept explanation~5 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
3 min: PyPI name and install command, GitHub repo, FastMCP decorator API with a code example, type-hint schema generation, three primitive decorators, default transport and how to switch.
Real products, models, and research that use this idea.
- A data team wraps their internal feature-store query API as a FastMCP server in roughly 50 lines, letting engineers ask Claude Desktop questions about feature freshness and data quality.
- An ML engineer exposes a Hugging Face datasets browser as MCP resources so the model can read dataset cards and metadata on demand without hardcoded URLs.
- An on-call team wraps PagerDuty incident search and acknowledge as FastMCP tools so an agent-mode assistant in Cursor can triage alerts during production incidents.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does FastMCP turn Python type hints into JSON Schema?
QWhen would you reach for the low-level Server API instead of FastMCP?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Pip-installing model context protocol or mcp-sdk instead of the canonical name `mcp`. The correct PyPI package is just `mcp`, maintained by Anthropic.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.