Installation
Setting up the MCP Framework is straightforward. You can either create a new project using our CLI or add it to an existing project.
Using the CLI (Recommended)
The easiest way to get started is using our CLI to create a new project:
# Install the CLI globally with npm
npm install -g mcp-framework
# The mcp CLI is now globally available
# Create your new project with the mcp CLI
mcp create my-mcp-server
# Navigate to your project
cd my-mcp-server
# Install dependencies
npm install
This will create a new project with the following structure:
my-mcp-server/
├── src/
│ ├── tools/ # MCP Tools directory
│ │ └── ExampleTool.ts
│ └── index.ts # Server entry point
├── package.json
└── tsconfig.json
To open this project in vscode, use:
code .
Manual Installation
If you prefer to add MCP Framework to an existing project:
npm install mcp-framework
Then create a minimal server in src/index.ts
:
import { MCPServer } from "mcp-framework";
const server = new MCPServer();
server.start().catch((error) => {
console.error("Server error:", error);
process.exit(1);
});
Next Steps
After installation, you can:
- Follow the Quickstart guide to create your first tool
- Learn about Tools
- Explore Resources
- Check out Prompts
Requirements
- Node.js 18 or later
- TypeScript 5.0 or later
- npm or yarn package manager
Troubleshooting
Common Issues
-
TypeScript Errors:
error TS2304: Cannot find name 'z'
Solution: Install zod -
npm install zod
-
Module Resolution Issues:
Error: Cannot find module '@modelcontextprotocol/sdk'
Solution: Install peer dependencies -
npm install @modelcontextprotocol/sdk
For more help, check our GitHub Issues or join our Discord community.