A startup founder can build a first MCP server in Python by instantiating FastMCP and decorating one typed function with @mcp.tool(). Annotations and a clear docstring become the tool schema, so the AI host knows when and how to call it.
The Model Context Protocol is an open standard for connecting AI hosts to outside software. It carries tools, resources, and prompt templates through structured JSON-RPC messages. For a founder, that means one small server can power a demo, pilot, or early product integration.
Table of Contents
- What should you build first?
- How do you turn code into a tool?
- When do resources and prompts help?
- Which transport fits an early product?
- How do you test and ship it?
What should you build first?
Pick one narrow job that proves value. A pricing calculator, order lookup, or document summarizer works better than a broad assistant. A tight scope keeps the schema simple and makes testing faster. Install the current Python SDK, which the SDK installation docs and PyPI list as mcp for Python 3.11 or newer.
Use uv add "mcpcli]" or pip install "mcp[cli]". Then create a file such as server.py and keep the first version to one tool. According to the MCP Python SDK tools documentation, that function becomes callable once it has type hints and a direct docstring [MCP Python SDK tools documentation. Good types reduce bad calls. A short docstring tells the model when to use the tool.
How do you turn code into a tool?
Create FastMCP with a clear name, then place @mcp.tool() above the function. Keep inputs simple, return predictable data, and handle common errors inside the function. This pattern suits actions such as checking inventory or creating a support ticket.
Add a second tool only after the first behaves well. Two reliable tools beat six fragile ones. Early customers notice reliability more than breadth.
- Name the server for the product task
- Write one typed function with a plain docstring
- Return structured data the host can display
- Test the unhappy path before adding more tools
When do resources and prompts help?
Tools act, while resources let the host read. The Model Context Protocol quickstart describes resources as file-like data and prompts as reusable templates. Use a resource for product docs, account status, or project files. Use a prompt when founders repeat the same request shape.
A triage template, proposal outline, or onboarding checklist can save time across customers. Keep templates short and leave room for user input. Do not expose sensitive files as resources by default. Start with read-only material that is safe to share. Expand access after real use shows what customers need.
Which transport fits an early product?
MCP defines stdio and Streamable HTTP as its standard transports, according to the MCP specification transports page MCP specification transports page. Stdio runs the server as a local subprocess over stdin and stdout. Streamable HTTP supports a remote server with multiple clients. Most founders should start with stdio for a local demo or pilot.
It is simpler to run and easier to debug. Move to Streamable HTTP when users need shared access without installing the server. A stdio server must never use print or write other data to stdout, according to the Model Context Protocol build-server guide Model Context Protocol build-server guide. Extra output corrupts the protocol messages. Send logs to stderr with Python logging instead.
How do you test and ship it?
Open the server in MCP Inspector before sharing it with users. The Inspector docs describe listing tools and invoking them through a browser interface. Try normal inputs, missing fields, and unusually long values. Fix confusing names, vague descriptions, and brittle error handling first.
Watch what the tool returns in the Inspector panel. If a person cannot understand the result, the model will also struggle. Once testing looks solid, connect the same server to Claude Desktop, Claude Code, Cursor, or VS Code through each host launch command and configuration, according to the MCP Python SDK real-host guide MCP Python SDK real-host guide. Keep the pilot group small and collect examples of failed calls.