@mambalabsdev/mcp-local-rank-map-pack-tracker 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mamba Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,118 @@
1
- # Temporary Holding Version
1
+ # Local Rank and Map Pack Tracker MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![Smithery](https://smithery.ai/badge/mambabuilt/mcp-local-rank-map-pack-tracker)](https://smithery.ai/servers/mambabuilt/mcp-local-rank-map-pack-tracker) [![Glama score](https://glama.ai/mcp/servers/mambalabsdev/mcp-local-rank-map-pack-tracker/badges/score.svg)](https://glama.ai/mcp/servers/mambalabsdev/mcp-local-rank-map-pack-tracker) [![MCP Registry](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fregistry.modelcontextprotocol.io%2Fv0%2Fservers%3Fsearch%3Dcom.mambabuilt%252Fmcp-local-rank-map-pack-tracker%26limit%3D1&query=%24.servers%5B0%5D._meta%5B%22io.modelcontextprotocol.registry%2Fofficial%22%5D.status&label=mcp%20registry&color=blue)](https://registry.modelcontextprotocol.io/v0/servers?search=com.mambabuilt/mcp-local-rank-map-pack-tracker&limit=1) [![npm version](https://img.shields.io/npm/v/@mambalabsdev/mcp-local-rank-map-pack-tracker)](https://www.npmjs.com/package/@mambalabsdev/mcp-local-rank-map-pack-tracker) [![npm downloads](https://img.shields.io/npm/dm/@mambalabsdev/mcp-local-rank-map-pack-tracker)](https://www.npmjs.com/package/@mambalabsdev/mcp-local-rank-map-pack-tracker) [![license](https://img.shields.io/github/license/mambalabsdev/mcp-local-rank-map-pack-tracker)](https://github.com/mambalabsdev/mcp-local-rank-map-pack-tracker/blob/main/LICENSE) [![mcpservers.org](https://img.shields.io/badge/mcpservers.org-listed-blue)](https://mcpservers.org/servers/mambalabsdev/mcp-local-rank-map-pack-tracker)
4
+
5
+ An MCP server for the Mamba Labs Local Rank and Map Pack Tracker actor on Apify. Give it keywords, locations, and a domain or business name. Each run searches Google from each location and returns one row per keyword and location with the organic position, the map pack position, and the local finder position.
6
+
7
+ ## What's Inside
8
+
9
+ - [What it does](#what-it-does)
10
+ - [Quick start](#quick-start)
11
+ - [Prerequisites](#prerequisites)
12
+ - [Example prompts](#example-prompts)
13
+ - [Tool](#tool)
14
+ - [Inputs](#inputs)
15
+ - [Pricing](#pricing)
16
+ - [Your keys](#your-keys)
17
+ - [Full actor documentation](#full-actor-documentation)
18
+ - [License](#license)
19
+
20
+ ## What it does
21
+
22
+ - Each place name is turned into coordinates and the Google search is placed at that point, so a check for Austin returns the Austin map pack.
23
+ - Per row: `organic_position` (up to 50 deep), `local_pack_position` (1 to 3), `local_finder_position` (top 20), and the matched listing's rating, review count, category, phone, website, and address.
24
+ - `top_organic_domains` and `top_local_businesses` name who holds the top spots.
25
+ - With `state_key`, each row carries the previous positions and the change, so a weekly schedule becomes a rank history.
26
+ - An empty position means not found in the positions checked. Blocked rows come back free with a `row_status` saying so.
27
+
28
+ All of the work runs on Apify. This package is a thin client that starts the actor run, waits for it, and hands back the dataset rows.
29
+
30
+ ## Quick start
31
+
32
+ You need Node.js 18 or newer and an Apify account with an API token.
33
+
34
+ Add this to your Claude Desktop config (`claude_desktop_config.json`), Cursor, or any MCP client:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "mamba-local-rank-map-pack-tracker": {
40
+ "command": "npx",
41
+ "args": [
42
+ "-y",
43
+ "@mambalabsdev/mcp-local-rank-map-pack-tracker"
44
+ ],
45
+ "env": {
46
+ "APIFY_TOKEN": "your-apify-token"
47
+ }
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ Restart the client. The `track_local_rankings` tool appears.
54
+
55
+ ## Prerequisites
56
+
57
+ - Node.js 18 or newer.
58
+ - An Apify API token from [console.apify.com/account/integrations](https://console.apify.com/account/integrations), set as `APIFY_TOKEN`. The server lists its tool without a token; a call needs one.
59
+
60
+ ## Example prompts
61
+
62
+ - "Where does weplumbatx.com rank for plumber and emergency plumber in Austin and Round Rock?"
63
+ - "Check the map pack position of We Plumb LLC for drain cleaning in 30.2672,-97.7431."
64
+ - "Track my dental clinic for dentist near me in five London boroughs every week and show what changed."
65
+
66
+ ## Tool
67
+
68
+ `track_local_rankings`. One tool. Example arguments:
69
+
70
+ ```json
71
+ {
72
+ "keywords": ["plumber", "emergency plumber"],
73
+ "locations": ["Austin, Texas, United States", "Round Rock, Texas, United States"],
74
+ "target_domain": "weplumbatx.com",
75
+ "business_name": "We Plumb LLC"
76
+ }
77
+ ```
78
+
79
+ ## Inputs
80
+
81
+ Every buyer facing input of the actor, unchanged. Omitted inputs take the actor's own defaults. Numbers and booleans are sent as strings.
82
+
83
+ | Input | Type | Description |
84
+ |---|---|---|
85
+ | `keywords` | array | Search terms. Required |
86
+ | `locations` | array | Place names or coordinates. Required |
87
+ | `target_domain` | string | Your website. Give it, `business_name`, or both |
88
+ | `business_name` | string | The name on your Google Business Profile |
89
+ | `country` | string | Google market and proxy exit. Default US |
90
+ | `language` | string | Google interface language. Default en |
91
+ | `organic_depth` | string | 10, 20, 30, or 50. Default 10 |
92
+ | `include_local_finder` | string | true or false. Default true |
93
+ | `state_key` | string | Schedule name for change tracking |
94
+ | `max_charge_usd` | string | Optional cost cap for the run |
95
+
96
+ ## Pricing
97
+
98
+ Pay per event on Apify, billed to your Apify account. Prices in USD.
99
+
100
+ | Event | Free plan | Bronze | Silver | Gold |
101
+ |---|---|---|---|---|
102
+ | `rank-check`, one keyword in one location, Google page one included | $0.055 | $0.05225 | $0.0495 | $0.04675 |
103
+ | `extra-page`, organic page 2 and up, or the local finder | $0.0495 | $0.0171 | $0.0162 | $0.0153 |
104
+ | `apify-actor-start`, per run start | $0.002 | $0.002 | $0.002 | $0.002 |
105
+
106
+ Blocked and error rows are free.
107
+
108
+ ## Your keys
109
+
110
+ The actor needs no key. It reads Google result pages through the Apify Google SERP proxy and holds no key of any kind. Mamba Labs pays the platform and proxy costs of the run.
111
+
112
+ ## Full actor documentation
113
+
114
+ [apify.com/mambalabs/local-rank-map-pack-tracker](https://apify.com/mambalabs/local-rank-map-pack-tracker)
115
+
116
+ ## License
117
+
118
+ MIT. See [LICENSE](LICENSE).
package/SECURITY.md ADDED
@@ -0,0 +1,31 @@
1
+ # Security Policy
2
+
3
+ ## Supported versions
4
+
5
+ The latest published `1.x` release of
6
+ `@mambalabsdev/mcp-local-rank-map-pack-tracker` receives security updates.
7
+
8
+ | Version | Supported |
9
+ | ------- | ------------------ |
10
+ | 1.x | :white_check_mark: |
11
+ | < 1.0 | :x: |
12
+
13
+ ## Reporting a vulnerability
14
+
15
+ Please do not open a public GitHub issue for security reports.
16
+
17
+ Email security reports to **labs@mambamindsetgrowth.com** with:
18
+
19
+ - a description of the issue and its impact,
20
+ - steps to reproduce, and
21
+ - any relevant logs or proof of concept.
22
+
23
+ We aim to acknowledge reports within 3 business days and to provide a remediation
24
+ timeline after triage. Coordinated disclosure is appreciated.
25
+
26
+ ## Handling of credentials
27
+
28
+ This server reads an `APIFY_TOKEN` from the environment and uses it only to call
29
+ the Apify API on your behalf. The token is never logged or written to disk by this
30
+ package. Treat your `APIFY_TOKEN` as a secret and rotate it at
31
+ https://console.apify.com/account/integrations if you believe it has been exposed.
package/build/index.js ADDED
@@ -0,0 +1,199 @@
1
+ #!/usr/bin/env node
2
+ import { readFileSync } from "node:fs";
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, join } from "node:path";
5
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
6
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
+ import { z } from "zod";
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+ const pkg = JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8"));
10
+ // Distinctive UA so Apify run meta.userAgent marks MCP-originated runs.
11
+ const USER_AGENT = `mambalabs-mcp ${pkg.name}@${pkg.version}`;
12
+ // Drop undefined values so optional inputs are not sent to the actor.
13
+ function compact(obj) {
14
+ const out = {};
15
+ for (const [k, v] of Object.entries(obj)) {
16
+ if (v !== undefined)
17
+ out[k] = v;
18
+ }
19
+ return out;
20
+ }
21
+ // How long the actor run itself is allowed to take, in seconds: the fleet
22
+ // standard of 1800 s, headroom for a slow day without letting a hung run bill
23
+ // indefinitely.
24
+ const ACTOR_RUN_TIMEOUT_SECS = 1800;
25
+ // How long this wrapper waits for that run, in milliseconds. The actor's own
26
+ // timeout plus two minutes, so the run's own TIMED-OUT status is what the
27
+ // caller sees rather than the wrapper giving up first and reporting nothing.
28
+ const WRAPPER_WAIT_MS = (ACTOR_RUN_TIMEOUT_SECS + 120) * 1000;
29
+ const POLL_INTERVAL_MS = 3000;
30
+ const TERMINAL = new Set(["SUCCEEDED", "FAILED", "TIMED-OUT", "ABORTED", "ABORTING"]);
31
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
32
+ // Shared caller. actorPath is the actor's immutable Apify actor ID (a stable key
33
+ // that survives Store renames). The /v2/acts/{id} endpoint accepts it directly,
34
+ // so a Store rename never breaks these calls.
35
+ //
36
+ // START AND POLL, NOT RUN-SYNC. Apify's synchronous endpoints carry a platform
37
+ // ceiling of 300 seconds on the HTTP wait itself and answer 408 past it whatever
38
+ // the timeout parameter says, so a long run reads as a timeout even though the
39
+ // actor goes on to finish. Starting the run, polling it to a terminal status and
40
+ // then reading the dataset is the only way to wait as long as the actor needs.
41
+ //
42
+ // The token is read here rather than at module load, so the tool registers
43
+ // unconditionally and a server started without APIFY_TOKEN still advertises its
44
+ // capabilities instead of reporting none.
45
+ async function runActor(actorPath, actorLabel, input) {
46
+ const APIFY_TOKEN = process.env.APIFY_TOKEN;
47
+ if (!APIFY_TOKEN) {
48
+ return { isError: true, content: [{ type: "text", text: "APIFY_TOKEN is not set. Create a token at https://console.apify.com/account/integrations and set it as the APIFY_TOKEN environment variable." }] };
49
+ }
50
+ const headers = {
51
+ Authorization: `Bearer ${APIFY_TOKEN}`,
52
+ "Content-Type": "application/json",
53
+ "User-Agent": USER_AGENT,
54
+ };
55
+ const httpError = async (response) => {
56
+ let detail = "";
57
+ try {
58
+ const body = (await response.json());
59
+ if (body?.error?.message)
60
+ detail = ` ${body.error.message}`;
61
+ }
62
+ catch {
63
+ detail = "";
64
+ }
65
+ switch (response.status) {
66
+ case 400:
67
+ return `The ${actorLabel} run was rejected as invalid input.${detail}`;
68
+ case 401:
69
+ return "Invalid Apify token. Check your APIFY_TOKEN environment variable.";
70
+ case 402:
71
+ return "Insufficient Apify credits. Check your account balance at https://console.apify.com/billing";
72
+ default:
73
+ return `Apify request to ${actorLabel} failed with status ${response.status}.${detail}`;
74
+ }
75
+ };
76
+ // 1. Start the run.
77
+ let started;
78
+ try {
79
+ started = await fetch(`https://api.apify.com/v2/acts/${actorPath}/runs?timeout=${ACTOR_RUN_TIMEOUT_SECS}`, { method: "POST", headers, body: JSON.stringify(input) });
80
+ }
81
+ catch (err) {
82
+ const message = err instanceof Error ? err.message : String(err);
83
+ return { isError: true, content: [{ type: "text", text: `Could not reach the Apify API: ${message}` }] };
84
+ }
85
+ if (!started.ok) {
86
+ return { isError: true, content: [{ type: "text", text: await httpError(started) }] };
87
+ }
88
+ let run;
89
+ try {
90
+ run = (await started.json()).data ?? {};
91
+ }
92
+ catch (err) {
93
+ const message = err instanceof Error ? err.message : String(err);
94
+ return { isError: true, content: [{ type: "text", text: `The ${actorLabel} run start returned a response that could not be parsed: ${message}` }] };
95
+ }
96
+ const runId = run.id;
97
+ if (!runId) {
98
+ return { isError: true, content: [{ type: "text", text: `The ${actorLabel} run start returned no run id, so there is nothing to wait for.` }] };
99
+ }
100
+ // 2. Poll to a terminal status.
101
+ const deadline = Date.now() + WRAPPER_WAIT_MS;
102
+ let status = run.status ?? "READY";
103
+ let datasetId = run.defaultDatasetId;
104
+ while (!TERMINAL.has(status)) {
105
+ if (Date.now() >= deadline) {
106
+ return {
107
+ isError: true,
108
+ content: [{ type: "text", text: `The ${actorLabel} run ${runId} was still ${status} after ${Math.round(WRAPPER_WAIT_MS / 1000)} seconds and this call stopped waiting. The run itself is still on Apify: read it at https://console.apify.com/actors/runs/${runId}` }],
109
+ };
110
+ }
111
+ await sleep(POLL_INTERVAL_MS);
112
+ let poll;
113
+ try {
114
+ poll = await fetch(`https://api.apify.com/v2/actor-runs/${runId}`, { headers });
115
+ }
116
+ catch (err) {
117
+ const message = err instanceof Error ? err.message : String(err);
118
+ return { isError: true, content: [{ type: "text", text: `Lost contact with the Apify API while waiting for ${actorLabel} run ${runId}: ${message}` }] };
119
+ }
120
+ if (!poll.ok) {
121
+ return { isError: true, content: [{ type: "text", text: await httpError(poll) }] };
122
+ }
123
+ const body = (await poll.json());
124
+ status = body.data?.status ?? status;
125
+ datasetId = body.data?.defaultDatasetId ?? datasetId;
126
+ }
127
+ // 3. A run that did not succeed is a failure the caller must see, never an
128
+ // empty success. Surfacing it here is what keeps a crashed run from reading
129
+ // as "no results found".
130
+ if (status !== "SUCCEEDED") {
131
+ return {
132
+ isError: true,
133
+ content: [{ type: "text", text: `The ${actorLabel} run did not succeed (run ID: ${runId}, status: ${status}).` }],
134
+ };
135
+ }
136
+ if (!datasetId) {
137
+ return { isError: true, content: [{ type: "text", text: `The ${actorLabel} run ${runId} succeeded but reported no dataset, so there is nothing to return.` }] };
138
+ }
139
+ // 4. Read the dataset.
140
+ let ds;
141
+ try {
142
+ ds = await fetch(`https://api.apify.com/v2/datasets/${datasetId}/items?format=json`, { headers });
143
+ }
144
+ catch (err) {
145
+ const message = err instanceof Error ? err.message : String(err);
146
+ return { isError: true, content: [{ type: "text", text: `Could not read the ${actorLabel} dataset: ${message}` }] };
147
+ }
148
+ if (!ds.ok) {
149
+ return { isError: true, content: [{ type: "text", text: await httpError(ds) }] };
150
+ }
151
+ let items;
152
+ try {
153
+ items = await ds.json();
154
+ }
155
+ catch (err) {
156
+ const message = err instanceof Error ? err.message : String(err);
157
+ return { isError: true, content: [{ type: "text", text: `The ${actorLabel} run returned a response that could not be parsed: ${message}` }] };
158
+ }
159
+ if (!Array.isArray(items)) {
160
+ const asObj = items;
161
+ const detail = asObj?.error?.message
162
+ ? `${asObj.error.message}`
163
+ : JSON.stringify(items);
164
+ return { isError: true, content: [{ type: "text", text: `The ${actorLabel} run did not return a dataset. ${detail}` }] };
165
+ }
166
+ return { content: [{ type: "text", text: JSON.stringify(items, null, 2) }] };
167
+ }
168
+ const server = new McpServer({
169
+ name: "mamba-local-rank-map-pack-tracker",
170
+ version: pkg.version,
171
+ });
172
+ // Local Rank and Map Pack Tracker (immutable actor ID gv0kyHGDIg8XscclB). Every buyer facing input of the actor
173
+ // is exposed. The actor takes numbers and booleans as strings, so those inputs are strings here too.
174
+ const bool = () => z.enum(["true", "false"]).optional();
175
+ server.registerTool("track_local_rankings", {
176
+ title: "Track local rankings",
177
+ description: "Check where a business ranks on Google for each keyword in each location, with the search placed at that location. Give keywords, locations (place names or coordinates), and target_domain and or business_name. One row per keyword and location: organic_position (up to 50 deep), local_pack_position (the 3 result map pack on page one), local_finder_position (top 20 map list), the matched listing's rating, review count, category, phone, and website, the top 10 organic domains and top map listings, and, with state_key, the previous positions and the change. An empty position means not found in the positions checked. Blocked rows come back free with a row_status saying so. A run that does not succeed is returned as an error with its run ID. Read-only; requires an APIFY_TOKEN; Apify charges per rank check and per extra Google page read.",
178
+ annotations: {
179
+ title: "Track local rankings",
180
+ readOnlyHint: true,
181
+ destructiveHint: false,
182
+ idempotentHint: false,
183
+ openWorldHint: true,
184
+ },
185
+ inputSchema: {
186
+ keywords: z.array(z.string()).describe("Search terms to check, for example plumber. Up to 500 keyword and location pairs per run."),
187
+ locations: z.array(z.string()).describe("Where each search is made from: a place name such as Austin, Texas, United States, or coordinates such as 30.2672,-97.7431."),
188
+ target_domain: z.string().optional().describe("Your website, for example weplumbatx.com. Give it, business_name, or both."),
189
+ business_name: z.string().optional().describe("The name on your Google Business Profile, used to find you on the map when your listing shows no website or a different one."),
190
+ country: z.string().optional().describe("Two letter country code for the Google market and proxy exit. Default US."),
191
+ language: z.string().optional().describe("Google interface language. Default en."),
192
+ organic_depth: z.string().optional().describe("Organic positions to check: 10, 20, 30, or 50. Each 10 after the first is one extra page event. Default 10."),
193
+ include_local_finder: bool().describe("Open the full map list (top 20) when you are not in the 3 result map pack; one extra page event. Default true."),
194
+ state_key: z.string().optional().describe("Schedule name. Keeps positions between runs so each row carries the previous positions and the change."),
195
+ max_charge_usd: z.string().optional().describe("Optional. The run stops before any row that would take its charges over this amount."),
196
+ },
197
+ }, async (args) => runActor("gv0kyHGDIg8XscclB", "Local Rank and Map Pack Tracker", compact(args)));
198
+ const transport = new StdioServerTransport();
199
+ await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@mambalabsdev/mcp-local-rank-map-pack-tracker",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "MCP server for Local Rank and Map Pack Tracker. Google organic position, map pack position, and local finder position of a business for each keyword and location, searched from the location itself, with ratings, competitors, and rank change. Runs on Apify. Clay-ready output.",
5
+ "type": "module",
6
+ "bin": {
7
+ "mcp-local-rank-map-pack-tracker": "./build/index.js"
8
+ },
9
+ "files": [
10
+ "build",
11
+ "README.md",
12
+ "LICENSE",
13
+ "SECURITY.md"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc && chmod +x build/index.js",
17
+ "test": "npm run build && node --test test/*.test.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "model-context-protocol",
23
+ "local-seo",
24
+ "rank-tracker",
25
+ "google-maps",
26
+ "map-pack",
27
+ "serp",
28
+ "apify",
29
+ "clay"
30
+ ],
31
+ "author": "Mamba Labs <labs@mambamindsetgrowth.com>",
32
+ "license": "MIT",
33
+ "homepage": "https://apify.com/mambalabs/local-rank-map-pack-tracker",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/mambalabsdev/mcp-local-rank-map-pack-tracker"
37
+ },
38
+ "engines": {
39
+ "node": ">=18"
40
+ },
41
+ "dependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.32.0",
43
+ "zod": "^4.4.3"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^26.2.0",
47
+ "typescript": "5.9.3"
48
+ },
49
+ "mcpName": "com.mambabuilt/mcp-local-rank-map-pack-tracker"
50
+ }