Skip to content
mentoor

Topic 1 of 5 · 4 min read

Choosing an official MCP SDK and framework

Goal: Pick an SDK and API level for a team's stack and target spec version and explain what the high-level layer does for them.

Pick the official SDK in the language your team already ships, and use its high-level API unless you need to control the protocol yourself. An MCP server is a program that answers JSON-RPC messages: initialize, tools/list, tools/call, resources/read and so on. You can write that by hand. Almost nobody should.

Check yourself · 1 of 3

What does the high-level API of an MCP SDK, such as FastMCP, do for you?

Choose one answer

Why it matters

The protocol has details that are easy to get slightly wrong: capability negotiation, pagination, request ids, cancellation, error codes and schema generation. An SDK handles them and follows each new spec revision. A hand-rolled server tends to work with one client and break with the next.

How to choose

  1. Match the language. The project maintains official SDKs for TypeScript, Python, C#, Java, Kotlin, Go and Rust, among others. Check the SDK page for each one's support tier and which spec version it implements before you commit.
  2. Match the spec version you need. If you rely on a newer feature such as structured tool output, confirm the SDK release supports it. Pin the SDK version in your lockfile.
  3. Pick the API level. Most SDKs offer two layers:
    • High level (McpServer in TypeScript, FastMCP in the Python SDK): you register a function and the SDK builds the tool definition, the JSON Schema from your types, input validation and the result wrapping.
    • Low level (Server with request handlers): you handle tools/list and tools/call yourself and write the schema by hand. Use it for dynamic tool lists, custom routing or unusual capabilities.
  4. Start high, drop down only with a reason.

Before and after

A hand-written handler repeats the schema and the validation:

@server.list_tools()
async def list_tools():
    return [Tool(name="get_order", description="Fetch an order",
        inputSchema={"type": "object",
                     "properties": {"order_id": {"type": "string"}},
                     "required": ["order_id"]})]

@server.call_tool()
async def call_tool(name, arguments):
    if name == "get_order":
        return [TextContent(type="text", text=str(lookup(arguments["order_id"])))]

The high-level version derives the same definition from the function signature and docstring:

mcp = FastMCP("orders")

@mcp.tool()
def get_order(order_id: str) -> dict:
    """Fetch one order by its id, for example ORD-1042."""
    return lookup(order_id)

The schema now cannot drift from the code, because it is generated from it.

What goes wrong

  • Copying a tutorial for the wrong SDK major version. Import paths and class names change between releases. Read the docs for the version you installed.
  • Assuming every SDK supports every feature. Support differs by language and release. Check before you design around a feature.
  • Reaching for the low-level API for no reason. You then own schema drift and validation bugs the SDK would have prevented.
  • Letting a coding assistant write the server from memory. Models often produce code for an older SDK. Give the assistant the current docs page and run the result.

Examples

TypeScript high-level registration

import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";

const server = new McpServer({ name: "orders", version: "1.0.0" });

server.registerTool(
  "get_order",
  {
    description: "Fetch one order by its id, for example ORD-1042.",
    inputSchema: { orderId: z.string().regex(/^ORD-\d+$/) },
  },
  async ({ orderId }) => ({
    content: [{ type: "text", text: JSON.stringify(await lookup(orderId)) }],
  })
);

The zod shape becomes the JSON Schema, and a call with a malformed id is rejected before your handler runs.

Choosing for a mixed team

A team writes its backend in Go and its data tools in Python. The Go service exposes order lookups, and the Python notebooks expose analytics. They build two small servers, each with its own official SDK, rather than one server in a language half the team cannot maintain. A client connects to both.

Key points

  • An SDK implements the protocol details (negotiation, pagination, errors, validation) so your code only holds tool logic.
  • Choose the official SDK for your team's language and check its support tier and spec version before you commit.
  • The high-level API generates the tool schema from your function signature, so the schema and the code cannot drift apart.
  • Use the low-level API only when you need dynamic tool lists, custom routing or capabilities the helper does not expose.
  • Pin the SDK version, because class names and import paths change between releases.

Common mistakes

  • Hand-writing JSON-RPC handling when an official SDK exists for the language.
  • Following a tutorial written for a different SDK version and getting import or method errors.
  • Using the low-level API by default and then maintaining schemas by hand.
  • Letting an AI assistant generate server code without giving it the current SDK docs.

Check yourself · 2 of 3

A team needs dynamic tools that change per user at request time and wants to control tools/list itself. Which API level fits?

Choose one answer

Check yourself · 3 of 3

Before designing a server around structured tool output, what should you verify about your SDK?

Choose one answer

Practice items, not counted towards your mastery.

Start here