anisirji_mcp-server-remote-setup-with-jwt-auth

anisirji_mcp-server-remote-setup-with-jwt-auth

0

The project is an SSE server for the Model Context Protocol, secured by JWT authentication. It allows the integration of multiple AI tools over an SSE transport and is fully tested with the MCP Inspector.

🔐 SSE MCP Server with JWT Authentication

This project is a Model Context Protocol (MCP) SSE server with JWT-based authentication. It facilitates exposing multiple AI tools over SSE transport using a secure Bearer Token flow.

Features

  • Secure SSE connection using JWT tokens
  • Dynamic Tool registration (echo, time, random number, etc.)
  • Logs all request lifecycle events
  • Session management for /message endpoint
  • Ready for production use expansion

Setup

  1. Clone the repository and navigate to the directory.
  2. Install the dependencies.
  3. Create a .env file with the JWT secret key.
  4. Run the server.

API Reference

  • Generate Token: GET /auth/token?username=<username>&scope=mcp:access
  • SSE Endpoint: GET /sse
  • Send Message: POST /message?sessionId=<sessionId>