Building Your First MCP Server: TypeScript vs. Python

Published: (April 6, 2026 at 05:11 PM EDT)
3 min read
Source: Dev.to

Source: Dev.to

The 5‑Minute “Hello World” Comparison

Whether you are a TypeScript veteran or a Python enthusiast, building an MCP server is surprisingly simple. Below are “Hello World” implementations in both languages to show how the Model Context Protocol abstracts away the complexity.

The TypeScript Approach (Node.js)

Prerequisites

npm install @modelcontextprotocol/sdk zod

Code

import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";

const server = new Server(
  {
    name: "hello-world-server",
    version: "1.0.0",
  },
  {
    capabilities: { tools: {} },
  }
);

// Define a simple greeting tool
server.tool(
  "greet_user",
  { name: z.string().describe("The name of the person to greet") },
  async ({ name }) => {
    return {
      content: [{ type: "text", text: `Hello, ${name}! Welcome to the MCP Mesh.` }],
    };
  }
);

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
}

main().catch(console.error);

The Python Approach

Prerequisites

pip install mcp

Code

import asyncio
from mcp.server.fastmcp import FastMCP

# Initialize FastMCP – the "Quick Start" wrapper
mcp = FastMCP("HelloWorld")

@mcp.tool()
async def greet_user(name: str) -> str:
    """Greets a user by name."""
    return f"Hello, {name}! Welcome to the MCP Mesh."

if __name__ == "__main__":
    mcp.run(transport='stdio')

Side‑by‑Side: Which Should You Choose?

FeatureTypeScript (Standard SDK)Python (FastMCP)
Best ForHigh‑performance, type‑safe toolsRapid prototyping, AI logic
ValidationZod (explicit & strict)Pydantic / type hints (implicit)
VerbosityModerate (structured)Minimal (decorator‑based)
TransportSTDIO, SSE, customSTDIO, SSE

How to Test Your Server

Once you’ve saved your code, you can test it with the MCP Inspector—no complex frontend required.

# For TypeScript
npx @modelcontextprotocol/inspector node build/index.js

# For Python
npx @modelcontextprotocol/inspector python your_script.py

This launches a local web interface where you can perform the “Protocol Handshake” and trigger your tools manually, verifying your “Zero‑Glue” infrastructure before connecting it to an agent.

Conclusion

The “Zero‑Glue” architecture isn’t about which language you use—it’s about the Protocol. The logic for the “Hello World” tool is nearly identical in both versions, and the Model Context Protocol ensures that agents can discover and use your tools in a standardized way.

Ready to build your own?
Check out the reference repository for more complex examples, including Notion and Oracle 26ai integrations.

What’s Next?

The Mesh is built. The agents are ready. But can you trust them? In the next series we’ll explore the Science of Reliability—building evaluators that turn AI experiments into production‑grade systems.

0 views
Back to Blog

Related posts

Read more »

The Stack Nobody Recommended

The Backend: FastAPI I come from JavaScript and TypeScript—years of React on the frontend, Express and Fastify on the backend. When I decided this project woul...