DocsAPI ReferenceAuthentication
Authentication

API Authentication

Learn how to authenticate with the MCPSafe API using API keys or session-based auth.

API Key Authentication

Recommended for server-to-server communication and CI/CD pipelines.

Getting an API Key

  1. 1Sign in to your MCPSafe account
  2. 2Go to Settings → API Keys
  3. 3Click "Create New Key" and give it a name
  4. 4Copy and securely store your key (it won't be shown again)

Using Your API Key

Include your API key in the Authorization header:

Authorization Header
curl https://api.mcpsafe.org/api/v1/servers \
  -H "Authorization: Bearer mcp_abc12345_xxxxxxxxxxxxxxxx"

Alternative: X-API-Key Header

X-API-Key Header
curl https://api.mcpsafe.org/api/v1/servers \
  -H "X-API-Key: mcp_abc12345_xxxxxxxxxxxxxxxx"

Security Best Practices

  • • Never commit API keys to version control
  • • Use environment variables for key storage
  • • Rotate keys regularly
  • • Use separate keys for different environments

API Key Format

MCPSafe API keys follow a specific format:

mcp_<8-char-prefix>_<32-char-secret>

mcp_ - Fixed prefix for identification

8-char-prefix - Public key identifier (safe to log)

32-char-secret - Secret portion (never expose)

Authentication Errors

401

Unauthorized

Missing or invalid API key. Check that your key is correct and included in the request headers.

403

Forbidden

Your API key is valid but lacks permission for this action. Check your account plan and permissions.