What does a minimal MCP server require and how do official SDKs simplify it?
Describe what a minimal MCP server must implement and how the official TypeScript and Python SDKs reduce that implementation burden.
A minimal MCP server handles initialize, tools/list, and tools/call over JSON-RPC; the official SDKs collapse that to a few decorated functions plus a one-line transport.
Think of opening a food stall at a market. The market has a fixed rulebook: you must put up a sign listing what you sell, show prices, and hand over an order when someone pays. Writing all that paperwork by hand for every stall is tedious. The official SDK is like a stall-starter kit: you just write 'I sell coffee, it costs three dollars, here is how I make it', and the kit prints the sign, takes the orders, and counts the money for you. You declare your tools as plain functions, and the SDK builds the catalog, validates the orders, and talks to the customer (the host) in the exact format the market rulebook demands. You pick stdio for a local stall, or Streamable HTTP for a remote one, in a single line.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Concept explanation~2 min read
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Interviewers ask this question to separate candidates who have read the MCP marketing page from candidates who have actually shipped a server. The give-away is whether you can name the exact protocol surface a server must implement, and then explain, concretely, what the official SDKs take off your plate.
The honest answer has two halves. The first half is the raw protocol contract: MCP is JSON-RPC 2.0, and a useful server must satisfy a lifecycle plus a small set of methods. The second half is the ergonomics: the official Python and TypeScript SDKs collapse that contract into a handful of decorated functions, generate your schemas from type hints, and hand you ready-made transports.
This deep dive walks both halves end to end, shows a minimal server, and explains the one real design decision you still own: which transport to pick.
The minimal protocol contract
MCP rides on JSON-RPC 2.0, so every message is a request, a response, or a notification with an id for correlation. A server that wants to offer tools must satisfy three things.
First comes the lifecycle. The host sends initialize, and the server replies with its protocol version, server name and version, and the capabilities it supports (tools, resources, prompts). The host then sends an initialized notification, and only after that does normal traffic flow. Capability negotiation matters here: a server that does not advertise the tools capability will never receive a tools/list call, so forgetting to declare what you support is a silent way to ship a server that appears empty.
Next is discovery, via tools/list. The server returns an array of tool objects, each with a name, a human-readable description, and an inputSchema that is a valid JSON Schema describing the arguments. The host caches this catalog and converts each entry into a tool definition in the model vendor's own function-calling format. That conversion is exactly the seam where MCP, the host-to-server protocol, meets function calling, the model-facing contract.
Finally there is invocation, via tools/call. The host sends a tool name and an arguments object; the server runs the logic and returns a content array. A runtime failure is reported by setting the isError flag on the result, not by raising a transport-level JSON-RPC error. The distinction is deliberate: an isError result is fed back to the model so it can read the message and adapt, whereas a JSON-RPC protocol error signals that the request itself was malformed and breaks the call. Resources and prompts follow the same list then act shape (resources/list plus resources/read, prompts/list plus prompts/get) and are optional. A tools-only server is perfectly valid and is the most common starting point.
Situations where this technique stops working.
2–4 min · Everything important, quickly.
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("weather")
@mcp.tool()
def get_weather(city: str) -> str:
"""Return the current weather for a city."""
return f"Sunny in {city}, 22C"
if __name__ == "__main__":
# stdio for local; swap to transport="streamable-http" for remote
mcp.run(transport="stdio")| Concern | stdio transport | Streamable HTTP transport |
|---|---|---|
| Where it runs | Local subprocess of the host | Remote server over the network |
| Lifecycle | Tied to host process | Independent, long-lived service |
| Auth | None needed (local trust) | OAuth 2.1 bearer tokens |
| Best for | Filesystem, Git, local dev tools | Shared SaaS tools, hosted integrations |
Real products, models, and research that use this idea.
- The Python SDK's FastMCP API lets you expose a tool with one @mcp.tool() decorator and run mcp.run(transport='stdio').
- Anthropic ships official MCP servers for filesystem, Git, and Postgres built on these same SDKs.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow does the SDK keep the advertised inputSchema and the runtime argument validation from drifting apart?
Both derive from one source of truth: the type annotations or Zod schema. The SDK serialises that to JSON Schema for tools/list and reuses it to validate incoming tools/call arguments.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Red flags & common mistakes
The phrases that signal junior thinking. Click to expand.
Thinking you must hand-write JSON Schema and JSON-RPC framing. The SDK generates the schema from your type hints and owns all the wire plumbing.
60 second bullets to scan on the way to the call.
The three mandatory handlers: initialize, tools/list, tools/call
What the initialize handshake negotiates
Primary sources. Browse if you want the original framing.
Same topic, related formats. Practice these next.