Gestion MCP Server
This server is a Human Resources Management MCP server. It provides tools for authentication, persona (employee) management, system user management, role-based access control, and general utilities/health checks.
Authentication
login: Authenticate with email/password and store a JWT.get_me: Retrieve current session info.logout: Clear the token.
Persona Management Persona records support first name, paternal/maternal last names, birth date, additional names, and active/inactive status.
list_personas: List people with search, pagination, and sorting.get_persona: Get a person by ID.create_persona: Create a person (requires ADMIN or MANAGER).update_persona: Update fields/status (requires ADMIN or MANAGER).delete_persona: Delete a person (ADMIN only).
Usuario Management
list_usuarios: List users with role filter, email search, pagination, sorting (ADMIN or MANAGER).get_usuario_by_email: Find user by email (ADMIN or MANAGER).
Role-Based Access Roles ADMIN, MANAGER, and USER are enforced; most tools require authentication, and management operations require ADMIN or MANAGER (delete is ADMIN only).
Utility/Health Includes basic greeting, arithmetic calculation, and server health check tools.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gestion MCP Server Show me the list of personas"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Human Resources Management — MCP Server
Servidor MCP (Model Context Protocol) para el sistema de gestión de recursos humanos. Expone tools que un LLM o agente puede invocar mediante Streamable HTTP (y opcionalmente stdio).
Stack
Componente | Tecnología |
Runtime | Node.js 20 Alpine |
Lenguaje | TypeScript 5.7 (compilado con |
Sistema de módulos | ESM ( |
SDK MCP |
|
Transporte HTTP |
|
Transporte Stdio |
|
Validación | Zod v4 |
Servidor HTTP |
|
Contenedor | Docker (Dockerfile en |
Related MCP server: agentforge
Arquitectura: Clean Architecture con módulos
El código sigue Clean Architecture (Puertos y Adaptadores). Las dependencias siempre apuntan hacia adentro:
Infrastructure ──→ Application ──→ Domain
(adaptadores) (casos de uso) (lógica pura)src/shared/types.ts es accesible desde cualquier capa.
Estructura de directorios
src/
├── main.ts ← Entry point: elige transporte según --http / --stdio
│
├── shared/
│ └── types.ts ← Tipos transversales: MCPToolResponse, Result<T>
│
├── template/ ← MÓDULO: tools de plantilla/demo
│ ├── domain/
│ │ └── entities/
│ │ └── HealthStatus.ts ← Entidad de dominio: estado del servidor
│ ├── application/
│ │ ├── dto/
│ │ │ └── index.ts ← DTOs planos: GreetInput/Output, CalculateInput/Output
│ │ └── use-cases/
│ │ ├── greet/
│ │ │ ├── IGreetUseCase.ts ← Puerto (interfaz)
│ │ │ └── GreetUseCase.ts ← Implementación del caso de uso
│ │ ├── calculate/
│ │ │ ├── ICalculateUseCase.ts
│ │ │ └── CalculateUseCase.ts
│ │ └── health-check/
│ │ ├── IHealthCheckUseCase.ts
│ │ └── HealthCheckUseCase.ts
│ └── infrastructure/
│ └── mcp/
│ └── schemas.ts ← Zod schemas + registerTemplateTools()
│
├── infrastructure/ ← Infraestructura COMPARTIDA entre módulos
│ ├── config/
│ │ └── env.ts ← Tipado y carga de variables de entorno
│ ├── mcp/
│ │ └── server-factory.ts ← Orquestador: crea McpServer y registra tools de todos los módulos
│ └── transport/
│ ├── http-server.ts ← Servidor HTTP (StreamableHTTP, stateless)
│ └── stdio-server.ts ← Servidor stdio (para MCP Inspector)
│
└── (futuro) personnel/ ← EJEMPLO: futuro módulo que conectará al Backend
├── domain/...
├── application/...
└── infrastructure/mcp/schemas.tsReglas de dependencia por capa
Capa | Puede importar de | NO puede importar de |
|
|
|
|
|
|
|
| — |
|
| otros módulos directamente |
Responsabilidad de cada archivo
Archivo | Capa | Función |
| — | Punto de entrada. Parsea |
| Shared |
|
| Infra |
|
| Infra |
|
| Infra |
|
| Infra |
|
| Domain | Entidad pura con factory methods |
| Application | DTOs planos: |
| Application | Puerto: interfaz del caso de uso ( |
| Application | Implementación del caso de uso (lógica de negocio) |
| Infra (módulo) | Zod schemas + |
Flujo de una tool call
┌─────────────────────────────────────────────────────────────────────┐
│ 1. Cliente HTTP POST /mcp │
│ Body: {"jsonrpc":"2.0","method":"tools/call","params":{...}} │
│ Headers: Accept: application/json, text/event-stream │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 2. http-server.ts: node:http.createServer │
│ readRequestBody() → toWebRequest() → transport.handleRequest() │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 3. WebStandardStreamableHTTPServerTransport (stateless) │
│ Parsea JSON-RPC, enruta al McpServer │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 4. McpServer (creado en server-factory.ts) │
│ Valida input con Zod schema → ejecuta handler de la tool │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 5. template/infrastructure/mcp/schemas.ts │
│ Handler: Zod valida params → crea DTO → llama UseCase.execute() │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 6. UseCase.execute(dto) → lógica pura │
│ Puede usar entidades de domain/ │
└────────────────────────────┬────────────────────────────────────────┘
▼
┌─────────────────────────────────────────────────────────────────────┐
│ 7. Handler retorna { content: [{ type: "text", text: "..." }] } │
│ McpServer → Transport → JSON-RPC response → HTTP response │
└─────────────────────────────────────────────────────────────────────┘Tools actuales (módulo template)
Tool | Descripción | Input | Output |
| Saludo personalizado |
|
|
| Operaciones aritméticas |
|
|
| Estado del servidor |
|
|
Guía: Cómo agregar una nueva tool
Dentro de un módulo existente (ej: template)
Paso 1: Agregar DTOs en src/template/application/dto/index.ts
export class MyInput {
constructor(public readonly param: string) {}
}
export class MyOutput {
constructor(public readonly result: string) {}
}Paso 2: Crear interfaz src/template/application/use-cases/my-tool/IMyUseCase.ts
import type { MyInput, MyOutput } from '../../dto/index.js';
export interface IMyUseCase {
execute(input: MyInput): Promise<MyOutput>;
}Paso 3: Crear implementación src/template/application/use-cases/my-tool/MyUseCase.ts
import type { IMyUseCase } from './IMyUseCase.js';
import { MyInput, MyOutput } from '../../dto/index.js';
export class MyUseCase implements IMyUseCase {
public async execute(input: MyInput): Promise<MyOutput> {
return new MyOutput(`Processed: ${input.param}`);
}
}Paso 4: Agregar Zod schema y handler en src/template/infrastructure/mcp/schemas.ts
const myInputSchema = z.object({
param: z.string().describe('Description of param'),
});
// Dentro de registerTemplateTools():
server.registerTool(
'my_tool',
{
description: 'What this tool does.',
inputSchema: myInputSchema,
},
async (params: z.infer<typeof myInputSchema>) => {
const input = new MyInput(params.param);
const output = await myUseCase.execute(input);
return {
content: [{ type: 'text' as const, text: output.result }],
};
}
);Errores en tools
Para reportar errores al LLM, retorna isError: true:
catch (error) {
return {
content: [{ type: 'text' as const, text: `Error: ${error.message}` }],
isError: true,
};
}Guía: Cómo crear un nuevo módulo
Cuando necesites una funcionalidad completamente nueva (ej: conexión al backend para gestión de personal), crea un módulo:
Paso 1: Crear la estructura de carpetas
src/personnel/
├── domain/
│ └── entities/
│ └── Employee.ts
├── application/
│ ├── dto/
│ │ └── index.ts
│ └── use-cases/
│ └── get-employee/
│ ├── IGetEmployeeUseCase.ts
│ └── GetEmployeeUseCase.ts
└── infrastructure/
└── mcp/
└── schemas.ts ← export function registerPersonnelTools(server, version)Paso 2: El schemas.ts del módulo debe exportar una función con esta firma:
import type { McpServer } from '@modelcontextprotocol/server';
import { z } from 'zod';
export function registerPersonnelTools(server: McpServer, version: string): void {
const useCase = new GetEmployeeUseCase(/* dependencias */);
server.registerTool('get_employee', {
description: 'Get employee by ID',
inputSchema: z.object({ id: z.string() }),
}, async ({ id }) => {
const output = await useCase.execute(new GetEmployeeInput(id));
return { content: [{ type: 'text' as const, text: JSON.stringify(output) }] };
});
}Paso 3: Registrar el módulo en src/infrastructure/mcp/server-factory.ts
import { registerTemplateTools } from '../../template/infrastructure/mcp/schemas.js';
import { registerPersonnelTools } from '../../personnel/infrastructure/mcp/schemas.js'; // ← nuevo
export function createServerFactory(): McpServer {
const server = new McpServer({ name: 'hrm-mcp', version: SERVER_VERSION });
registerTemplateTools(server, SERVER_VERSION);
registerPersonnelTools(server, SERVER_VERSION); // ← nuevo
return server;
}Transportes
HTTP (Streamable HTTP) — por defecto
Endpoint:
POST /mcp(también aceptaPOST /)Headers requeridos:
Accept: application/json, text/event-streamModo: Stateless (
sessionIdGenerator: undefined). Cada request es independiente.Puerto:
3001(configurable conPORT)Health check:
GET /health→{"status":"ok"}Arranque:
node dist/main.jsonode dist/main.js --http
Stdio — opcional
Arranque:
node dist/main.js --stdioUso: MCP Inspector o clientes que lancen el proceso como hijo
Logs: Usar
console.error(stdout es el canal del protocolo)
Docker
Dockerfile
Ubicado en ../docker/mcp.Dockerfile. Tiene 3 stages:
Stage | Propósito | Comando |
| Clona repo, | — |
| Imagen mínima con solo |
|
| Copia source, instala deps, compila y ejecuta |
|
Comandos Docker Compose
# Construir sin caché
docker compose -f docker-compose.dev.yml build --no-cache mcp-server
# Ejecutar
docker compose -f docker-compose.dev.yml up mcp-server
# Ejecutar en background
docker compose -f docker-compose.dev.yml up -d mcp-server
# Ver logs
docker compose -f docker-compose.dev.yml logs -f mcp-server
# Detener
docker compose -f docker-compose.dev.yml downVolumes en desarrollo
volumes:
- ./HumanResourcesManagement-MCP:/app # Código fuente (live)
- mcp_node_modules:/app/node_modules # node_modules preservadoEl CMD del stage development ejecuta npm run build && node dist/main.js --http, por lo que recompila el TypeScript al iniciar el contenedor.
Testing manual
Health check
curl http://localhost:3001/healthMCP: Listar tools
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'MCP: Inicializar conexión
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2026-07-28","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":1}'MCP: Llamar una tool
curl -X POST http://localhost:3001/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"greet","arguments":{"name":"World"}},"id":2}'Variables de entorno
Variable | Default | Descripción |
|
| Entorno ( |
|
| Puerto del servidor HTTP |
|
| URL del backend (para futura conexión) |
|
| Nivel de log ( |
Se cargan desde ../.env.dev en el contenedor de desarrollo.
Convenciones de código
Imports
Todos los imports relativos llevan extensión .js al final (requerido por "moduleResolution": "NodeNext"):
// ✅ Correcto
import { GreetUseCase } from '../../application/use-cases/greet/GreetUseCase.js';
// ❌ Incorrecto
import { GreetUseCase } from '../../application/use-cases/greet/GreetUseCase';Logging
Usar console.error para todos los logs. En modo stdio, stdout es el canal del protocolo JSON-RPC.
console.error('Server started on port 3001'); // ✅
console.log('Server started on port 3001'); // ❌ (corrompe el protocolo en stdio)Tipos literales en tool responses
return {
content: [{ type: 'text' as const, text: 'Hello' }],
};El as const es necesario para que TypeScript infiera el tipo literal 'text' en lugar de string.
Entidades de dominio
Constructor
private+ factory methods estáticos (create,reconstitute)Propiedades privadas con prefijo
_(_status,_version)Getters públicos para acceso de solo lectura
Sin imports de
application/niinfrastructure/
DTOs
Clases con
constructor(public readonly ...)— objetos planos, sin lógicaSin dependencias externas
Sin validaciones de negocio
Use cases
Interfaz (
I*UseCase) + implementación (*UseCase) en archivos separadosReciben DTOs de entrada, retornan DTOs de salida
Pueden usar entidades de dominio y
shared/types.tsNo conocen MCP, HTTP, ni Zod
Dependencias npm
{
"dependencies": {
"@modelcontextprotocol/server": "^2.0.0",
"zod": "^4.4.0"
},
"devDependencies": {
"@types/node": "^20.0.0",
"typescript": "^5.7.0"
}
}Nota: El paquete @modelcontextprotocol/server v2 exporta desde su entry point principal WebStandardStreamableHTTPServerTransport y McpServer. StdioServerTransport se importa desde el subpath @modelcontextprotocol/server/stdio.
Scripts npm
npm run build # tsc → dist/
npm start # node dist/main.js (HTTP por defecto)
npm run start:http # node dist/main.js --http
npm run start:stdio # node dist/main.js --stdioResumen para un LLM
Si eres un LLM que va a modificar este código, recuerda:
La lógica de negocio va en use cases (
application/use-cases/), nunca en schemas ni en handlers.Los DTOs son planos, sin comportamiento. Se crean en
application/dto/.Cada tool se registra en
<modulo>/infrastructure/mcp/schemas.tsconserver.registerTool(name, config, handler).El handler de la tool convierte
params(validados por Zod) → DTO → UseCase → DTO →{ content: [...] }.Para crear un nuevo módulo, replica la estructura de
template/y registra su función enserver-factory.ts.Nunca uses
console.log— usaconsole.errorpara logs.Todos los imports relativos llevan
.jsal final.No instales dependencias en el host — todo se prueba dentro del contenedor Docker.
Available Tools
10 toolscreate_personaA
Create a new person in the system. Requires ADMIN or MANAGER role.
Inputs: nombre (required), apellidoPaterno (required), apellidoMaterno, fechaNacimiento, +1 more.
delete_personaB
Delete a person by ID. Requires ADMIN role only.
Inputs: id (required).
get_meA
Get the current authenticated user's session information. Requires prior login via the 'login' tool.
Inputs: no named parameters.
get_personaA
Get a single person by their ID. Requires authentication.
Inputs: id (required).
get_usuario_by_emailA
Find a user by their email address. Requires ADMIN or MANAGER role.
Inputs: email (required).
list_personasA
List people from the backend with optional search, pagination, and sorting. Requires authentication (ADMIN, MANAGER, or USER role).
Inputs: page, size, search, sortBy, +1 more.
list_usuariosA
List users from the backend with optional filters, pagination, and sorting. Requires ADMIN or MANAGER role.
Inputs: rol, page, size, search, +2 more.
loginA
Authenticate with the backend API using email and password. Stores the JWT token for subsequent authenticated requests. Call this first before any other tool that requires authentication.
Inputs: email (required), password (required).
logoutA
Clear the stored JWT token and end the current session.
Inputs: no named parameters.
update_personaA
Update an existing person by ID. Only the fields provided will be updated. Requires ADMIN or MANAGER role.
Inputs: id (required), nombre, estadoRegistro, apellidoMaterno, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Authentication tools are clearly distinct, but personas and usuarios overlap conceptually. While descriptions distinguish 'people' from 'users', the boundary is unclear, and get_usuario_by_email could be confused with get_persona. There is potential for an agent to misselect between persona and usuario tools.
Most tools follow a consistent verb_noun pattern (list_personas, create_persona, delete_persona). Exceptions are login, logout, and get_me, which are imperative or pronoun-based but still readable. The overall naming is predictable and mostly consistent.
10 tools is well within the typical 3-15 range and appropriate for a management server covering authentication and entity CRUD. Each tool appears purposeful and the set is not bloated.
Persona CRUD is fully covered, and authentication has login, logout, and session info. However, usuario operations are limited to listing and fetching by email, lacking create, update, and delete. This creates an asymmetry and potential dead end if user management is expected in a 'Gestion' server.
Maintenance
Related MCP Connectors
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
One MCP server for the services your AI needs: memory, files, Microsoft 365, kanban and more.
Related MCP Servers
- AlicenseAqualityDmaintenanceA generic MCP server that dynamically exposes any OpenAPI-documented REST API to LLMs by auto-discovering endpoints. It provides tools for exploring API capabilities and making authenticated requests directly through natural language interfaces.22 npmMIT
- AlicenseAqualityDmaintenanceMCP server that exposes 300+ AI agents as tools via a single API key. Supports listing agents, invoking any agent with chat-completion style messages, checking agent health, and retrieving platform statistics.54MIT
- AlicenseNot gradedqualityDmaintenanceMCP Server for interacting with the Langflow API via a natural language interface. It exposes Langflow functionalities as tools for LLMs.MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for eventos event management platform, enabling AI assistants to manage events and tickets via API integration. Supports authentication, ticket CRUD operations, and listing with pagination.1MIT