Getting Started with mcp-framework
Build your first MCP server in minutes using mcp-framework. Step-by-step guide from installation to connecting with Claude Desktop.
title: "Getting Started with mcp-framework" description: "Build your first MCP server in minutes using mcp-framework. Step-by-step guide from installation to connecting with Claude Desktop." keywords: ["MCP getting started", "mcp-framework tutorial", "build MCP server", "Claude Desktop", "TypeScript MCP"] date: "2025-01-15" updated: "2025-04-01" author: "QuantGeekDev" order: 5 level: "beginner" duration: "15 min" language: "en" topic: "getting-started"
Prerequisites
Before you begin, make sure you have:
- Node.js 18+ installed
- npm or another package manager
- A text editor (VS Code recommended)
- Claude Desktop (optional, for testing)
Step 1: Install mcp-framework
Install the framework globally to get access to the mcp CLI:
npm install -g mcp-framework
This gives you the mcp command, which you will use to create and manage MCP server projects.
Step 2: Create Your Project
Scaffold a new MCP server project:
mcp create my-mcp-server
cd my-mcp-server
This creates a ready-to-use project structure:
my-mcp-server/
src/
tools/
ExampleTool.ts
resources/
prompts/
package.json
tsconfig.json
The framework uses auto-discovery — any tool, resource, or prompt you place in the corresponding directory is automatically registered with the MCP server.
Step 3: Build Your First Tool
Open src/tools/ExampleTool.ts to see a working tool:
import { MCPTool } from "mcp-framework";
import { z } from "zod";
class ExampleTool extends MCPTool<typeof inputSchema> {
name = "example_tool";
description = "An example tool that greets users";
schema = {
input: z.object({
name: z.string().describe("The name to greet"),
}),
};
async execute({ name }: z.infer<typeof this.schema.input>) {
return `Hello, ${name}! Welcome to MCP.`;
}
}
export default ExampleTool;
Each tool has:
- A name — how the AI refers to it
- A description — helps the AI understand when to use it
- A schema — defines the input parameters with Zod validation
- An execute method — the actual logic
Step 4: Build and Run
Compile your TypeScript and start the server:
npm run build
Your MCP server is now ready to accept connections.
Step 5: Connect to Claude Desktop
Add your server to Claude Desktop's configuration. Open claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Add your server:
{
"mcpServers": {
"my-mcp-server": {
"command": "node",
"args": ["/absolute/path/to/my-mcp-server/dist/index.js"]
}
}
}
Restart Claude Desktop, and your tool will be available in conversations.
Step 6: Add More Capabilities
Adding a Resource
Create src/resources/GreetingResource.ts:
import { MCPResource } from "mcp-framework";
class GreetingResource extends MCPResource {
uri = "greeting://welcome";
name = "Welcome Message";
description = "A welcome message resource";
mimeType = "text/plain";
async read() {
return {
contents: [
{
uri: this.uri,
text: "Welcome to my MCP server!",
mimeType: this.mimeType,
},
],
};
}
}
export default GreetingResource;
Adding a Prompt
Create src/prompts/AnalyzePrompt.ts:
import { MCPPrompt } from "mcp-framework";
class AnalyzePrompt extends MCPPrompt {
name = "analyze";
description = "Analyze a piece of text";
arguments = [
{
name: "text",
description: "The text to analyze",
required: true,
},
];
async getMessages({ text }: { text: string }) {
return [
{
role: "user" as const,
content: {
type: "text" as const,
text: `Please analyze the following text:\n\n${text}`,
},
},
];
}
}
export default AnalyzePrompt;
What You Built
You now have a complete MCP server with:
- A tool that Claude can call during conversations
- A resource that provides structured data
- A prompt template for common tasks
- Auto-discovery — just add files and rebuild
Next Steps
- Read the What is MCP? guide for deeper understanding
- Explore mcp-framework on GitHub for advanced features
- Check the official MCP documentation for protocol details
- View the npm package for latest releases
This guide is part of MCP International — MCP tutorials in every language. Created by @QuantGeekDev, author of mcp-framework (3.3M+ npm downloads, validated by Anthropic).