Skip to content

[Feat] MCP 인증 인프라 (API 키 발급/조회/폐기 + 인증 필터) #96

Description

@kangcheolung

📌 Description

Claude Desktop 등록용 장기 API 키를 발급·조회·폐기하는 REST API(JWT 인증)와, MCP 요청의 Authorization 헤더로 사용자를 식별하는 Spring Security 필터를 구현한다.

✅ To-do

  • McpAccessTokenRepository 구현 (기존 McpAccessToken 엔티티/V26 마이그레이션 재사용)
  • McpAccessTokenService: 토큰 발급(랜덤 생성 + 해시 저장), 목록 조회, 폐기(revoked_at soft delete) 구현
  • McpTokenController: POST/GET /mcp/tokens, DELETE /mcp/tokens/{tokenId} (기존 JWT 인증 재사용)
  • McpApiKeyAuthFilter: Authorization 헤더 → 해시 대조 → SecurityContext에 userId 저장, 실패 시 UNAUTHORIZED
  • SecurityConfig에서 /mcp/** permitAll 제거하고 McpApiKeyAuthFilter로 교체
  • last_used_at 갱신 로직
  • 단위 테스트 (McpAccessTokenService, 필터)

📒 기타

mcp_access_tokens 테이블/엔티티는 이미 존재(V26) → Repository/Service/Controller/필터만 신규 구현. 기존 JwtAuthenticationFilter + CurrentUserArgumentResolver 패턴 그대로 미러링. Issue 1(골격)에 의존.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions