generic-mcp-server
Plantilla genérica de servidor MCP
Una plantilla de servidor de Protocolo de Contexto de Modelo (MCP) modular y extensible, diseñada para una fácil personalización y extensión.
Características
Arquitectura modular : clara separación de preocupaciones con una estructura bien definida
Archivos pequeños y enfocados : mejor capacidad de mantenimiento y más fácil de ingerir para la IA
Puntos de extensión fáciles : patrones simples para agregar nuevas herramientas y servicios
Manejo integral de errores : gestión robusta de errores en todo el código base
Seguridad de tipos : compatibilidad total con TypeScript con tipificación adecuada
Related MCP server: Swagger MCP
Estructura del proyecto
generic-mcp-template/
├── src/
│ ├── services/ # Service classes for API interactions
│ │ ├── base-service.ts # Abstract base service with common functionality
│ │ └── example-service.ts # Example service implementation
│ ├── tools/ # MCP tool definitions and handlers
│ │ ├── example-tools.ts # Tool definitions (name, description, schema)
│ │ └── example-tool-handlers.ts # Tool handler implementations
│ ├── types/ # TypeScript type definitions
│ │ └── example-types.ts # Example type definitions
│ ├── config.ts # Configuration management
│ └── index.ts # Main entry point
├── .env.example # Example environment variables
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentationEmpezando
Prerrequisitos
Node.js 18 o superior
npm o hilo
Instalación
Clonar este repositorio:
git clone https://github.com/v4lheru/generic-mcp-template.git cd generic-mcp-templateInstalar dependencias:
npm installCree un archivo
.envbasado en.env.example:cp .env.example .envEdite el archivo
.envcon sus claves API y configuración.
Construyendo y funcionando
Construir el proyecto:
npm run buildEjecutar el servidor:
npm start
Ampliación de la plantilla
Agregar un nuevo servicio
Cree un nuevo archivo de servicio en
src/services/:// src/services/my-service.ts import { BaseService } from './base-service.js'; import config from '../config.js'; export class MyService extends BaseService { // Implement your service... }Agregue cualquier tipo necesario en
src/types/.
Agregar nuevas herramientas
Define tus herramientas en un nuevo archivo o amplía el existente en
src/tools/:// src/tools/my-tools.ts export const myTools = [ { name: "my_tool", description: "Description of my tool", inputSchema: { // JSON Schema for the tool's input } } ];Implemente controladores para sus herramientas:
// src/tools/my-tool-handlers.ts import { MyService } from '../services/my-service.js'; export function createMyToolHandlers(myService: MyService) { return { my_tool: async (args: any) => { // Implement your tool handler } }; }Registre sus herramientas y controladores en
src/index.ts.
Configuración
La plantilla utiliza un sistema de configuración centralizado en src/config.ts . La configuración se puede realizar mediante:
Variables de entorno
Argumentos de la línea de comandos (con
--env KEY=VALUE)Valores predeterminados en el código
Manejo de errores
La plantilla incluye un manejo integral de errores:
Manejo de errores a nivel de servicio con soporte de limitación de velocidad
Manejo de errores a nivel de herramienta con mensajes de error adecuados
Manejo de errores del protocolo MCP
Licencia
Instituto Tecnológico de Massachusetts (MIT)
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Tools
Related MCP Servers
- Alicense-qualityDmaintenanceAutomatically converts any OpenAPI specification or Postman Collection into an MCP server, enabling AI assistants like Claude to directly interact with REST APIs without writing any code.Apache 2.0
- Flicense-qualityDmaintenanceAutomatically converts Swagger/OpenAPI specifications into MCP servers, enabling AI agents to interact with any REST API through natural language by exposing endpoints as AI-friendly tools.3
- Alicense-qualityAmaintenanceOne command to turn any codebase into an MCP server. Not just REST APIs. Not just OpenAPI specs.41Apache 2.0
- Alicense-qualityCmaintenanceTurns any OpenAPI specification into a fully working MCP server with a single command, enabling AI agents to call APIs without writing any glue code.8MIT
Related MCP Connectors
MCP server for AI access to Swagger by SmartBear.
Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.
MCP (Model Context Protocol) server for Appwrite
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/v4lheru/generic-mcp-template'
If you have feedback or need assistance with the MCP directory API, please join our Discord server