Simple MCP
A simple TypeScript library for creating MCP (Model Context Protocol) servers.
Features
- Simple API: Create MCP servers with minimal code
- Type Safety: Full TypeScript integration
- Parameter Validation: Built-in validation with Zod
- MCP Compatible: Fully implements the Model Context Protocol
Installation
npm install simple-mcp
Quickstart
import { McpServer } from 'simple-mcp';
import { z } from 'zod';
// Create a server instance
const server = new McpServer({ name: 'my-server' });
// Register the tool with the server
server.tool({
name: 'greet',
parameters: {
name: z.string().describe('Person's name')
},
execute: async ({ name }) => {
return {
content: [
{
type: 'text',
text: `Hello, ${name}! Nice to meet you.`
}
]
};
}
});
// Start the server
server.start({ transportType: 'stdio' });
Class-based Implementation
You can also implement MCP tools using classes:
import { McpServer, type McpTool } from 'simple-mcp';
import { z, ZodObject } from 'zod';
const parameters = {
name: z.string().describe('The name is required'),
};
class GreetTool implements McpTool<typeof parameters> {
public readonly name = 'greet';
public readonly parameters = parameters;
public async execute({ name }: z.infer<ZodObject<typeof this.parameters>>) {
return {
content: [
{
type: 'text',
text: `Hello, ${name}! Nice to meet you.`,
},
],
};
}
}
// Initialize a new MCP server with the name 'greet-server'
const server = new McpServer({ name: 'greet-server' });
// Create an instance of the GreetTool class
const greetTool = new GreetTool();
// Register the tool with the server
server.tool(greetTool);
// Start the server using stdio as the transport method
server.start({ transportType: 'stdio' });
Examples
Check out the examples directory for more complete examples:
- Greeting Tool - Simple greeting example
- Calculator Tool - Mathematical operations example
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
License
MIT
Simple MCP
Project Details
- ribeirogab/simple-mcp
- MIT License
- Last Updated: 3/28/2025
Recomended MCP Servers
Playwright Model Context Protocol Server - Tool to automate Browsers and APIs in Claude Desktop, Cline, Cursor IDE...
A Model Context Protocol (MCP) server that enables AI assistants to perform web searches using SearXNG, a privacy-respecting...
Integração de LangChain e MCP para processamento de linguagem natural e avaliação de expressões matemáticas.
A Model Context Protocol server to connect to MongoDB databases and MongoDB Atlas Clusters.
Host an Model Context Protocol SSE deployment on Cloud Run, Authenticating with IAM.
Model Context Protocol (MCP) Server for dify workflows
Hello world on mcp server
This repository contains a collection of community-maintained Model Context Protocol (MCP) servers. All servers are automatically listed on...
🔍 Enable AI assistants to search, access, and analyze ChEMBL through a simple MCP interface.
MCP Server for ChromaDB integration into Cursor with MCP compatible AI models





