Skip to main content
The LeadMagic MCP server authenticates every request using your API key. The same key works across the MCP server, the REST API, and the CLI.

How Authentication Works

Your API key is sent as the x-leadmagic-key header on every MCP request. The server validates the key against the LeadMagic API and checks that your account has available credits.
POST https://mcp.leadmagic.io/mcp
x-leadmagic-key: lm_your_api_key_here
Content-Type: application/json

Per-Request

Your key is passed on every request and never stored on the server.

One Key

Same key as the REST API and CLI — manage it in one place.

Credit-Based

Each tool call deducts credits from your account balance.

Get Your API Key

1

Sign up or log in

Go to app.leadmagic.io and create an account or sign in.
2

Navigate to API settings

3

Copy your key

Click the copy button. Your key starts with lm_.

Security Best Practices

If you use a project-level MCP config file (.cursor/mcp.json, .vscode/mcp.json, .mcp.json), add it to .gitignore:
.cursor/mcp.json
.vscode/mcp.json
.mcp.json
For team-shared configs, use environment variable interpolation where your client supports it.
Some MCP clients support env var interpolation in config files:
  • Windsurf: "${env:LEADMAGIC_API_KEY}"
  • VS Code: Use input variables with password: true (see setup guide)
  • Claude Code: Store the key in ~/.claude.json (local scope, not committed)
If your key is exposed, generate a new one immediately at Settings > API and update your MCP client config.
Check your credit consumption regularly. Use the check_credits tool (free) or visit your dashboard.

Authentication Errors

ErrorCauseSolution
401 UnauthorizedMissing or invalid API keyCheck that x-leadmagic-key is set correctly in your config
403 ForbiddenNo credits remainingPurchase credits or check your balance
Invalid API keyMalformed keyEnsure the key starts with lm_ and is copied completely
Test your authentication by asking your AI assistant to “check my LeadMagic credits.” The check_credits tool is free and confirms your key is working.

Next Steps