SSE MCP Server with JWT Authentication
Servidor SSE MCP con autenticación JWT
Este es un servidor SSE de Protocolo de Contexto de Modelo (MCP) con autenticación basada en JWT.
Le permite exponer múltiples herramientas de IA a través de un transporte SSE, protegido a través de un flujo seguro de token portador.
Construido con:
🚀 Node.js + Express
🧩 @modelcontextprotocol/sdk
🔒 Tokens web JSON (JWT) para autenticación
⚙️ Zod para validación de entrada
✅ Completamente probado con
@modelcontextprotocol/inspector
📂 Estructura del proyecto
server/
├── index.ts # Main Express + MCP server
├── .env # Environment variables
├── package.json # Project metadata & scripts
├── tsconfig.json # TypeScript config
└── README.md # You are here!Related MCP server: MCP Boilerplate
✨ Características
✅ Conexión SSE segura mediante token JWT de portador
✅ Registro dinámico de herramientas (eco, tiempo, número aleatorio, etc.)
✅ Probado con MCP Inspector
✅ Registra todos los eventos del ciclo de vida de la solicitud
✅ Gestión de sesiones para el punto final /message
🚀 Listo para extenderse para uso en producción
⚙️ Configuración
1. Clonar el repositorio
git clone https://github.com/anisirji/mcp-server-remote-setup-with-jwt-auth.git
cd mcp-server-remote-setup-with-jwt-auth2. Instalar dependencias
npm install3. Crear archivo .env
echo "JWT_SECRET=your-secret-key" > .env4. Ejecute el servidor
npm run dev✅ El servidor se ejecutará en:
http://localhost:3001/sse🧪 Probando el servidor con MCP Inspector
Paso 1: Instalar MCP Inspector
📖 Documentos oficiales: Inspector MCP
npx @modelcontextprotocol/inspectorPaso 2: Generar un token
Utilice cURL para obtener su token JWT:
curl "http://localhost:3001/auth/token?username=aniket&scope=mcp:access"✅ Ejemplo de respuesta:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Paso 3: Conectar MCP Inspector
Abrir la interfaz de usuario del Inspector
Establecer tipo de transporte: SSE
URL:
http://localhost:3001/sseAgregar encabezado de autorización:
Authorization: Bearer <your-token>Haga clic en Conectar
¡Éxito! Tu servidor ya está conectado.
Paso 4: Herramientas de prueba
Vaya a la pestaña Herramientas en el Inspector y haga clic en Herramientas de lista .
Verás:
✅
test✅
echo✅
get-time✅
random-number
¡Pruébalos y disfrútalos!
Referencia de API
🔑 Generar token
GET /auth/token?username=<username>&scope=mcp:accessPunto final SSE (requiere token)
GET /sse
Authorization: Bearer <token>📩 Enviar mensaje a sesión activa
POST /message?sessionId=<sessionId>
Authorization: Bearer <token>🧩 Referencia de herramientas
Nombre de la herramienta | Descripción |
| Conexión de prueba (comprobación de seguridad) |
| Echo de vuelta el mensaje proporcionado |
| Devuelve la hora actual del servidor |
| Devuelve un número aleatorio (mín./máx.) |
🗓️ Próximos cambios
[ ] Lista de revocación de tokens (lista negra)
[ ] Acceso a herramientas basado en roles (verificaciones de alcance)
[ ] Latido de la sesión / mantener activa
[ ] Limitación de velocidad y registro
[ ] Dockerización para implementación
📚 Recursos útiles
👨💻 Mantenedor
Aniket
📄 Licencia
Este proyecto es de código abierto y de uso gratuito.
🚀 Construir. Asegurar. Empodera.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA high-performance Model Context Protocol (MCP) server designed for large language models, enabling real-time communication between AI models and applications with support for session management and intelligent tool registration.2MIT
- Alicense-qualityDmaintenanceA server that implements the Model Context Protocol, providing a standardized way to connect AI models to different data sources and tools.1011MIT
- Flicense-qualityDmaintenanceA Model Context Protocol (MCP) server with HTTP transport that implements JWT authentication, allowing secure tool execution and prompt handling with role-based access control.61
- Flicense-quality-maintenanceA Model Context Protocol (MCP) server implementation that uses Server-Sent Events (SSE) to enable real-time, server-pushed updates between AI models and tools over HTTP connections.1
Related MCP Connectors
A Model Context Protocol server for Wix AI tools
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
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/anisirji/mcp-server-remote-setup-with-jwt-auth'
If you have feedback or need assistance with the MCP directory API, please join our Discord server