Back to Home
horatiucd icon

mcp-server-api-key

Verified Safe

by horatiucd

Overview

Demonstrates how to secure a Model Context Protocol (MCP) Server with an API key using Spring MCP Server Security.

Installation

Run Command
API_KEY_ID=<your-api-key-id> API_KEY_SECRET=<your-api-key-secret> mvn spring-boot:run

Environment Variables

  • api.key.id
  • api.key.secret

Security Notes

The server correctly retrieves API key ID and secret from environment variables or configuration files, preventing hardcoding in source. It integrates Spring Security with MCP API Key authentication. The use of `InMemoryApiKeyEntityRepository` for key storage is acceptable for a demonstration but would require a more robust, persistent solution (e.g., database, vault) for a production environment.

Similar Servers

Stats

Interest Score0
Security Score9
Cost ClassLow
Avg Tokens50
Stars0
Forks0
Last Update2026-01-13

Tags

Spring BootMCPAPI KeySecurityDemo