placegraph
# placegraph-mcp
An MCP server that turns Google Maps into a **knowledge graph** of the businesses in an area: who customers compare, which leads trail their competitors, how busy a trade area is, who answers their reviews, and how Maps places join to your own records.
The edges come from Google's own **"People also search for"** panel, the list of places Google shows next to a business because people look at them together. Keyword search and star ratings can't tell you that two businesses are substitutes. This list can.
> One run gives you a map of who your real competitors are, according to Google itself.
Data comes from the [Google Maps Full Suite](https://apify.com/nextgensda/google-maps-full-suite) actor on Apify. It runs on **your** Apify account and you pay per result (see [Costs](#costs)). The server itself is free and open source.
## What you can ask
| Use case | Ask your assistant | Tools |
|---|---|---|
| **Competitive knowledge graph** | "Which coffee shops in Austin do customers actually compare, and how do they cluster?" | `competitor_graph`, `alternatives`, `export_graph` |
| **Territory leads with competitor context** | "Find every dentist within 10 km of downtown Austin and show me the ones that trail their competitors." | `territory_leads`, `enrich_leads`, `find_places` |
| **Footfall-aware site selection** | "Should our new gym go on South Lamar or West Anderson Lane?" | `site_selection`, `walk_times` |
| **Review response tracking** | "Which of these 12 locations aren't replying to bad reviews?" | `review_responses` |
| **Graph-backed recommendations** | "Best dentist open after 7 pm near downtown, and what else people consider" | `find_places`, `alternatives` |
| **Entity resolution** | "Match these CRM accounts to their Google Maps listings" | `match_entities` |
**[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 to $0.47 each).
### Example: Austin coffee shops (December 2026)
30 coffee shops, up to 24 "people also search for" places each: **209 places, 491 edges, 8 communities** (modularity 0.50).
- **Category anchors**, the places listed in the most panels: Houndstooth Coffee (11), Palomino Coffee, Radio Coffee & Beer, CaPhe.in (10 each), Proud Mary, Flightpath, Epoch (9 each).
- **Communities**: a specialty/third-wave cluster (Houndstooth, Epoch, Proud Mary, Radio), an "iconic South Congress" cluster (Mozart's, Jo's, Bouldin Creek), and neighbourhood groups. Google never labels them; the graph shows them.
- 7 of the 30 shops had no panel at all. Not every place has one.
### Example: Austin dentists
A grid search (2 km cells, 10 km radius, 25 cells) found **411 unique places inside the circle (362 of them dental)**, where a single Google Maps search stops at about 120. Of the 190 dental practices with 50+ reviews, 13 are rated below 4.5. `enrich_leads` compares each of them with the places Google lists next to it. For example, a 4.5-star practice whose competitors have a median of 4.9 gets a high outreach score.
## Install
You need an [Apify API token](https://console.apify.com/settings/integrations). A free Apify account includes monthly credit.
**Claude Code**
```bash
claude mcp add placegraph -e APIFY_TOKEN=apify_api_... -- npx -y github:0xlearner/placegraph-mcp
```
**Claude Desktop, Cursor, VS Code** (`mcpServers` config):
```json
{
"mcpServers": {
"placegraph": {
"command": "npx",
"args": ["-y", "github:0xlearner/placegraph-mcp"],
"env": { "APIFY_TOKEN": "apify_api_..." }
}
}
}
```
Tip: create a token in Apify that is limited to running this actor and reading its datasets.
Not on npm yet: `npx` builds it from GitHub on first use (Node 20+). Or clone it, `npm install`, and point the config at `node /path/to/placegraph-mcp/dist/stdio.js`.
## Tools
| Tool | What it does | Starts runs |
|---|---|---|
| `competitor_graph` | Search a category in an area. The result is a graph of the places listed under "People also search for", with its anchors (in-degree) and communities (Louvain). | yes |
| `territory_leads` | Grid search past the ~120-per-search cap. Returns a summary, the lowest-rated leads and join-key coverage. | yes |
| `enrich_leads` | Adds each lead's competitors from a territory job and scores the lead: rating gap, review share, outreach score. | yes |
| `site_selection` | For each candidate address: nearby competitors, distance, rating, popular times (hourly busyness), a saturation index, and competitors shared between candidates. | yes |
| `walk_times` | Walking, driving or cycling time from each candidate to its nearest competitors. | yes |
| `review_responses` | Reply rate, reply rate on low ratings, response-time buckets, and unanswered low-rated reviews. | yes |
| `job_status` | A job's status. Once its runs finish, the job's analysis. | no |
| `find_places` | Filter a job's places: text, category, rating, reviews, website/phone, open at a time of day, distance. | no |
| `alternatives` | A place's neighbours in the graph (1-2 hops): what customers consider instead. | no |
| `match_entities` | Match your records to a job's places on place id, phone, website domain, street address and name. A shared phone or domain is reported as ambiguous instead of guessed. | no |
| `export_graph` | Export the graph as `cypher` (Neo4j), `graphml` (Gephi, yEd), `json` or `mermaid`; `focus_place_id` exports one place's neighbourhood. | no |
**Jobs.** Collecting data takes minutes. A tool that starts runs waits up to `wait_s` seconds (default 45). If the runs aren't done by then, it returns a `job_id`, and `job_status(job_id)` returns the result once they finish. Job ids are self-contained: they work in a later conversation too, for as long as Apify keeps the run's data (your Apify plan's data retention).
## Costs
Every tool that starts runs shows its estimate first and refuses to start above `max_cost_usd` (default $5). Each run is also capped at its estimate on Apify's side. Measured in December 2026 unless marked:
| Task | Time | Cost |
|---|---|---|
| Competitor graph: 30 places, up to 24 competitors each | ~10 min | ~$1.60 |
| Competitor graph: 30 places, 10 competitors each (default) | — | up to ~$1.00 (estimate) |
| Grid: 411 places in 10 km, 25 cells | ~11 min | ~$0.90 |
| Grid: 56 places in 3 km around downtown, 8 cells | ~4 min | ~$0.16 |
| Enrich 20 leads, 10 competitors each | ~5 min | ~$0.48 |
| Site selection, per candidate (nearby + wider search, popular times) | ~3-5 min | ~$0.14-0.17 |
| Walking time, per route | ~10 s | ~$0.006 |
| Review responses: 5 locations x 100 reviews | ~1 min | ~$0.26 |
`find_places`, `alternatives`, `match_entities` and `export_graph` cost nothing: they reuse a finished job's data.
## Load the graph into Neo4j
```
export_graph(job_id, format: "cypher")
```
Paste the output into Neo4j Browser (AuraDB Free works), then:
```cypher
MATCH (a:Place)-[r:PEOPLE_ALSO_SEARCH]->(b:Place) RETURN a, r, b
```
Colour the nodes by `community` and size them by `listed_by`.
## Good to know
- **"People also search for" isn't shown for every place.** Typically 20-30% have none on a given day, and Google varies the list from day to day. A graph is a snapshot.
- **Off-category places.** Panels sometimes list places of other kinds, such as a bar next to a coffee shop or an office next to a dentist. These are left out of the analysis unless you pass `include_off_category`.
- **Popular times** exist for roughly two in three established businesses, and not for new ones. Site selection reports the coverage for each candidate.
- **Response times are approximate.** Google gives a review's date exactly, but the owner's reply only as "3 weeks ago". Latency is therefore reported in buckets (same day, within a week, within a month, later), and as `uncertain` when it can't be pinned to one.
- **Other cities' branches.** A chain's panel can list its branches elsewhere. Entries more than 50 km from the place listing them are left out of the graph (`pas_far_dropped` counts them).
- **Vacation rentals** that show up in nearby searches (e.g. "Studio with gym and pool") are dropped from site selection.
- The data is what Google Maps shows publicly. You're responsible for using it in line with applicable laws and Google's terms.
## Development
```bash
npm install
npm test # offline: fixtures from real runs, reviewer data removed
npm run build
APIFY_TOKEN=... node scripts/live-smoke.mjs # live, small runs (~$0.30)
```
## License
Apache-2.0
TDQS
Scored across 11 tools
Most tools are cleanly separated by resource and stage: build a graph (competitor_graph), enumerate an area (territory_leads), score leads (enrich_leads), compare sites (site_selection), and read finished results (find_places, alternatives, export_graph, match_entities). The main soft spot is the cluster of graph-related tools (competitor_graph vs territory_leads vs enrich_leads vs alternatives), where an agent must read carefully to know which produces which artifact, but the descriptions do resolve it.
Everything is snake_case and readable, but there is no predictable verb pattern: some names are verb_noun (export_graph, enrich_leads, find_places, match_entities), others are bare noun phrases naming the artifact or job type (competitor_graph, territory_leads, site_selection, walk_times, review_responses, job_status, alternatives). An agent cannot infer from a name alone whether a tool starts a job, reads results, or exports.
Eleven tools is well within the sweet spot and each one maps to a distinct stage of the pipeline (discover, enrich, compare, export, join, filter). No obvious filler or redundancy in the count itself.
The competitive-analysis lifecycle is largely covered: discovery, enrichment, site comparison, routing, review auditing, export, and CRM matching. The notable gap is job lifecycle management — job_status requires an id but there is no list_jobs or cancel/delete job tool, which is a dead end for agents that lose track of a job id or need to stop a costly 5-15 minute run.