MCPKit
MCP simple
Una biblioteca TypeScript simple para crear servidores MCP (Protocolo de contexto de modelo).
Características
API simple : crea servidores MCP con un código mínimo
Seguridad de tipos : Integración completa con TypeScript
Validación de parámetros : Validación integrada con Zod
Compatible con MCP : implementa completamente el protocolo de contexto de modelo
Related MCP server: MCP Server Starter
Instalación
npm install simple-mcpInicio rápido
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' });Implementación basada en clases
También puedes implementar herramientas MCP usando clases:
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' });Ejemplos
Consulte el directorio de ejemplos para obtener ejemplos más completos:
Herramienta de saludo : ejemplo de saludo sencillo
Herramienta Calculadora - Ejemplo de operaciones matemáticas
Contribuyendo
¡Agradecemos sus contribuciones! No dude en abrir problemas o enviar solicitudes de incorporación de cambios.
Licencia
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ribeirogab/simple-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server