Skip to main content
Glama

SSE MCP Server with JWT Authentication

🔐 JWT 인증을 사용한 SSE MCP 서버

이는 JWT 기반 인증을 갖춘 MCP(Model Context Protocol) SSE 서버입니다.
이를 통해 여러 AI 도구를 SSE 전송을 통해 노출할 수 있으며, 안전한 Bearer Token 흐름을 통해 보호됩니다.

다음으로 구성됨:

  • 🚀 Node.js + 익스프레스
  • 🧩 @modelcontextprotocol/sdk
  • 🔒 인증을 위한 JSON 웹 토큰(JWT)
  • ⚙️ 입력 검증을 위한 Zod

@modelcontextprotocol/inspector 로 완벽하게 테스트됨

📂 프로젝트 구조

지엑스피1

✨ 특징

  • ✅ Bearer JWT 토큰을 사용한 안전한 SSE 연결
  • ✅ 동적 도구 등록(에코, 시간, 난수 등)
  • ✅ MCP Inspector로 테스트됨
  • ✅ 모든 요청 라이프사이클 이벤트를 기록합니다
  • ✅ /message 엔드포인트에 대한 세션 관리
  • 🚀 프로덕션 용도로 확장할 준비가 되었습니다.

⚙️ 설정

1. 저장소를 복제합니다.

git clone https://github.com/anisirji/mcp-server-remote-setup-with-jwt-auth.git cd mcp-server-remote-setup-with-jwt-auth

2. 종속성 설치

npm install

3. .env 파일 생성

echo "JWT_SECRET=your-secret-key" > .env

4. 서버를 실행하세요

npm run dev

✅ 서버는 다음에서 실행됩니다.

http://localhost:3001/sse

🧪 MCP Inspector로 서버 테스트

1단계 - MCP Inspector 설치

📖 공식 문서: MCP 검사관

npx @modelcontextprotocol/inspector

2단계 - 토큰 생성

cURL을 사용하여 JWT 토큰을 받으세요.

curl "http://localhost:3001/auth/token?username=aniket&scope=mcp:access"

✅ 응답 예시:

{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }

3단계 - MCP Inspector 연결

  1. Inspector UI 열기
  2. 전송 유형 설정: SSE
  3. URL:
    http://localhost:3001/sse
  4. 승인 헤더 추가:
    Authorization: Bearer <your-token>
  5. 연결을 클릭하세요

🎉 성공! 서버가 연결되었습니다.

4단계 - 테스트 도구

검사기의 도구 탭으로 가서 목록 도구를 클릭합니다.

당신은 볼 수 있습니다:

  • test
  • echo
  • get-time
  • random-number

테스트해 보고 즐겨보세요!

📖 API 참조

🔑 토큰 생성

GET /auth/token?username=<username>&scope=mcp:access

🔌 SSE 엔드포인트(토큰 필요)

GET /sse Authorization: Bearer <token>

📩 활성 세션에 메시지 보내기

POST /message?sessionId=<sessionId> Authorization: Bearer <token>

🧩 도구 참조

도구 이름설명
test연결 테스트(보안 확인)
echo에코백 제공 메시지
get-time현재 서버 시간을 반환합니다
random-number난수(최소/최대)를 반환합니다.

🗓️ 예정된 변경 사항

  • [ ] 토큰 취소 목록(블랙리스트)
  • [ ] 역할 기반 도구 액세스(범위 검사)
  • [ ] 세션 하트비트 / keep-alive
  • [ ] 속도 제한 및 로깅
  • [ ] 배포를 위한 Dockerization

📚 유용한 자료

👨‍💻 유지 관리자

아니켓

📄 라이센스

이 프로젝트는 오픈 소스이며 무료로 사용할 수 있습니다.

🚀 구축. 보안. 권한 부여.

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

JWT 기반 보안 인증을 통해 SSE 전송을 통해 여러 AI 도구를 노출하는 모델 컨텍스트 프로토콜 서버로, 동적 도구 등록 및 세션 관리가 가능합니다.

  1. 📂 프로젝트 구조
    1. ✨ 특징
      1. ⚙️ 설정
        1. 저장소를 복제합니다.
        2. 종속성 설치
        3. .env 파일 생성
        4. 서버를 실행하세요
      2. 🧪 MCP Inspector로 서버 테스트
        1. 1단계 - MCP Inspector 설치
        2. 2단계 - 토큰 생성
        3. 3단계 - MCP Inspector 연결
        4. 4단계 - 테스트 도구
      3. 📖 API 참조
        1. 🔑 토큰 생성
        2. 🔌 SSE 엔드포인트(토큰 필요)
        3. 📩 활성 세션에 메시지 보내기
      4. 🧩 도구 참조
        1. 🗓️ 예정된 변경 사항
          1. 📚 유용한 자료
            1. 👨‍💻 유지 관리자
              1. 📄 라이센스
                1. 🚀 구축. 보안. 권한 부여.

                  Related MCP Servers

                  • A
                    security
                    F
                    license
                    A
                    quality
                    A Model Context Protocol server that allows secure execution of pre-approved commands, enabling AI assistants to safely interact with the user's system.
                    Last updated -
                    1
                    3
                    18
                    JavaScript
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol server that enables seamless execution of commands, Python code, web content fetching, and reusable task management with secure credentials handling.
                    Last updated -
                    2
                    Python
                    MIT License
                    • Apple
                  • -
                    security
                    F
                    license
                    -
                    quality
                    A comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.
                    Last updated -
                    16
                    TypeScript
                  • -
                    security
                    A
                    license
                    -
                    quality
                    A Model Context Protocol server that provides AI agents with secure access to local filesystem operations, enabling reading, writing, and managing files through a standardized interface.
                    Last updated -
                    160
                    3
                    TypeScript
                    Apache 2.0

                  View all related MCP servers

                  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