Clay logo

LeadMagic has made more than one billion API calls with Clay and won The Unstoppable Wheel award.

Recap
LeadMagicDocs

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.

The hosted server does not accept static API key headers. Use OAuth in Claude, ChatGPT, Codex, Cursor, VS Code, and other supported clients. Clients without an OAuth flow, such as GitHub Copilot cloud agent, JetBrains AI Assistant, or your own API code, must send an OAuth access token. See Use from your own code.

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

1

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.

2

Sign in when prompted

Complete the LeadMagic OAuth flow in the browser. In Claude Code, run /mcp → Authenticate (or claude mcp login leadmagic).

3

Verify

Ask: "Check my LeadMagic credit balance." check_credit_balance is free and confirms auth.

Open the LeadMagic MCP setup guide to choose a client.

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

Keep local MCP config and environment files out of git. Prefer the client's built-in OAuth storage.

In MCP settings: disconnect LeadMagic, sign in again. See troubleshooting.

check_credit_balance (free) or get_account_analytics for usage and rate-limit headroom.

Authentication errors

ErrorCauseSolution
401 / not signed inNot signed in or expired sessionReconnect OAuth in MCP settings; new chat in Claude.ai/ChatGPT connectors
401 after sign-in (Claude.ai)Client or redirect issueSee troubleshooting
403 insufficient_scopeThe current OAuth grant is missing a required LeadMagic permissionDisconnect LeadMagic and reconnect. Approve access and choose your workspace if prompted. Start a new chat and check your balance.
Out of creditsThe workspace balance is emptyBilling
Not allowed for your accountPlan, trial or workspace role does not include this operationCheck 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