Writing your first MCP server

The smallest useful server is about forty lines: two tools, a schema, and a decision about what not to expose.

Level 310 minMCP servers

Most MCP servers exist because someone needed one endpoint their client did not have. Writing one is a small exercise, and the interesting decisions are not the code.

The shape of it

A server declares a name, registers tools with input schemas, and answers requests. In the TypeScript SDK that is a server object, a tool-registration call per tool, and a transport — stdio for local use.

Prompts to practice with