Building Your First MCP Server: TypeScript vs. Python
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 zodCode
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 mcpCode
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?
| Feature | TypeScript (Standard SDK) | Python (FastMCP) |
|---|---|---|
| Best For | High‑performance, type‑safe tools | Rapid prototyping, AI logic |
| Validation | Zod (explicit & strict) | Pydantic / type hints (implicit) |
| Verbosity | Moderate (structured) | Minimal (decorator‑based) |
| Transport | STDIO, SSE, custom | STDIO, 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.pyThis 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.