Authentication
How OAuth sign-in works for the hosted LeadMagic MCP server: security practices and fixing 401 errors.
Hosted LeadMagic MCP uses OAuth. Sign in with your LeadMagic account in the AI client. Each tool call uses a short-lived server credential.
How it works
OAuth sign-in
One-time browser flow per client; refresh keeps you signed in.
Per-request
Short-lived credentials per call: your API key is not pasted into chat or config.
Credits
Same account and balance as app.leadmagic.io.
Connect a client
Add the server URL
Use https://mcp.leadmagic.io/mcp/anthropic for Claude apps and Claude Code. Other supported clients can use https://mcp.leadmagic.io/mcp for the full catalog or choose a focused connection. See the setup guide for your client.
Sign in when prompted
Complete the LeadMagic OAuth flow in the browser. In Claude Code, run /mcp → Authenticate (or claude mcp login leadmagic).
Verify
Ask: "Check my LeadMagic credit balance." check_credit_balance is free and confirms auth.
REST API keys (separate from MCP)
API keys at Settings → API are for the REST API and API integrations: not for LeadMagic CLI or hosted MCP configuration. LeadMagic CLI uses lm login; hosted MCP clients use their OAuth flow. If you need programmatic REST access, use the API docs.
Security practices
Do not commit OAuth tokens or API keys
Do not commit OAuth tokens or API keys
Keep local MCP config and environment files out of git. Prefer the client's built-in OAuth storage.
Reconnect if auth breaks
Reconnect if auth breaks
In MCP settings: disconnect LeadMagic, sign in again. See troubleshooting.
Monitor usage
Monitor usage
check_credit_balance (free) or get_account_analytics for usage and rate-limit headroom.
Authentication errors
| Error | Cause | Solution |
|---|---|---|
401 / not signed in | Not signed in or expired session | Reconnect OAuth in MCP settings; new chat in Claude.ai/ChatGPT connectors |
401 after sign-in (Claude.ai) | Client or redirect issue | See troubleshooting |
403 insufficient_scope | The current OAuth grant is missing a required LeadMagic permission | Disconnect LeadMagic and reconnect. Approve access and choose your workspace if prompted. Start a new chat and check your balance. |
| Out of credits | The workspace balance is empty | Billing |
| Not allowed for your account | Plan, trial or workspace role does not include this operation | Check your plan and workspace membership, or contact support |
After we ship an update
Hosted MCP behavior updates when we release. Reload your MCP connection and start a new chat. You do not need to change your client config. Reload steps.
Next steps
Tables REST automation
Use the OAuth automation bridge to read and edit LeadMagic tables without an MCP client, with explicit operation batches, run quotes, idempotency, and workspace checks.
Tools, Resources & Prompts
LeadMagic MCP tools for research, enrichment, bulk jobs, LeadMagic Tables, credits, resources, and example prompts.
Was this page helpful?
We value your feedback.