Gestion MCP Server
MCP server that exposes the GestionIntegrantes REST API as tools, enabling authentication, management of personas, and user queries via natural language.
README
HumanResourcesManagement-MCP — Servidor MCP para Gestión de Recursos Humanos
Servidor MCP (Model Context Protocol) que actúa como puente entre un LLM (Claude Desktop, ChatGPT, etc.) y el backend
Spring Boot HumanResourcesManagement-Backend. Expone todas las operaciones del backend como tools MCP que el LLM
puede invocar directamente.
LLM (Claude / ChatGPT)
↕ MCP Protocol (stdio o HTTP)
MCP Server (Node.js + TypeScript)
↕ HTTP REST (JWT)
Spring Boot Backend
Arquitectura
El proyecto sigue arquitectura hexagonal (puertos y adaptadores) en 3 capas, reflejando la misma filosofía del backend:
| Capa | Responsabilidad |
|---|---|
| Domain | Modelos puros (Persona, Usuario, Sesion), excepciones, interfaz del puerto de salida BackendApiPort |
| Application | Casos de uso (*UseCase), DTOs, mappers, interfaces de puertos de entrada *ToolsPort |
| Infrastructure | Adaptador de entrada MCP (McpServerAdapter), adaptador de salida HTTP (HttpClientAdapter), configuración |
Stack: Node.js 22, TypeScript 5, Express 4, @modelcontextprotocol/sdk 1.x, Zod 3
Estructura del proyecto
HumanResourcesManagement-MCP/
├── src/
│ ├── index.ts # Punto de entrada
│ ├── domain/
│ │ ├── model/ # Sesion, Persona, Usuario
│ │ ├── exception/ # AuthException, BackendException, ValidationException
│ │ └── port/output/
│ │ └── backend-api.port.ts # Contrato del backend
│ ├── application/
│ │ ├── dto/ # DTOs de aplicación
│ │ ├── mapper/ # Mappers DTO ↔ Modelo dominio
│ │ ├── port/input/ # Interfaces de casos de uso
│ │ └── usecase/ # Implementación de casos de uso
│ └── infrastructure/
│ ├── config/
│ │ └── app.config.ts # Carga de variables de entorno
│ ├── input/mcp/
│ │ ├── mcp-server.adapter.ts # Servidor MCP (stdio + HTTP)
│ │ └── tools/ # Definición de tools MCP
│ └── output/http/
│ └── http-client.adapter.ts # Cliente HTTP al backend
├── Dockerfile # Build multi-stage para producción
├── Dockerfile.dev # Imagen de desarrollo
├── docker-compose.yml # Orquestación de producción
├── docker-compose.dev.yml # Orquestación de desarrollo
├── .env.example # Plantilla de variables
├── .env.dev / .env.prod # Variables por entorno (NO versionar)
└── package.json / tsconfig.json
Tools MCP disponibles
El servidor expone 11 tools que mapean 1:1 con los endpoints REST del backend:
| Tool | Método | Endpoint Backend | Roles |
|---|---|---|---|
auth_login |
POST | /api/auth/login |
Público |
auth_register |
POST | /api/auth/register |
Público |
auth_me |
GET | /api/auth/me |
Autenticado |
persona_crear |
POST | /api/personas |
ADMIN, MANAGER |
persona_obtener |
GET | /api/personas/{id} |
ADMIN, MANAGER, USER |
persona_listar |
GET | /api/personas?search&page&size&sortBy&direction |
ADMIN, MANAGER, USER |
persona_actualizar |
PUT | /api/personas/{id} |
ADMIN, MANAGER |
persona_eliminar |
DELETE | /api/personas/{id} |
ADMIN |
usuario_crear |
POST | /api/usuarios |
ADMIN |
usuario_listar |
GET | /api/usuarios?search&rol&page&size&sortBy&direction |
ADMIN, MANAGER |
usuario_obtener_por_email |
GET | /api/usuarios/email/{email} |
ADMIN, MANAGER |
Flujo de autenticación
El MCP gestiona la sesión automáticamente:
- El LLM invoca
auth_logincon email y contraseña - El MCP recibe el JWT y lo almacena internamente
- Las tools subsecuentes (
persona_*,usuario_*,auth_me) usan ese token sin que el LLM tenga que pasarlo - Si no hay sesión activa, las tools protegidas devuelven un error indicando que debe hacerse
auth_loginprimero
Requisitos
- Docker instalado
- El backend
HumanResourcesManagement-Backendcorriendo (en la redgestion-network) - Para desarrollo: clon local del backend con el entorno de desarrollo levantado
Variables de entorno
| Variable | Descripción | Default |
|---|---|---|
BACKEND_API_URL |
URL base del backend Spring Boot | http://gestion-backend:8080 |
MCP_TRANSPORT |
Modo de transporte: stdio (Claude Desktop) o http (remoto/testing) |
stdio |
MCP_HTTP_PORT |
Puerto HTTP cuando MCP_TRANSPORT=http |
3001 |
Copia .env.example a .env.dev o .env.prod y ajusta los valores según tu entorno.
Ejecución
Desarrollo
Levanta el contenedor de desarrollo con bind mount del código fuente:
cd HumanResourcesManagement-MCP
docker-compose --env-file .env.dev -f docker-compose.dev.yml up -d
El servidor se reinicia automáticamente al modificar archivos en src/. Los logs se ven con:
docker logs -f human-resources-mcp-dev
Para ejecutar typecheck o lint dentro del contenedor:
docker exec -it human-resources-mcp-dev sh
# Dentro del contenedor:
npm run typecheck
npm run build
Producción
Compila la imagen y levanta el servicio:
cd HumanResourcesManagement-MCP
docker-compose --env-file .env.prod up -d --build
La imagen de producción es multi-stage: compila TypeScript en una etapa y copia solo dist/ + dependencias
de producción a una imagen node:22-alpine mínima. No incluye herramientas de desarrollo ni código fuente.
Para forzar recompilación sin caché:
docker-compose --env-file .env.prod build --no-cache
docker-compose --env-file .env.prod up -d
Validación desde la PC anfitriona
Una vez el contenedor está corriendo con MCP_TRANSPORT=http:
# Health check
curl http://localhost:3001/health
# {"status":"ok","transport":"http","sesionActiva":false}
# Inicializar sesión MCP
$init = @{jsonrpc="2.0"; id=1; method="initialize"; params=@{
protocolVersion="2024-11-05"; capabilities=@{};
clientInfo=@{name="test";version="1.0"}
}} | ConvertTo-Json -Depth 5 -Compress
$resp = Invoke-WebRequest -Uri http://localhost:3001/mcp `
-Method Post -Body $init -ContentType "application/json" `
-Headers @{"Accept"="application/json, text/event-stream"} -UseBasicParsing
$sessionId = $resp.Headers["Mcp-Session-Id"]
# Listar tools
$list = @{jsonrpc="2.0"; id=2; method="tools/list"; params=@{}} | ConvertTo-Json -Depth 5 -Compress
Invoke-WebRequest -Uri http://localhost:3001/mcp `
-Method Post -Body $list -ContentType "application/json" `
-Headers @{"Accept"="application/json, text/event-stream"; "Mcp-Session-Id"=$sessionId} -UseBasicParsing
# Llamar una tool (auth_login)
$call = @{jsonrpc="2.0"; id=3; method="tools/call"; params=@{
name="auth_login"; arguments=@{email="admin@example.com"; password="SecurePass1!"}
}} | ConvertTo-Json -Depth 5 -Compress
Invoke-WebRequest -Uri http://localhost:3001/mcp `
-Method Post -Body $call -ContentType "application/json" `
-Headers @{"Accept"="application/json, text/event-stream"; "Mcp-Session-Id"=$sessionId} -UseBasicParsing
Integración con Claude Desktop
En claude_desktop_config.json:
{
"mcpServers": {
"human-resources": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--network", "host",
"-e", "BACKEND_API_URL=http://localhost:8080",
"-e", "MCP_TRANSPORT=stdio",
"human-resources-mcp:prod"
]
}
}
}
El transporte stdio permite que Claude Desktop se comunique directamente con el MCP sin exponer un puerto HTTP.
Nota: Compila la imagen de producción con
docker-compose --env-file .env.prod buildantes de usarla con Claude Desktop. Si el backend corre en otro host, ajustaBACKEND_API_URL.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.