MCP-Framework is a TypeScript-first development framework designed for building Model Context Protocol (MCP) servers with reduced boilerplate compared to the official SDK. Currently at version 0.2.22, the package maintains a rapid release cadence, with multiple minor versions published frequently, indicating active and ongoing development towards its 1.0 stable release. Key differentiators include CLI scaffolding for quick project setup, an elegant class-based approach for defining tools, resources, and prompts, and integrated Zod validation for schemas. It offers built-in authentication mechanisms (JWT, API Key, OAuth 2.1) and supports multiple transports like stdio, SSE, and HTTP Stream, with explicit support for serverless environments like AWS Lambda. The framework focuses on automatic discovery and loading of server components, providing full type inference and simplifying complex AI agent integrations.
npm install mcp-frameworkVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to install the global CLI, scaffold a new MCP server project, install dependencies, add a new class-based tool using the `@tool` decorator and Zod schemas, and then build and run the server.
Always pin exact versions (e.g., `"mcp-framework": "0.2.22"`) rather than using ranges (e.g., `^0.2.0`) to avoid unexpected behavior from new releases. Review release notes for each update to identify any necessary migration steps.
After creating a project with `--http --cors`, manually review and restrict the CORS `allowedOrigin` configuration in your server's entry point (e.g., `index.ts`) to only trusted domains or specific origins before deploying to production.
Ensure that all Zod schemas for tool inputs and outputs have meaningful `.describe()` calls, providing clear explanations of each field's purpose. Address any validation errors reported during `npm run build` or `mcp validate` to ensure your tools are correctly exposed to AI agents.
Modify the Zod schema definition for the specified tool to include a `.describe()` call for every field, e.g., `z.string().describe('A description of what this field represents.')`.Ensure your Node.js project is configured for ES Modules (by adding `"type": "module"` to `package.json` or using `.mjs` file extensions) and exclusively uses `import ... from 'mcp-framework'` syntax. If sticking with CommonJS, ensure compatibility or use an older version if available.