MCP authoring: how do you build a Model Context Protocol server in 2025-26?
777 views
70 of 83
1
The problem
Question presented to candidate:
"Say your company wants its product to be usable from Claude, ChatGPT, Cursor and in-house agents, so you are asked to build an MCP server for it. Walk me through how you would build it today: transport, SDK, tool design, errors, auth, testing and deployment. What changed in the protocol recently that affects your design?"
What a strong answer should cover:
Choosing the transport: stdio for a local, per-user process versus Streamable HTTP for a hosted, multi-user service, and what each implies for auth, scaling and logging (stdout is the protocol channel on stdio)
The SDK and version landscape as of late 2026: TypeScript v2 packages (@modelcontextprotocol/server) implementing the 2026-07-28 spec while still serving 2025-era clients, the v1 @modelcontextprotocol/sdk maintenance line, and Python mcp 2.x where FastMCP became MCPServer
Tool design: few task-shaped tools, model-oriented descriptions, strict input schemas, outputSchema plus structuredContent, and annotations as hints
Error semantics: input-validation and execution failures as isError results the model can read and correct, versus JSON-RPC protocol errors such as unknown method or unknown tool
Auth and safety for remote servers: OAuth 2.1 style bearer tokens validated by the server, no token passthrough, least-privilege downstream credentials, Origin/Host validation, and treating tool output as untrusted
Testing and operations: the MCP Inspector, scripted contract tests against the JSON-RPC surface, and the 2026-07-28 move to a stateless core that removes sticky-session requirements behind load balancers
Clarifying questions expected:
Local (runs on the user machine, acts as the user) or remote (we host it for many tenants)?
Which hosts must it work with, and which protocol versions do they speak today?
Read-only access, or will tools change data or cost money?
Code / implementation expected: Yes โ a small server with one or two tools, either with an SDK or as a hand-rolled JSON-RPC loop, plus how you would test it.
mcp
tooling
2
Try it yourself
Sketch your approach before you read the solution. That is what the interview tests.
Stuck? Get a hint.
A short nudge toward the approach. It will not give the answer away.
3
Solution
Target Audience: Engineers asked to expose a product or internal system to AI hosts through MCP, and candidates who need to talk through the build end to end.
Difficulty: Hard
Verified with: Node 22.22.0 and Python 3.12.3 (both examples, identical output). SDK facts were read in October 2026 from the published packages: @modelcontextprotocol/server 2.3.1, @modelcontextprotocol/core 2.3.1, @modelcontextprotocol/node 2.1.1, @modelcontextprotocol/sdk 1.32.1 and the Python mcp 2.3.0 wheel (README, type definitions and source). Spec changes were checked against the official MCP changelog and blog pages found by web search; where only secondary write-ups were available, the text says so.
How to read this doc: Every idea is explained in plain language first, then tagged with ๐ Interview term: so you also learn the words an interviewer expects. All program output
The solution is hidden so you can try first
19 min read ยท 15 sections
4
Read the code
A minimal MCP server over stdio framing, built by hand