leadgraph-mcp
# leadgraph-mcp
An MCP server for **local lead generation**. Ask your assistant for "dentists in Austin whose Instagram went quiet, and who runs them", and it:
1. **finds the businesses** on Google Maps (or takes your own list, or a [placegraph-mcp](https://github.com/0xlearner/placegraph-mcp) job);
2. **checks their presence**: is the website alive, which business email and phone it publishes, who its team page names, and which Instagram, Facebook, TikTok and YouTube accounts are really theirs, with followers and **when each last posted**;
3. **finds the decision-makers** on LinkedIn, each with a tier (*verified*, *probable*, *possible*) and the evidence behind it;
then returns one scored, explained row per business, ready for your CRM (CSV), a spreadsheet, or Neo4j.
> Most lead lists tell you a business exists. This one tells you whether anyone is home: a dental practice that last posted on Instagram 4 years ago, with the owner's LinkedIn and the front desk's inbox.
Data comes from three actors on Apify, run on **your** Apify account (you pay per result, see [Costs](#costs)): [Google Maps Full Suite](https://apify.com/nextgensda/google-maps-full-suite), [Business Website Contacts & Social Media Presence](https://apify.com/nextgensda/business-presence) and [LinkedIn Profile & Company Search](https://apify.com/nextgensda/linkedin-scraper). The server itself is free and open source.
## What you can ask
| You are | Ask your assistant | `focus` |
|---|---|---|
| **A social media agency** | "Dentists in Austin whose Instagram or Facebook went quiet, with someone to contact" | `social_agency` |
| **A web / SEO agency** | "Roofers in Dallas with a dead website or no public email" | `web_agency` |
| **A B2B sales team** | "Dental practices near Houston and who runs them, with a business email" | `b2b_sales` |
| **Reputation management** | "From my placegraph territory job: businesses trailing their competitors, with their owners" | `reputation` |
| **CRM / RevOps** | "Add social accounts and decision-makers to these 80 accounts" (your rows) | any |
**[Worked examples](examples/README.md)**: one per use case, run from a plain prompt in Claude Code, with the tools it picked, its answer and the Apify cost ($0.04 to $0.66 each).
### Example: 15 Austin dentists (December 2026)
One prompt, three steps, about 9 minutes, **$0.53**:
- **Websites:** 15 of 15 working; a business inbox on 13 (info@, frontdesk@, care@…), staff members' personal addresses withheld.
- **Social:** 33 accounts read, 9 practices active in the last 30 days, **10 silent on at least one platform for over 6 months**. One practice's Instagram, Facebook and YouTube had all been quiet for 10 months to 3 years.
- **Decision-makers:** found for 10 of 15: **6 verified** (the practice's own site names the dentist and the profile matches city and profession, or their LinkedIn lists the practice's domain), **4 probable** (their LinkedIn employer is the practice, in Austin). An owner, an operations director, an office manager and dentists; where only staff turned up (assistants, hygienists), no one is called the decision-maker.
`focus: social_agency` put the practice with every account silent on top; `b2b_sales` put the ones with a verified dentist and a business inbox on top.
### Example: 10 Dallas roofers
About 2.5 minutes, **$0.30**: business inbox on 8 of 10, decision-maker for 7 (5 verified), one roofer's Instagram silent for 4 years and Facebook for 2.5, one whose site links an Instagram account that no longer exists (`instagram_link_broken`).
## Directories
Listed in the [official MCP Registry](https://registry.modelcontextprotocol.io/v0/servers?search=leadgraph) (`io.github.0xlearner/leadgraph-mcp`).
## Install
You need an [Apify API token](https://console.apify.com/settings/integrations). A free Apify account includes monthly credit.
**Hosted (no install).** The server runs on Cloudflare Workers at `https://leadgraph-mcp.rhat398.workers.dev/mcp` (Streamable HTTP). Send your Apify token as a bearer header; it's used for that request only and never stored or logged:
```bash
claude mcp add --transport http leadgraph https://leadgraph-mcp.rhat398.workers.dev/mcp \
--header "Authorization: Bearer apify_api_..."
```
Clients that can't set headers (claude.ai custom connectors, which use OAuth) aren't supported yet. Or run it locally:
**Claude Code**
```bash
claude mcp add leadgraph -e APIFY_TOKEN=apify_api_... -- npx -y github:0xlearner/leadgraph-mcp
```
**Claude Desktop, Cursor, VS Code** (`mcpServers` config):
```json
{
"mcpServers": {
"leadgraph": {
"command": "npx",
"args": ["-y", "github:0xlearner/leadgraph-mcp"],
"env": { "APIFY_TOKEN": "apify_api_..." }
}
}
}
```
Works well next to placegraph-mcp: its job ids are accepted by `import_businesses`.
## Tools
| Tool | What it does | Starts runs |
|---|---|---|
| `estimate_pipeline` | Upper-bound cost of each step for N businesses. | no |
| `find_businesses` | Google Maps search (optionally a grid past ~120 per search): name, category, address, phone, website, rating. | yes |
| `import_businesses` | Your own rows (up to 100), or a placegraph job (its competitor context comes along). | no |
| `check_presence` | Website status, business emails, phones, the team; each social account's match to the business, followers, last post, posts in 90 days. | yes |
| `find_decision_makers` | LinkedIn: company pages the websites link (and the people they list), the business name, the people the website names. Tiered, with evidence. | yes |
| `job_status` | A step's status; when done, its result and the next step with its estimate. | no |
| `lead_sheet` | The joined list, scored by `focus`, with filters (`has_email`, `has_decision_maker`, `inactive_on`, `flag`, `min_score`). | no |
| `lead_profile` | Everything about one business: every person and account with its evidence, scores for every focus. | no |
| `export_leads` | `csv` (one row per business, CRM-ready), `json`, `cypher` (Neo4j: Business, Account, Person). | no |
**Jobs.** Each step takes minutes. A step waits up to `wait_s` (default 45 s), then returns a `job_id`; `job_status(job_id)` returns the result when it's done, including the next step's call and estimate. Job ids are self-contained: they work in a later conversation too, while Apify keeps the runs' data (your plan's retention).
## How accounts and people are matched
**Social accounts** (`tier` on each account):
| Tier | Meaning |
|---|---|
| `mutual` | the website links the account and the account links back: certain |
| `website` | the website links it (header, footer or structured data; site builders' own accounts are left out) |
| `profile` | only the account links the website |
**People** (`tier` on each person):
| Tier | Meaning |
|---|---|
| `verified` | their LinkedIn lists the business's domain; **or** the business's own website names them and the profile is in the same city and profession; **or** the business's LinkedIn page (its website is the business's domain) lists them, in the city |
| `probable` | their LinkedIn employer, headline or title names the business, in the city |
| `possible` | weaker (e.g. the right employer, another city). Listed, never scored |
Same-name profiles in other cities are dropped. `decision_maker` is `yes` for owner, founder, partner, principal, director, manager roles; `likely` for the practitioner at a small practice (Dr, DDS, Esq.); `no` for staff (assistant, hygienist, coordinator…), who are listed but never chosen.
## Scores
All 0-100, computed on the server from the row (change them in `src/score.ts`):
- **presence_score**: per platform, 1 if the business's own account posted in the last 30 days, 0.5 in 90 days, 0 otherwise or missing; platforms weighted by how many businesses in the batch use them (at least 0.1).
- **contactability**: business email 50, phone 20, decision-maker 30 × tier (verified 1, probable 0.7).
- **lead_score** by `focus`:
- `social_agency`: 55 × (1 − presence/100) + 25 × email + 20 × decision-maker tier (no website and no accounts: 0);
- `web_agency`: 60 × website problem (no site or dead 1, blocks visitors 0.7, no public email 0.5) + 20 × phone + 20 × decision-maker tier;
- `b2b_sales`: 50 × decision-maker tier (×1.2 for a decision-maker role, capped) + 30 × email + 20 × phone;
- `reputation`: 60 × rating gap to Google's "people also search for" competitors (0.5 stars = full; without them, 4.7 − rating over 0.7) + 20 × email + 20 × decision-maker tier.
Flags explain the rest: `website_dead`, `no_public_email`, `instagram_inactive_90d`, `facebook_link_broken`, `no_tiktok_while_40pct_of_peers_have_one`, `no_decision_maker_found`, `rating_below_competitors`…
## Costs
Each step shows its estimate first, refuses to start above `max_cost_usd` (default $5), and is capped at its estimate on Apify. Measured in December 2026:
| Task | Time | Cost |
|---|---|---|
| 15 dentists, all three steps | ~9 min | $0.53 |
| 10 roofers, all three steps | ~2.5 min | $0.30 |
| Find businesses, per business | | ~$0.002 |
| Presence, per business (website + ~2 accounts) | | ~$0.01 |
| Decision-makers, per business | | ~$0.015-0.02 |
`lead_sheet`, `lead_profile` and `export_leads` cost nothing: they reuse finished jobs' data.
## Good to know
- **Emails are business inboxes** (info@, office@, names of the business) unless you ask `check_presence` for `personal_emails`; staff members' own addresses published on websites are counted (`personal_emails_withheld`) but not returned. No email guessing, no personal phone numbers.
- **LinkedIn searches can come back empty** when Google limits them for a while; the result says which businesses weren't reached. Run `find_decision_makers` again later.
- **Facebook pages that can't be seen logged out** (removed, renamed, age-restricted, or a personal profile) are reported as `unavailable` with `facebook_link_broken`.
- **YouTube upload dates are approximate** (YouTube shows "3 weeks ago").
- **Hosted server limits.** The hosted endpoint runs on Cloudflare's free plan, which gives each call a small CPU and request budget: `lead_sheet` returns up to 100 rows per call (page with `offset`), and a call that would need more requests than the budget says so. Measured: a 100-business sheet in 15-42 ms of CPU. The local server (`npx`) has no such limits.
- You're responsible for using the data lawfully, including how you contact people (GDPR, CAN-SPAM, PECR).
## Development
```bash
npm install
npm test # offline: fixtures from a real job, people pseudonymized
npm run build
APIFY_TOKEN=... node scripts/live-smoke.mjs dentist "Austin, TX" 15 # live, ~$0.50
APIFY_TOKEN=... node scripts/weekly-check.mjs # five known businesses, all steps, ~$0.15 (also weekly in CI)
```
## License
Apache-2.0
TDQS
Scored across 9 tools
Each tool has a distinct role in a coherent pipeline: sourcing (find_businesses/import_businesses), enrichment (check_presence/find_decision_makers), inspection (lead_profile/lead_sheet), and control (estimate_pipeline/job_status/export_leads). Minor overlap between lead_sheet (joined list) and export_leads (same data as CSV/JSON/Cypher), and between lead_profile and find_decision_makers (both surface people), but descriptions clarify scale and purpose.
Dominant verb_noun pattern (find_businesses, import_businesses, check_presence, find_decision_makers, export_leads, estimate_pipeline) is clear and predictable. Three noun-only names (job_status, lead_profile, lead_sheet) deviate slightly but remain readable and intuitive within the lead-graph domain.
Nine tools is well-scoped, each mapping to a distinct pipeline stage with no redundancy. Free vs. paid (actor run) tools are cleanly separated, and the count supports the multi-step workflow without bloating the surface.
The full lifecycle—cost estimate, sourcing, presence/contact enrichment, decision-maker discovery, profiling, lead sheet, and export—is covered, with async job status handled. Minor gaps exist: no list-jobs or cancel-job operation, so agents cannot enumerate or abort runs beyond polling a known job_id.