@rankcli/mcp-server 0.0.5 → 0.0.7
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/dist/index.js +22 -33
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -11,6 +11,15 @@ import Conf from "conf";
|
|
|
11
11
|
import { analyzers } from "@rankcli/agent-runtime";
|
|
12
12
|
var SUPABASE_URL = process.env.RANKCLI_SUPABASE_URL || "https://bspljbxwbjiqueeyzyat.supabase.co";
|
|
13
13
|
var localConfig = new Conf({ projectName: "rankcli" });
|
|
14
|
+
async function fetchHtml(url) {
|
|
15
|
+
const res = await fetch(url, {
|
|
16
|
+
headers: { "User-Agent": "RankCLI/1.0 (+https://rankcli.dev)" }
|
|
17
|
+
});
|
|
18
|
+
if (!res.ok) {
|
|
19
|
+
throw new Error(`Fetching ${url} returned ${res.status} ${res.statusText}`);
|
|
20
|
+
}
|
|
21
|
+
return res.text();
|
|
22
|
+
}
|
|
14
23
|
var TOOLS = [
|
|
15
24
|
{
|
|
16
25
|
name: "seo_analyze",
|
|
@@ -309,17 +318,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
309
318
|
try {
|
|
310
319
|
switch (name) {
|
|
311
320
|
case "seo_analyze": {
|
|
312
|
-
const { url, html, robotsTxt } = args;
|
|
313
|
-
|
|
314
|
-
return {
|
|
315
|
-
content: [
|
|
316
|
-
{
|
|
317
|
-
type: "text",
|
|
318
|
-
text: "HTML content is required for analysis. Please provide the HTML of the page."
|
|
319
|
-
}
|
|
320
|
-
]
|
|
321
|
-
};
|
|
322
|
-
}
|
|
321
|
+
const { url, html: providedHtml, robotsTxt } = args;
|
|
322
|
+
const html = providedHtml ?? await fetchHtml(url);
|
|
323
323
|
const result = await analyzers.analyzeComprehensive(html, url, { robotsTxt });
|
|
324
324
|
return {
|
|
325
325
|
content: [
|
|
@@ -331,12 +331,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
331
331
|
};
|
|
332
332
|
}
|
|
333
333
|
case "seo_geo_check": {
|
|
334
|
-
const { url, html, robotsTxt } = args;
|
|
335
|
-
|
|
336
|
-
return {
|
|
337
|
-
content: [{ type: "text", text: "HTML content required for GEO analysis." }]
|
|
338
|
-
};
|
|
339
|
-
}
|
|
334
|
+
const { url, html: providedHtml, robotsTxt } = args;
|
|
335
|
+
const html = providedHtml ?? await fetchHtml(url);
|
|
340
336
|
const result = await analyzers.analyzeGEO(html, url, robotsTxt);
|
|
341
337
|
return {
|
|
342
338
|
content: [{ type: "text", text: formatGEOResult(result) }]
|
|
@@ -525,20 +521,6 @@ async function pollConnectStatus(connectId, timeoutMs) {
|
|
|
525
521
|
}
|
|
526
522
|
return null;
|
|
527
523
|
}
|
|
528
|
-
function backgroundAwaitConnect(connectId) {
|
|
529
|
-
pollConnectStatus(connectId, 5 * 6e4).then(async (claimed) => {
|
|
530
|
-
if (claimed) {
|
|
531
|
-
localConfig.set("apiKey", claimed.apiKey);
|
|
532
|
-
localConfig.set("apiKeyName", claimed.apiKeyName);
|
|
533
|
-
localConfig.set("email", claimed.email);
|
|
534
|
-
if (localConfig.get("pendingConnectId") === connectId) clearPendingConnect();
|
|
535
|
-
}
|
|
536
|
-
await server.createElicitationCompletionNotifier(connectId)().catch(() => {
|
|
537
|
-
});
|
|
538
|
-
}).catch((err) => {
|
|
539
|
-
console.error("rankcli_connect: background poll failed:", err);
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
524
|
function clearPendingConnect() {
|
|
543
525
|
localConfig.delete("pendingConnectId");
|
|
544
526
|
localConfig.delete("pendingConnectUrl");
|
|
@@ -601,8 +583,15 @@ Expires in ${minutesLeft} minute${minutesLeft === 1 ? "" : "s"}.`
|
|
|
601
583
|
elicitationId: connectId
|
|
602
584
|
});
|
|
603
585
|
if (result.action === "accept") {
|
|
604
|
-
|
|
605
|
-
|
|
586
|
+
const claimed = await pollConnectStatus(connectId, 1e4);
|
|
587
|
+
if (claimed) {
|
|
588
|
+
localConfig.set("apiKey", claimed.apiKey);
|
|
589
|
+
localConfig.set("apiKeyName", claimed.apiKeyName);
|
|
590
|
+
localConfig.set("email", claimed.email);
|
|
591
|
+
clearPendingConnect();
|
|
592
|
+
return { text: `Connected as ${claimed.email}! Your dashboard, GitHub auto-fix PRs, and audit history are now linked to this AI assistant.` };
|
|
593
|
+
}
|
|
594
|
+
return { text: `Opened rankcli.dev in your browser. Still waiting for approval - run rankcli_connect again once you've approved it (expires in ${expiresMinutes} minutes).` };
|
|
606
595
|
}
|
|
607
596
|
clearPendingConnect();
|
|
608
597
|
return { text: "Connection cancelled." };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rankcli/mcp-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"mcpName": "io.github.integrallis/rankcli-mcp-server",
|
|
5
5
|
"description": "Free, local SEO + GEO (AI-search-citation) analysis for AI assistants - audits GEO/AI-crawler access, Core Web Vitals, structured data, security headers, mobile, and images with no signup or API key.",
|
|
6
6
|
"type": "module",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
44
|
-
"@rankcli/agent-runtime": "^0.0.
|
|
44
|
+
"@rankcli/agent-runtime": "^0.0.19",
|
|
45
45
|
"conf": "^12.0.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|