seo360-mcp 0.0.0-stage → 1.0.1

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.
Files changed (3) hide show
  1. package/README.md +46 -3
  2. package/index.js +288 -0
  3. package/package.json +27 -3
package/README.md CHANGED
@@ -1,3 +1,46 @@
1
- # Temporary Holding Version
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.
1
+ # SEO360 MCP Server
2
+
3
+ SEO360 MCP: Import extension presets, customize parameters, and call DataForSEO APIs with zero hallucination.
4
+
5
+ Built as the official Model Context Protocol (MCP) bridge for the **[SEO360 Chrome Extension](https://chromewebstore.google.com/detail/seo360-dataforseo-free-no/mpphhakiifalmlkphalklimjfkhkpbmp)**. Visually configure DataForSEO API requests in your browser with **SEO360**, export them as JSON presets, and let AI agents (Claude Desktop, Cursor, Cherry Studio, Windsurf, Cline) import, customize, and execute live SEO data workflows.
6
+
7
+ ## ✨ Key Features
8
+
9
+ - **Visual-to-AI Workflow**: Build complex DataForSEO payloads visually using the [SEO360 Chrome Extension](https://chromewebstore.google.com/detail/seo360-dataforseo-free-no/mpphhakiifalmlkphalklimjfkhkpbmp) and drop the exported JSON file directly into your AI chat.
10
+ - **Auto-Enriched Parameter Docs**: Automatically fetches live parameter definitions and constraints from the SEO360 schema dictionary.
11
+ - **Isolated Multi-Preset Memory**: Import single or multi-endpoint preset bundles and manage multiple SEO tasks simultaneously without parameter collisions.
12
+ - **Strict Type Preservation**: Preserves exact JSON data types (strings, numbers, booleans, arrays, and nested objects) when modifying parameters.
13
+ - **Zero-Hallucination Execution**: Connects directly to the official DataForSEO v3 API using your local credentials and exact validated payloads.
14
+
15
+ ## šŸš€ Quick Start
16
+
17
+ Add the following configuration to your MCP client (Claude Desktop, Cursor, Cherry Studio, etc.):
18
+
19
+ ```json
20
+ {
21
+ "mcpServers": {
22
+ "seo360-mcp": {
23
+ "command": "npx",
24
+ "args": ["-y", "seo360-mcp"],
25
+ "env": {
26
+ "DATAFORSEO_LOGIN": "your_dataforseo_email",
27
+ "DATAFORSEO_PASSWORD": "your_dataforseo_api_password"
28
+ }
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ## šŸ› ļø Available Tools
35
+
36
+ 1. `import_seo360_preset` — Import a JSON preset array (or uploaded `.json` file) exported from SEO360 and inspect parameter descriptions.
37
+ 2. `update_seo360_preset` — Modify or add parameters for a specific imported task while keeping other tasks isolated.
38
+ 3. `list_seo360_presets` — View all active tasks and their current parameter states in memory.
39
+ 4. `execute_seo360_preset` — Execute a saved task directly against the live DataForSEO API.
40
+
41
+ ## šŸ’” Example Workflow
42
+
43
+ 1. Install the free **[SEO360 Chrome Extension](https://chromewebstore.google.com/detail/seo360-dataforseo-free-no/mpphhakiifalmlkphalklimjfkhkpbmp)** — **no DataForSEO account or API key is required** to visually configure endpoints and export JSON presets.
44
+ 2. Drag and drop the exported `.json` file into your AI chat: *"Import this SEO360 preset file."*
45
+ 3. Review the parameter explanations and customize: *"Update `keyword` to `best ai tools` and `depth` to `10`, then execute it."*
46
+ 4. Connect your DataForSEO API credentials in the MCP config to run live requests and let the AI analyze the results.
package/index.js ADDED
@@ -0,0 +1,288 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { z } from "zod";
5
+
6
+ const server = new McpServer({
7
+ name: "seo360-mcp",
8
+ version: "1.0.1",
9
+ });
10
+
11
+ const PARAMS_DOC_URL = "https://seo360.pages.dev/dataforseo/params.json";
12
+ const EXTENSION_STORE_URL = "https://chromewebstore.google.com/detail/seo360-dataforseo-free-no/mpphhakiifalmlkphalklimjfkhkpbmp";
13
+
14
+ // Isolated in-memory store for imported SEO360 presets (keyed by unique task name)
15
+ const presetStore = new Map();
16
+
17
+ // Cached parameter dictionary fetched from Cloudflare
18
+ let cachedParamsDict = null;
19
+
20
+ // Fetch and cache the parameter dictionary from Cloudflare
21
+ async function getParamsDictionary() {
22
+ if (cachedParamsDict) return cachedParamsDict;
23
+ try {
24
+ const res = await fetch(PARAMS_DOC_URL);
25
+ if (res.ok) {
26
+ cachedParamsDict = await res.json();
27
+ return cachedParamsDict;
28
+ }
29
+ } catch (e) {
30
+ // Ignore network errors and fall back to schema-less mode
31
+ }
32
+ return {};
33
+ }
34
+
35
+ // Strip HTML tags (e.g., <code>2840</code> -> `2840`)
36
+ function cleanHtml(str) {
37
+ if (!str) return "";
38
+ return String(str).replace(/<\/?code>/g, "`").replace(/<[^>]+>/g, "");
39
+ }
40
+
41
+ // Convert SEO360 2D array payload [["key", value], ...] into a plain object while preserving exact data types
42
+ function payloadPairsToObject(payloadPairs) {
43
+ const obj = {};
44
+ if (!Array.isArray(payloadPairs)) return obj;
45
+ for (const pair of payloadPairs) {
46
+ if (Array.isArray(pair) && pair.length >= 2) {
47
+ const [key, val] = pair;
48
+ obj[key] = val;
49
+ }
50
+ }
51
+ return obj;
52
+ }
53
+
54
+ // Convert internal parameter object into the standard DataForSEO API task array [{ ... }]
55
+ function buildDataForSeoRequestBody(paramsObj) {
56
+ const task = {};
57
+ for (const [key, val] of Object.entries(paramsObj)) {
58
+ // Parse JSON string defaults for filters / stop_crawl_on_match if needed, keep all other types strictly as-is
59
+ if (typeof val === "string" && (key === "filters" || key === "stop_crawl_on_match")) {
60
+ try {
61
+ task[key] = JSON.parse(val);
62
+ } catch {
63
+ task[key] = val;
64
+ }
65
+ } else {
66
+ task[key] = val;
67
+ }
68
+ }
69
+ return [task];
70
+ }
71
+
72
+ // Format parameters alongside descriptions from the Cloudflare parameter dictionary
73
+ async function formatParamsWithDescriptions(paramsObj) {
74
+ const dict = await getParamsDictionary();
75
+ const lines = [];
76
+ for (const [key, val] of Object.entries(paramsObj)) {
77
+ const displayVal = JSON.stringify(val);
78
+ const doc = dict[key]?.description ? ` — ${cleanHtml(dict[key].description)}` : "";
79
+ lines.push(`- **${key}**: \`${displayVal}\`${doc}`);
80
+ }
81
+ return lines.join("\n");
82
+ }
83
+
84
+ // Tool 1: Import SEO360 presets (supports single-endpoint or multi-endpoint JSON arrays)
85
+ server.tool(
86
+ "import_seo360_preset",
87
+ `Import an SEO360 JSON preset exported from the SEO360 Chrome Extension (supports single or multi-endpoint JSON arrays). Automatically enriches parameters with official descriptions from the SEO360 schema dictionary, lists all configurable parameters, and asks the user which fields they want to modify. NOTE: If the user does not have an SEO360 preset or asks how to get one, provide this official Chrome Web Store link (${EXTENSION_STORE_URL}) and emphasize that NO DataForSEO account or API key is required to use the extension to browse endpoints, customize parameters, and export JSON presets (an API key is only needed later when executing live API calls via MCP).`,
88
+ {
89
+ preset_json: z.string().describe("The raw JSON array string exported from the SEO360 Chrome Extension"),
90
+ prefix: z.string().optional().describe("Optional prefix to namespace imported tasks and avoid naming collisions with existing presets"),
91
+ },
92
+ async ({ preset_json, prefix }) => {
93
+ try {
94
+ const items = JSON.parse(preset_json);
95
+ if (!Array.isArray(items) || items.length === 0) {
96
+ return {
97
+ isError: true,
98
+ content: [
99
+ {
100
+ type: "text",
101
+ text: `Invalid format: SEO360 preset must be a non-empty JSON array. You can visually build, customize, and export valid presets for free using the SEO360 Chrome Extension (no DataForSEO account or API key required): ${EXTENSION_STORE_URL}`,
102
+ },
103
+ ],
104
+ };
105
+ }
106
+
107
+ const importedDetails = [];
108
+
109
+ for (let i = 0; i < items.length; i++) {
110
+ const item = items[i];
111
+ if (!item.api || !item.payload) continue;
112
+
113
+ const baseName = item.note ? item.note.trim() : `${item.api}_${i + 1}`;
114
+ const taskName = prefix ? `[${prefix}] ${baseName}` : baseName;
115
+ const paramsObj = payloadPairsToObject(item.payload);
116
+
117
+ presetStore.set(taskName, {
118
+ api: item.api.replace(/^\/+/, ""),
119
+ note: baseName,
120
+ params: paramsObj,
121
+ });
122
+
123
+ const formattedParams = await formatParamsWithDescriptions(paramsObj);
124
+ importedDetails.push(`### šŸ“¦ Task Name: 怐${taskName}怑\n- **Endpoint**: \`${item.api}\`\n- **Current Parameters & Descriptions**:\n${formattedParams}`);
125
+ }
126
+
127
+ return {
128
+ content: [
129
+ {
130
+ type: "text",
131
+ text: `āœ… Successfully imported ${importedDetails.length} SEO360 preset task(s)! Total active tasks in memory: ${presetStore.size}.\n\n${importedDetails.join("\n\n---\n\n")}\n\nPresent these parameters clearly to the user and ask which task and parameters they would like to modify before execution.`,
132
+ },
133
+ ],
134
+ };
135
+ } catch (err) {
136
+ return {
137
+ isError: true,
138
+ content: [
139
+ {
140
+ type: "text",
141
+ text: `Failed to parse JSON: ${err.message}\n\nNeed a valid preset? Build, customize, and export one visually with the free SEO360 Chrome Extension (no DataForSEO API key required): ${EXTENSION_STORE_URL}`,
142
+ },
143
+ ],
144
+ };
145
+ }
146
+ }
147
+ );
148
+
149
+ // Tool 2: Update any parameters of a specific imported preset task (persists in memory)
150
+ server.tool(
151
+ "update_seo360_preset",
152
+ "Update or add parameters for a specific imported SEO360 preset task. Strictly preserves the exact JSON data types provided (string, number, boolean, array, or object). Changes persist in memory for the current session without affecting other tasks.",
153
+ {
154
+ task_name: z.string().describe("The exact task name of the imported SEO360 preset to update"),
155
+ updates_json: z.string().describe('A JSON object of key-value pairs to update, e.g., {"keyword": "best laptops", "location_code": 2826, "depth": 20}'),
156
+ },
157
+ async ({ task_name, updates_json }) => {
158
+ const target = presetStore.get(task_name);
159
+ if (!target) {
160
+ return {
161
+ isError: true,
162
+ content: [
163
+ {
164
+ type: "text",
165
+ text: `Task 怐${task_name}怑 not found.\nCurrently loaded tasks:\n${Array.from(presetStore.keys()).map((k) => `- ${k}`).join("\n") || "(None)"}`,
166
+ },
167
+ ],
168
+ };
169
+ }
170
+
171
+ try {
172
+ const updates = JSON.parse(updates_json);
173
+ for (const [key, newVal] of Object.entries(updates)) {
174
+ target.params[key] = newVal;
175
+ }
176
+
177
+ const formattedParams = await formatParamsWithDescriptions(target.params);
178
+ return {
179
+ content: [
180
+ {
181
+ type: "text",
182
+ text: `āœ… Parameters for task 怐${task_name}怑 have been updated and saved!\n\nUpdated Parameter State:\n${formattedParams}`,
183
+ },
184
+ ],
185
+ };
186
+ } catch (err) {
187
+ return {
188
+ isError: true,
189
+ content: [{ type: "text", text: `Failed to update parameters: ${err.message}` }],
190
+ };
191
+ }
192
+ }
193
+ );
194
+
195
+ // Tool 3: List all currently loaded preset tasks and their parameter states
196
+ server.tool(
197
+ "list_seo360_presets",
198
+ `List all currently loaded SEO360 preset tasks in memory along with their endpoints and latest parameter configurations. If no presets are loaded, guide the user to install the free SEO360 Chrome Extension (${EXTENSION_STORE_URL}) and clearly note that NO DataForSEO account or API key is needed in the extension to configure parameters and export JSON presets (an API key is only required later when executing live requests).`,
199
+ {},
200
+ async () => {
201
+ if (presetStore.size === 0) {
202
+ return {
203
+ content: [
204
+ {
205
+ type: "text",
206
+ text: `No SEO360 presets have been imported yet.\n\nTo get started, install the free SEO360 Chrome Extension to visually configure DataForSEO endpoints, customize parameters, and export a JSON preset (no DataForSEO account or API key required to configure and export):\nšŸ‘‰ ${EXTENSION_STORE_URL}`,
207
+ },
208
+ ],
209
+ };
210
+ }
211
+ const list = [];
212
+ for (const [name, data] of presetStore.entries()) {
213
+ list.push({
214
+ task_name: name,
215
+ api: data.api,
216
+ current_params: data.params,
217
+ });
218
+ }
219
+ return {
220
+ content: [{ type: "text", text: JSON.stringify(list, null, 2) }],
221
+ };
222
+ }
223
+ );
224
+
225
+ // Tool 4: Execute a specific preset task against the live DataForSEO API
226
+ server.tool(
227
+ "execute_seo360_preset",
228
+ `Execute a specific SEO360 preset task against the live DataForSEO API using its latest saved parameters and return real-time results. If no preset has been imported yet, ask the user to import one or install the free SEO360 Chrome Extension (${EXTENSION_STORE_URL}) to configure and export presets (no API key required in the extension).`,
229
+ {
230
+ task_name: z.string().describe("The exact task name of the SEO360 preset to execute"),
231
+ },
232
+ async ({ task_name }) => {
233
+ const target = presetStore.get(task_name);
234
+ if (!target) {
235
+ return {
236
+ isError: true,
237
+ content: [
238
+ {
239
+ type: "text",
240
+ text: `Task 怐${task_name}怑 not found.\nCurrently loaded tasks:\n${Array.from(presetStore.keys()).map((k) => `- ${k}`).join("\n") || `(None — configure & export a preset for free with the SEO360 Chrome Extension, no API key required: ${EXTENSION_STORE_URL})`}`,
241
+ },
242
+ ],
243
+ };
244
+ }
245
+
246
+ const login = process.env.DATAFORSEO_LOGIN;
247
+ const password = process.env.DATAFORSEO_PASSWORD;
248
+ if (!login || !password) {
249
+ return {
250
+ isError: true,
251
+ content: [{ type: "text", text: "Missing DATAFORSEO_LOGIN or DATAFORSEO_PASSWORD environment variables. Please configure them in your MCP server settings." }],
252
+ };
253
+ }
254
+
255
+ const url = `https://api.dataforseo.com/v3/${target.api}`;
256
+ const requestBody = buildDataForSeoRequestBody(target.params);
257
+ const auth = Buffer.from(`${login}:${password}`).toString("base64");
258
+
259
+ try {
260
+ const response = await fetch(url, {
261
+ method: "POST",
262
+ headers: {
263
+ Authorization: `Basic ${auth}`,
264
+ "Content-Type": "application/json",
265
+ },
266
+ body: JSON.stringify(requestBody),
267
+ });
268
+
269
+ const resultData = await response.json();
270
+ return {
271
+ content: [
272
+ {
273
+ type: "text",
274
+ text: `šŸš€ Task 怐${task_name}怑 executed successfully!\n- **Endpoint**: \`${url}\`\n- **Payload Sent**: \`${JSON.stringify(requestBody)}\`\n\n### API Response:\n${JSON.stringify(resultData, null, 2)}`,
275
+ },
276
+ ],
277
+ };
278
+ } catch (err) {
279
+ return {
280
+ isError: true,
281
+ content: [{ type: "text", text: `DataForSEO API request failed: ${err.message}` }],
282
+ };
283
+ }
284
+ }
285
+ );
286
+
287
+ const transport = new StdioServerTransport();
288
+ await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,30 @@
1
1
  {
2
2
  "name": "seo360-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.1",
4
+ "description": "SEO360 MCP: Import extension presets, customize parameters, and call DataForSEO APIs with zero hallucination.",
5
+ "homepage": "https://seo360.pages.dev",
6
+ "type": "module",
7
+ "main": "index.js",
8
+ "bin": {
9
+ "seo360-mcp": "index.js"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "README.md"
14
+ ],
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "dataforseo",
19
+ "seo",
20
+ "seo360",
21
+ "claude",
22
+ "cursor",
23
+ "cherry-studio"
24
+ ],
25
+ "license": "MIT",
26
+ "dependencies": {
27
+ "@modelcontextprotocol/sdk": "^1.0.0",
28
+ "zod": "^3.23.0"
29
+ }
6
30
  }