$git clone https://github.com/QuantGeekDev/mcp-frameworkMCP-Framework is a framework for building Model Context Protocol (MCP) servers elegantly in TypeScript.
| 1 | # MCP Framework |
| 2 | |
| 3 | MCP-Framework is a framework for building Model Context Protocol (MCP) servers elegantly in TypeScript. |
| 4 | |
| 5 | MCP-Framework gives you architecture out of the box, with automatic directory-based discovery for tools, resources, and prompts. Use our powerful MCP abstractions to define tools, resources, or prompts in an elegant way. Our cli makes getting started with your own MCP server a breeze |
| 6 | |
| 7 | ## Features |
| 8 | |
| 9 | - 🛠️ Automatic discovery and loading of tools, resources, and prompts |
| 10 | - Multiple transport support (stdio, SSE, HTTP Stream) |
| 11 | - TypeScript-first development with full type safety |
| 12 | - Built on the official MCP SDK |
| 13 | - Easy-to-use base classes for tools, prompts, and resources |
| 14 | - Out of the box authentication for SSE endpoints (OAuth 2.1, JWT, API Key) |
| 15 | |
| 16 | ## Projects Built with MCP Framework |
| 17 | |
| 18 | The following projects and services are built using MCP Framework: |
| 19 | |
| 20 | - ### [tip.md](https://tip.md) |
| 21 | A crypto tipping service that enables AI assistants to help users send cryptocurrency tips to content creators directly from their chat interface. The MCP service allows for: |
| 22 | - Checking wallet types for users |
| 23 | - Preparing cryptocurrency tips for users/agents to complete |
| 24 | Setup instructions for various clients (Cursor, Sage, Claude Desktop) are available in their [MCP Server documentation](https://docs.tip.md/mcp-server/). |
| 25 | |
| 26 | ## Support our work |
| 27 | |
| 28 | [](https://tip.md/QuantGeekDev) |
| 29 | |
| 30 | |
| 31 | # [Read the full docs here](https://mcp-framework.com) |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | ## Creating a repository with mcp-framework |
| 38 | |
| 39 | ### Using the CLI (Recommended) |
| 40 | |
| 41 | ```bash |
| 42 | # Install the framework globally |
| 43 | npm install -g mcp-framework |
| 44 | |
| 45 | # Create a new MCP server project |
| 46 | mcp create my-mcp-server |
| 47 | |
| 48 | # Navigate to your project |
| 49 | cd my-mcp-server |
| 50 | |
| 51 | # Your server is ready to use! |
| 52 | ``` |
| 53 | |
| 54 | ## CLI Usage |
| 55 | |
| 56 | The framework provides a powerful CLI for managing your MCP server projects: |
| 57 | |
| 58 | ### Project Creation |
| 59 | |
| 60 | ```bash |
| 61 | # Create a new project |
| 62 | mcp create <your project name here> |
| 63 | |
| 64 | # Create a new project with the new EXPERIMENTAL HTTP transport |
| 65 | Heads up: This will set cors allowed origin to "*", modify it in the index if you wish |
| 66 | mcp create <your project name here> --http --port 1337 --cors |
| 67 | ``` |
| 68 | |
| 69 | # Options: |
| 70 | # --http: Use HTTP transport instead of default stdio |
| 71 | # --port <number>: Specify HTTP port (default: 8080) |
| 72 | # --cors: Enable CORS with wildcard (*) access |
| 73 | |
| 74 | ### Adding a Tool |
| 75 | |
| 76 | ```bash |
| 77 | # Add a new tool |
| 78 | mcp add tool price-fetcher |
| 79 | ``` |
| 80 | |
| 81 | ### Building and Validation |
| 82 | |
| 83 | The framework provides comprehensive validation to ensure your tools are properly documented and functional: |
| 84 | |
| 85 | ```bash |
| 86 | # Build with automatic validation (recommended) |
| 87 | npm run build |
| 88 | |
| 89 | # Build with custom validation settings |
| 90 | MCP_SKIP_TOOL_VALIDATION=false npm run build # Force validation (default) |
| 91 | MCP_SKIP_TOOL_VALIDATION=true npm run build # Skip validation (not recommended) |
| 92 | ``` |
| 93 | |
| 94 | ### Validating Tools |
| 95 | |
| 96 | ```bash |
| 97 | # Validate all tools have proper descriptions (for Zod schemas) |
| 98 | mcp validate |
| 99 | ``` |
| 100 | |
| 101 | This command checks that all tools using Zod schemas have descriptions for every field. The validation runs automatically during build, but you can also run it standalone: |
| 102 | |
| 103 | - ✅ **During build**: `npm run build` automatically validates tools |
| 104 | - ✅ **Standalone**: `mcp validate` for manual validation |
| 105 | - ✅ **Development**: Use `defineSchema()` helper for immediate feedback |
| 106 | - ✅ **Runtime**: Server validates tools on startup |
| 107 | |
| 108 | **Example validation error:** |
| 109 | ```bash |
| 110 | ❌ Tool validation failed: |
| 111 | ❌ PriceFetcher.js: Missing descriptions for fields in price_fetcher: symbol, currency. |
| 112 | All fields must have descriptions when using Zod object schemas. |
| 113 | Use .describe() on each field, e.g., z.string().describe("Field description") |
| 114 | ``` |
| 115 | |
| 116 | **Integrating validation into CI/CD:** |
| 117 | ```json |
| 118 | { |
| 119 | "scripts": { |
| 120 | "build": "tsc && mcp-build", |
| 121 | "test": "jest && mcp validate", |
| 122 | "prepack": "npm run build && mcp validate" |
| 123 | } |
| 124 | } |
| 125 | ``` |
| 126 | |
| 127 | ### Adding a Prompt |
| 128 | |
| 129 | ```bash |
| 130 | # Add a new prompt |
| 131 | mcp add prompt price-analysis |
| 132 | ``` |
| 133 | |
| 134 | ### Adding a Resource |
| 135 | |
| 136 | ```bash |
| 137 | # Add a new resource |
| 138 | mc |