seo360-mcp 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/README.md +46 -3
- package/index.js +288 -0
- package/package.json +27 -4
package/README.md
CHANGED
|
@@ -1,3 +1,46 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
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)** and export your configured endpoints as a JSON preset.
|
|
44
|
+
2. Drag and drop the `.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. Ask the AI to analyze the live SERP/keyword data and generate an SEO-optimized article in one continuous workflow.
|
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.0",
|
|
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 so they can install the free visual builder and export presets: ${EXTENSION_STORE_URL}`,
|
|
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 and export valid presets using the free SEO360 Chrome Extension: ${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 and export one visually with the free SEO360 Chrome Extension: ${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 export one from the SEO360 Chrome Extension (${EXTENSION_STORE_URL}).`,
|
|
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 and export a JSON preset:\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 SEO360 Chrome Extension (${EXTENSION_STORE_URL}) to create one.`,
|
|
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 ā export a preset from SEO360 Chrome Extension: ${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,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seo360-mcp",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SEO360 MCP: Import SEO360 extension presets, customize parameters, and run DataForSEO APIs with zero hallucination.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"seo360-mcp": "index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"dataforseo",
|
|
18
|
+
"seo",
|
|
19
|
+
"seo360",
|
|
20
|
+
"claude",
|
|
21
|
+
"cursor",
|
|
22
|
+
"cherry-studio"
|
|
23
|
+
],
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
27
|
+
"zod": "^3.23.0"
|
|
28
|
+
}
|
|
29
|
+
}
|