MCP-Framework is a framework for building Model Context Protocol (MCP) servers in TypeScript, with the goal of enabling developers to build MCP servers elegantly and quickly.
Purpose
This framework is used to develop MCP servers, helping AI assistants interact with external tools, resources, and prompts. It provides a complete architecture, including an auto-discovery mechanism, CLI tools, and type-safety support.
Main Capabilities
- Auto-discovery and loading of tools, resources, and prompts (based on directory structure)
- Support for multiple transports: stdio, SSE, HTTP Stream
- TypeScript-first development with full type safety
- Built on the official MCP SDK
- Provides easy-to-use base classes for tools, prompts, and resources
- Out-of-the-box authentication support for SSE endpoints (OAuth 2.1, JWT, API Key)
- Use Zod schemas to define tool inputs, providing type safety, validation, and automatic documentation
- Built-in CLI for project creation, adding tools, validation, and more
- Automatic validation of tool descriptions at build time, with support for standalone validation and runtime validation
Usage
- Create a project using the CLI:
mcp create my-mcp-server, then enter the directorycd my-mcp-server - Add a tool:
mcp add tool data-fetcher, etc. - Use Zod to define the tool schema, for example:
import { MCPTool, MCPInput as AddToolInput } from "mcp-framework";
import { z } from "zod";
const AddToolSchema = z.object({
a: z.number().describe("First number to add"),
b: z.number().describe("Second number to add"),
});
class AddTool extends MCPTool {
name = "add";
description = "Add tool description";
schema = AddToolSchema;
async execute(input: AddToolInput) {
const result = input.a + input.b;
return `Result: ${result}`;
}
}
export default AddTool;
- Build:
npm run build, and the build process automatically validates tools - Standalone validation:
mcp validate - Test the server:
node dist/index.js - Add it to an MCP client (such as Claude Desktop)
Transport Configuration
- stdio (default): no configuration required
- SSE: configurable
- HTTP Stream: supports Batch mode and Stream mode, with session management, stream resumability, batching, and error handling
Authentication
SSE endpoints support optional authentication:
- JWT: the client provides a valid JWT in the Authorization header
- API Key: the client provides a valid API Key in the X-API-Key header
- OAuth 2.1: compliant with the MCP specification (2025-06-18), supports RFC 9728 and JWKS, supports both JWT validation and token introspection strategies, and is compatible with Auth0, Okta, AWS Cognito, Azure AD / Entra ID, etc.
- Custom authentication: implement the AuthProvider interface
Documentation Server
Provides the @mcpframework/docs package, which can start an MCP documentation server from any Fumadocs site or a site with llms.txt, providing AI agents with tools to search, browse, and retrieve documentation.
Applicable Scenarios
- Developers who need to build MCP servers for AI assistants
- Those who want to quickly set up MCP services with tool, resource, and prompt discovery capabilities
- TypeScript projects that require type safety and schema validation
- MCP servers that need to add authentication to SSE endpoints
Limitations
- The materials do not provide specific fee or pricing information
- The materials do not provide platform compatibility details
- The materials do not provide performance metrics or effectiveness data
- Some advanced features (such as the OAuth setup guide) require reference to external documentation