Infisical provides end-to-end encrypted secrets management for your MCP Server. Store API keys, credentials, and configuration securely with automatic injection and rotation.
Infisical is an open-source alternative to HashiCorp Vault with a focus on developer experience and end-to-end encryption.
# .envINFISICAL_CLIENT_ID=your-client-idINFISICAL_CLIENT_SECRET=your-client-secretINFISICAL_PROJECT_ID=your-project-idINFISICAL_ENVIRONMENT=production # dev, staging, production
4
Add Secrets to Infisical
In Infisical Dashboard:
Go to Secrets
Select production environment
Add secrets:
ANTHROPIC_API_KEY
GOOGLE_API_KEY
JWT_SECRET_KEY
KEYCLOAK_CLIENT_SECRET
REDIS_PASSWORD
5
Test Integration
Copy
Ask AI
from mcp_server_langgraph.config import settings# Secrets automatically loaded from Infisicalprint(f"LLM Provider: {settings.llm_provider}")print(f"Has API Key: {bool(settings.anthropic_api_key)}")
Secrets are automatically loaded on application startup:
Copy
Ask AI
from mcp_server_langgraph.core.config import settings## All secrets loaded from Infisicalapi_key = settings.anthropic_api_keydb_password = settings.redis_passwordjwt_secret = settings.jwt_secret_key
from infisical import InfisicalClientclient = InfisicalClient( client_id=os.getenv("INFISICAL_CLIENT_ID"), client_secret=os.getenv("INFISICAL_CLIENT_SECRET"))## Get single secretsecret = client.get_secret( secret_name="ANTHROPIC_API_KEY", project_id=os.getenv("INFISICAL_PROJECT_ID"), environment="production")print(secret.secret_value)## Get all secretssecrets = client.get_all_secrets( project_id=os.getenv("INFISICAL_PROJECT_ID"), environment="production")for secret in secrets: print(f"{secret.secret_name}: {secret.secret_value}")
## Update secret valueclient.update_secret( secret_name="ANTHROPIC_API_KEY", secret_value="new-api-key", project_id=project_id, environment="production")## Application automatically picks up new value on next fetch
## 1. Add new secret with version suffixclient.create_secret( secret_name="ANTHROPIC_API_KEY_V2", secret_value="new-key", project_id=project_id, environment="production")## 2. Deploy application using new secret## 3. Delete old secretclient.delete_secret( secret_name="ANTHROPIC_API_KEY_V1", project_id=project_id, environment="production")
with open(‘secrets.txt’) as f:
for line in f:
key, value = line.strip().split(’=’, 1)
client.create_secret(
secret_name=key,
secret_value=value,
project_id=project_id,
environment=“production”
)