Base URL
All API calls are made against:- Server Management API (
/api/servers/...
) – Create, list, update, or delete MCP servers. - MCP Protocol API (
/mcp/...
) – Called by your assistant to invoke tools and connectors via JSON‑RPC.
API Keys and User IDs
Management requests require two headers:- API keys are generated in the Alloy dashboard and scoped to your account.
- Each API key is tied to a specific user ID to support multi-tenant architectures.
- Do not expose API keys in client-side code or public repositories.
- Rotate keys periodically for security.
Token URLs vs API Authentication
MCP protocol calls support two authentication methods:Token URL
Use the tokenized URL returned when creating the server:- No additional headers required.
- Ideal for embedding in assistants or simple client use cases.
API Authentication
Call the following endpoint:- Ideal for B2B scenarios where you need dynamic management of multiple users within an organization
- Allows for token rotation and additional control
- Enables per-user isolation without creating separate servers
- Requires clients to sign each request
Optional Headers
x-alloy-user-token
(JWT): Isolates requests by end user.x-credential-id
: Forces use of a specific credential.x-redirect-uri
: Used in OAuth flows for post-auth redirection.
Authentication Request Flow
This diagram shows the complete authentication and request flow:- Authentication: The MCP Server validates the request authentication
- Rate Limiting: Checks against rate limits (100 req/min default)
- Restrictions: Applies any configured access restrictions
- API Request: Makes authenticated request to Alloy API
- Credential Decryption: Alloy decrypts stored platform credentials
- Platform Call: Executes the action on the external platform
- Response: Returns formatted response to MCP client
Best Practices
- Least privilege: Restrict access to only the connectors and actions the server needs.
- Rotate secrets: Periodically regenerate API keys and server tokens.
- Isolate users: Use JWTs (
x-alloy-user-token
) to segregate end-user actions on shared servers. - Store secrets securely: Use environment variables or secret managers. Never hardcode credentials in code or HTML.