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.