AI agents
Last updated
MapGopher ships with a built-in MCP server, so an AI agent can run scans, read results, and export files the same way you do in the app. This page covers connecting an agent and the workflow it should follow; the tool reference lists every tool, parameter, and output field.
What agents can do
- “Find roofers within 30 miles of Austin, keep only the ones with a verified email, and send me an Excel file.” The agent expands the radius into a city list, scans every keyword x location combination, filters to rows whose email is validated, and exports an XLSX into MapGopher’s export folder.
- “Re-run last week’s dentists scan and tell me who’s new.” The agent reuses the keywords and locations from
get_scan_history, scans again, then callsget_new_listingswithsince: "last_scan"so only rows first seen after the previous scan come back. - “Rank Seattle cosmetic dentists by review count.” The agent sorts and filters server-side, then pages through the rows without dumping the whole dataset into the conversation.
Setup in four steps
- In MapGopher, open Settings → AI agents and switch the server on. The panel status shows Running, with the port, once it is up.
- Press Copy agent setup prompt. The copy only works while the server is running. If the server is stopped, MapGopher refuses and tells you to enable it first, so the endpoint it hands over is always one that is currently answering.
- Paste the prompt into your agent (Claude Code, Cursor, or any chat agent that can follow instructions and edit its own MCP configuration). The prompt contains the endpoint, the token, and the wiring steps; the agent completes the setup itself.
- Restart the agent session when it asks. Agents discover MCP tools when they connect, so the MapGopher tools appear after the reconnect.
Manual setup for any client
Any MCP client that speaks Streamable HTTP can connect with two values from the panel: the endpoint URL and a bearer token. Every request must carry an Authorization: Bearer header.
Use the endpoint exactly as shown in the panel. The port is not fixed: the default is 4788, the MAPGOPHER_MCP_PORT environment variable overrides it, and if the requested port is already taken the app automatically moves to a different one. That happens on every platform, and on Windows also for ports another process has pre-bound, which Windows reports as a permission error rather than in-use. Never hardcode a port into configs you share or check in.
Claude Code, added from the command line:
claude mcp add --transport http mapgopher <endpoint> --header "Authorization: Bearer <token>"
The same connection as a config-file entry (a Claude Code-style mcpServers block works in Cursor and most other clients):
{
"mcpServers": {
"mapgopher": {
"type": "http",
"url": "<endpoint>",
"headers": {
"Authorization": "Bearer <token>"
}
}
}
}
The workflow
A full run follows this sequence:
expand_radius(optional): turns a center and a radius into a list of city names forstart_scan. It runs offline against the bundled city database and starts nothing, so it works without a license.start_scan: takeskeywordsandlocationsand returns immediately with ascan_idwhile the scan runs in the background.scrape_emailsdefaults tofalse; enabling it makes the scan visit every business website to collect emails and social profiles, which is much slower.get_scan_statuswithwait_seconds: 600: ONE call blocks server-side until the scan finishes or the 600-second cap passes. If the call returns with the scan still running, call it again; do not poll in a tight loop.summarize_results: totals, email and website coverage, and top categories, before any rows are fetched.get_results: compact rows, paged withpage_sizeup to 200, narrowed byfilterand ordered bysort.export_results: writes CSV, JSON, XLSX, or Markdown into MapGopher’s own export directory; pass a bare filename likeleads.csvor omit the path for a timestamped default name.
Timeouts
wait_seconds blocks on the server, but many MCP clients cap each tool call at 300 seconds. Keep waits below your client’s limit, or raise the limit; Hermes users, for example, can set mcp_servers.mapgopher.timeout to 660 to cover a 600-second wait. If a wait ends with the scan still running, call get_scan_status again; no progress is lost.
Saving tokens
- Call
summarize_resultsbeforeget_results, so the agent reads the totals once instead of paging through rows to learn them. - Filter server-side rather than in the conversation.
email_valid: trueis the gate for outreach, since only MX-validated, deliverable addresses pass.min_reviewsdrops thin listings, andhide_duplicates: true(off by default) collapses same-phone duplicates for the view without deleting any rows. - Read up to 200 rows per
get_resultspage by settingpage_size. - Rows usually carry a stable
place_id, so the agent can cross-reference the same business acrossget_resultscalls; exports identify rows bygoogle_maps_url. - In
summarize_results, read the scope labels before quoting numbers:totals_scope: "cumulative_store"means the totals cover everything saved across scans, whileby_combo_scope: "latest_scan_new_rows"means the per-combination counts cover only the rows the latest scan added. Combo counts do not sum to the total and can be zero after a stopped scan.
Licensing over MCP
MapGopher verifies your license when it launches (internet required). When an AI agent uses MapGopher over MCP, the scan and export tools also check the license on each call; status and summary tools always work.
If a tool reports a license problem, the agent should call get_license_status to diagnose it; the response refreshes the verdict and contacts the license server when needed.
Headless mode
Clients that launch processes themselves, rather than connecting over HTTP, can use the stdio transport: start the MapGopher executable with the --mcp flag (--headless is an alias) and it serves MCP over stdin and stdout, no token required. On Windows the executable is map-gopher.exe inside the install folder; on macOS it lives inside MapGopher.app.
{
"mcpServers": {
"mapgopher": {
"command": "C:\\Users\\you\\AppData\\Local\\MapGopher\\map-gopher.exe",
"args": ["--mcp"]
}
}
}
Security
The HTTP server binds to loopback (127.0.0.1) only, so other machines can’t reach it, and every request must present the panel’s bearer token. Keep that token private: anyone holding it can drive scans and read your results. Regenerate mints a fresh token and revokes the old one immediately, so agents still configured with the old token stop working until they are updated.
For every command, its parameters, and its output fields, see the tool reference.