Introducing mcp-framework
A deep dive into mcp-framework — the convention-based TypeScript framework for building MCP servers. Learn about its CLI, auto-discovery, and how it compares to building from scratch.
title: "Introducing mcp-framework" description: "A deep dive into mcp-framework — the convention-based TypeScript framework for building MCP servers. Learn about its CLI, auto-discovery, and how it compares to building from scratch." date: "2026-04-01" order: 2 keywords:
- mcp-framework
- MCP server framework
- TypeScript MCP
- MCP CLI
- Model Context Protocol framework
- build MCP servers author: "MCP Academy"
mcp-framework is a TypeScript framework that makes building MCP servers fast and intuitive. It provides a CLI for scaffolding, class-based architecture with decorators-like patterns, and automatic discovery of tools, resources, and prompts. This post covers what it is, why it was built, and how it compares to building MCP servers from scratch.
The Problem With Building MCP Servers From Scratch
Building an MCP server using the official TypeScript SDK gives you complete control. You can wire up every handler, customize every transport, and manage every lifecycle event. But that flexibility comes with overhead.
Here is what a minimal MCP server looks like with the raw SDK:
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
const server = new McpServer({
name: "my-server",
version: "1.0.0",
});
server.tool("greet", { name: { type: "string" } }, async ({ name }) => ({
content: [{ type: "text", text: `Hello, ${name}!` }],
}));
const transport = new StdioServerTransport();
await server.connect(transport);
This is fine for a single tool. But as your server grows to dozens of tools, resources, and prompts, all of that registration code piles up in a single file. You end up managing imports, handler registration, input validation schemas, and transport setup all manually. For production servers with 20 or 30 tools, this becomes unwieldy.
A convention-based TypeScript framework for building MCP servers. It provides a CLI, class-based architecture, and automatic discovery of tools, resources, and prompts from the file system.
What mcp-framework Does Differently
mcp-framework takes a convention-over-configuration approach inspired by frameworks like Ruby on Rails and NestJS. Instead of manually registering every component, you define classes in specific directories and the framework discovers and wires them up automatically.
The CLI
Getting started takes one command:
npx mcp-framework create my-server
cd my-server
npm install
This scaffolds a complete project with the right directory structure, TypeScript configuration, and a working example tool.
Need to add a new tool? Instead of writing boilerplate:
npx mcp-framework add tool weather-lookup
This generates a properly structured tool class in src/tools/weather-lookup.ts with input validation, the execute method, and all the required type annotations.
The same works for resources and prompts:
npx mcp-framework add resource config-data
npx mcp-framework add prompt code-review
Class-Based Architecture
Every tool, resource, and prompt in mcp-framework is a class that extends a base class. This gives you a clean, predictable structure:
import { MCPTool } from "mcp-framework";
import { z } from "zod";
class WeatherTool extends MCPTool<typeof inputSchema> {
name = "get_weather";
description = "Get current weather for a city";
schema = {
city: z.string().describe("City name"),
units: z.enum(["celsius", "fahrenheit"]).default("celsius"),
};
async execute({ city, units }) {
const weather = await fetchWeather(city, units);
return `Weather in ${city}: ${weather.temp}° ${weather.condition}`;
}
}
export default WeatherTool;
Compare this to the inline handler approach of the raw SDK. The class-based pattern gives you:
- Encapsulation — Each tool is self-contained with its own schema, description, and logic
- Testability — You can instantiate and test tools in isolation
- Organization — One file per tool, resource, or prompt
- Type safety — Zod schemas give you validated, typed inputs
Auto-Discovery
This is the feature that changes how you think about MCP server development. With mcp-framework, you do not register anything manually. Just export a class from a file in the right directory:
src/tools/— Tool classes are discovered and registered automaticallysrc/resources/— Resource classes are discovered automaticallysrc/prompts/— Prompt classes are discovered automatically
The framework scans these directories at startup, instantiates your classes, and registers them with the MCP server. Add a new file, restart the server, and it is available. Delete a file, and it is gone.
Keep one tool per file in src/tools/. Name files descriptively like weather-lookup.ts or database-query.ts. The framework does not care about file names, but your future self will thank you.
Feature Comparison
| Feature | mcp-framework | Official SDK (manual) |
|---|---|---|
| Project scaffolding | CLI generates full project | Manual setup |
| Component generation | CLI generates typed classes | Write from scratch |
| Tool registration | Automatic via file system | Manual server.tool() calls |
| Resource registration | Automatic via file system | Manual server.resource() calls |
| Prompt registration | Automatic via file system | Manual server.prompt() calls |
| Input validation | Zod schemas on the class | Inline schema objects |
| Architecture | Class-based, one file per component | Flexible, often single file |
| Transport setup | Configured via framework | Manual wiring |
| Testing | Instantiate classes directly | Mock server handlers |
| Learning curve | Follow conventions | Understand full protocol |
Why mcp-framework Was Built
The Model Context Protocol specification is well-designed, and the official SDK is solid. But there was a gap between "I understand MCP" and "I can ship a production server quickly."
mcp-framework was built to close that gap. The goals were:
- Reduce boilerplate. Developers should spend time on business logic, not registration code.
- Enforce good patterns. The class-based architecture naturally leads to well-organized, testable code.
- Lower the barrier to entry. The CLI means you can go from idea to working server in under two minutes.
- Stay compatible. mcp-framework builds on top of the official SDK, so you are never locked into a proprietary layer.
mcp-framework does not replace the official TypeScript SDK. It uses it under the hood. Everything you learn about the SDK applies when using mcp-framework. The framework just handles the wiring so you can focus on what your tools actually do.
When to Use mcp-framework vs. the Raw SDK
Neither approach is universally better. Here is how to decide:
Choose mcp-framework when:
- You want to get a server running quickly
- Your server has many tools, resources, or prompts
- You prefer convention-based development
- You want generated boilerplate to guide your implementation
- Your team benefits from a consistent structure
Choose the raw SDK when:
- You need a custom transport protocol
- You are building an MCP client, not a server
- You want minimal dependencies
- You need to customize the server lifecycle in ways the framework does not expose
- You are embedding MCP into an existing application
If you are new to MCP, start with mcp-framework. The conventions teach you the right patterns. Once you understand how tools, resources, and prompts work, switching to the raw SDK for specific use cases is straightforward.
Getting Started
Ready to try it? Here is the fastest path:
# Create a new project
npx mcp-framework create my-first-server
# Enter the project
cd my-first-server
# Install dependencies
npm install
# Build the project
npm run build
# Run your server
npm start
Your server is now running with stdio transport, ready to connect to Claude Desktop or any MCP-compatible client.
To add it to Claude Desktop, update your Claude configuration:
{
"mcpServers": {
"my-first-server": {
"command": "node",
"args": ["path/to/my-first-server/dist/index.js"]
}
}
}
What Is Next for mcp-framework
The framework is under active development. Here is what is on the roadmap:
- SSE and Streamable HTTP transports — Beyond stdio for web-deployed servers
- Plugin system — Reusable middleware for authentication, logging, and rate limiting
- Testing utilities — Built-in helpers for unit and integration testing
- Init templates — Starter templates for common server types (database connector, API wrapper, file system tools)
Follow the project on GitHub to stay updated, and check npm for the latest releases.