API reference / MCP server

Claude MCP server

Connect Claude to LocalLeads via the Model Context Protocol. Claude can search Google Maps, enrich contacts, and manage credits — straight from a conversation.

Pick your path

Two ways to connect, depending on where you're using Claude.

Claude.ai (Pro / Team / Enterprise / Max)
Remote MCP — add custom connector
OAuth (one click)
Claude API mcp_servers
Remote MCP — paste URL + token
API key ll_…
Claude Desktop, Cursor, VS Code
Stdio MCP — install npm package
API key ll_…

Claude.ai

Claude.ai discovers LocalLeads through standard OAuth (Dynamic Client Registration + PKCE). All you need is our MCP URL.

  1. In Claude.ai, open Settings → Connectors → Add custom connector.
  2. Paste the URL:
    text
    https://leadsapi.postorbit.io/mcp
  3. Sign in to LocalLeads on the authorization screen and approve.
  4. You're back in Claude.ai with the LocalLeads tools wired up.
Revoke any time from Settings → Security in the LocalLeads dashboard, or from Settings → Connectors in Claude.ai.

Claude API

The Messages API supports remote MCP servers via the mcp_servers field (beta header anthropic-beta: mcp-client-2025-11-20). Pass your ll_… API key as authorization_token:

bash
curl https://api.anthropic.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "X-API-Key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "anthropic-beta: mcp-client-2025-11-20" \
  -d '{
    "model": "claude-opus-4-7",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Find me 20 plumbers in Manchester" }
    ],
    "mcp_servers": [
      {
        "type": "url",
        "url": "https://leadsapi.postorbit.io/mcp",
        "name": "localleads",
        "authorization_token": "ll_your_key_here"
      }
    ],
    "tools": [
      { "type": "mcp_toolset", "mcp_server_name": "localleads" }
    ]
  }'

Or with the TypeScript SDK:

typescript
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.beta.messages.create({
  model: "claude-opus-4-7",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Find me 20 plumbers in Manchester" }],
  mcp_servers: [
    {
      type: "url",
      url: "https://leadsapi.postorbit.io/mcp",
      name: "localleads",
      authorization_token: process.env.LOCALLEADS_API_KEY!,
    },
  ],
  tools: [{ type: "mcp_toolset", mcp_server_name: "localleads" }],
  betas: ["mcp-client-2025-11-20"],
});
Generate an API key under Settings → Security → API Keys. Keys start with ll_ and can be revoked at any time.

Claude Desktop, Cursor, VS Code

Local MCP clients spawn the server as a subprocess and talk over stdio. Install once with npm and add a config entry.

Claude Desktop

Edit your Claude Desktop config file:

  • macOS  ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows  %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "localleads": {
      "command": "npx",
      "args": ["-y", "@localleads/mcp"],
      "env": {
        "LOCALLEADS_API_KEY": "ll_your_api_key_here"
      }
    }
  }
}

Restart Claude Desktop. The LocalLeads tool icon appears in the chat toolbar.

Cursor / VS Code

Add the server to .cursor/mcp.json or .vscode/mcp.json:

json
{
  "servers": {
    "localleads": {
      "command": "npx",
      "args": ["-y", "@localleads/mcp"],
      "env": {
        "LOCALLEADS_API_KEY": "ll_your_api_key_here"
      }
    }
  }
}

Global install

bash
npm install -g @localleads/mcp
# then use "localleads-mcp" as the command instead of "npx"

Environment variables

LOCALLEADS_API_KEY*

Your LocalLeads API key (starts with ll_). The server exits on startup without it.

LOCALLEADS_API_BASE

Override the API base URL. Defaults to https://leadsapi.postorbit.io. Self-hosted only.

Tools

Ten tools, identical across stdio and remote MCP. Claude picks the right one based on what you ask — you never call them by name.

search_leads
charges credits

Search Google Maps for local businesses. Returns a query ID you poll with get_query_progress.

get_query_progress
free

Check the status of an in-flight search (PENDING → PROCESSING → COMPLETED).

get_search_results
free

Retrieve the leads from a completed search. Compact shape by default; pass compact: false for full payloads.

list_all_leads
free

List every lead saved in your account. Compact shape by default; pagination and email/phone/website/quality filters.

get_lead
free

Fetch one lead by ID with the full payload + enrichment status. Pair with the compact list tools to drill in on demand.

enrich_leads
1 credit per lead

Find verified business emails for one or more leads. Returns a job ID; track with list_enrichment_jobs.

get_enrichment_result
free

Get the enrichment result (email, confidence score) for a lead.

verify_email
free

Verify an email address (syntax + MX records). Useful for ad-hoc checks of pasted addresses.

list_enrichment_jobs
free

List all in-flight search and enrichment jobs in the account.

check_credits
free

Return monthly credits, bonus credits, used credits, and available balance.

OAuth & discovery

For MCP clients that auto-discover OAuth (Claude.ai, MCP Inspector, the official CLIs), we expose the standard well-known documents and OAuth endpoints.

GETleadsapi.postorbit.io/.well-known/oauth-protected-resource
GETleadsapi.postorbit.io/.well-known/oauth-authorization-server
POSTleadsapi.postorbit.io/oauth/register
GETleadsapi.postorbit.io/oauth/authorize
POSTleadsapi.postorbit.io/oauth/revoke

Public clients use PKCE (S256); confidential clients use client_secret_basic. Access tokens are 1-hour TTL; refresh tokens rotate on every use.

Example conversation

You

Find me 20 plumbers in Manchester, UK and check if I have enough credits.

Claude

I'll check your credits first, then kick off the search. [calls check_credits → 47 credits available] [calls search_leads → query ID: q_abc123] You have 47 credits — plenty. Search started, give it 10–15 seconds.

You

Yes, and then enrich the top 3 for emails.

Claude

[calls get_search_results → 20 leads] [calls enrich_leads → 3 jobs running] Top 3 leads with enrichment started: 1. Manchester Plumbing Co — 0161 123 4567 2. City Drain Services — 0161 987 6543 3. Fast Flow Ltd — 07700 900 123

Troubleshooting

Claude.ai says "Couldn't authenticate" after I paste the URL

Make sure you pasted the full https://leadsapi.postorbit.io/mcp URL, including /mcp. Claude.ai discovers OAuth from there. If you see a redirect loop, sign in to LocalLeads in a separate tab first.

MCP Inspector or another client gets a 401

401 is expected on the first request — clients should follow the WWW-Authenticate header to /.well-known/oauth-protected-resource and complete the OAuth flow. If you're calling the API directly, pass a bearer token in the Authorization header.

Stdio tool doesn't appear in Claude Desktop

Fully quit and restart Claude Desktop after editing the config. Check the path matches your OS. View Claude Desktop's logs (Help → Show Logs) for spawn errors.

Error: LOCALLEADS_API_KEY environment variable is required

The env block in your stdio config isn't being read. Check the JSON is valid (no trailing commas) and the key name is spelled correctly.

API calls return 401 Unauthorized

Your API key may have been revoked or expired. Regenerate one under Settings → Security → API Keys.

search_leads returns 402 Payment Required

You're out of credits. Check your balance with check_credits and upgrade your plan on the billing page.