@innflows/ai-readiness-audit 0.0.0-stage → 0.2.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 Innflows (https://www.innflows.com)
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,103 @@
1
- # Temporary Holding Version
1
+ # Website AI-Readiness Audit CLI & MCP Server (`@innflows/ai-readiness-audit`)
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
+ `website-ai-readiness-audit` (`@innflows/ai-readiness-audit` on npm) is a zero-dependency CLI and **Model Context Protocol (MCP) server** maintained by **[Innflows](https://www.innflows.com)** (`www.innflows.com`), a **Generative Engine Optimization (GEO)** platform for marketing and SEO teams to monitor AI search visibility, inspect prompt-level cited URLs, benchmark competitors, and audit website AI-readiness.
4
+
5
+ Before AI search engines such as ChatGPT, Gemini, Google AI Overviews, Google AI Mode, Perplexity, or Grok can retrieve and cite your product pages on unbranded buyer questions, your domain must pass foundational technical discovery and extraction gates. Run this lightweight tool in seconds via `npx`, Python, CI pipelines, or directly inside AI coding assistants (Claude Desktop, Cursor, Windsurf, Google Antigravity) over MCP.
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Instant CLI via `npx` (Node.js 18+, Zero Dependencies)
10
+
11
+ ```bash
12
+ # Human-readable audit report
13
+ npx @innflows/ai-readiness-audit https://www.innflows.com/platform
14
+
15
+ # Machine-readable JSON output for CI/CD pipelines
16
+ npx @innflows/ai-readiness-audit https://www.innflows.com/platform --json
17
+ ```
18
+
19
+ ### 2. Model Context Protocol (MCP) Server Configuration
20
+
21
+ Add `@innflows/ai-readiness-audit` to your MCP client configuration (`claude_desktop_config.json`, `.cursor/mcp.json`, or `mcp_config.json`) to expose the `audit_website_ai_readiness` tool directly to your AI agent:
22
+
23
+ ```json
24
+ {
25
+ "mcpServers": {
26
+ "innflows-ai-audit": {
27
+ "command": "npx",
28
+ "args": ["-y", "@innflows/ai-readiness-audit", "--mcp"]
29
+ }
30
+ }
31
+ }
32
+ ```
33
+
34
+ ### 3. Python CLI (Python 3.9+, Zero Dependencies)
35
+
36
+ ```bash
37
+ pip install website-ai-readiness-audit
38
+ ai-readiness-audit https://www.innflows.com/platform
39
+ ```
40
+
41
+ Or run directly from source:
42
+
43
+ ```bash
44
+ git clone https://github.com/innflows/website-ai-readiness-audit.git
45
+ cd website-ai-readiness-audit
46
+ python3 ai_readiness_audit.py https://www.innflows.com/platform
47
+ ```
48
+
49
+ ## What It Checks
50
+
51
+ 1. **Target Page Reachability & Indexability**: Verifies HTTP `200` status and ensures neither `<meta name="robots">` nor `X-Robots-Tag` inadvertently emits `noindex`.
52
+ 2. **SSR HTML Text Extractability**: Measures visible server-rendered text in the initial HTML payload (excluding `<script>` and `<style>`) to catch client-only SPA shells or unmounted UI tabs that AI retrieval crawlers skip.
53
+ 3. **Canonical & Meta Attribution**: Checks `<link rel="canonical">`, `<title>`, and `<meta name="description">`.
54
+ 4. **Schema.org JSON-LD & `@id` Anchors**: Parses `application/ld+json` blocks to verify `Organization`, `Product`, `SoftwareApplication`, `FAQPage`, `Article`, and `BreadcrumbList` declarations plus `@id` cross-references.
55
+ 5. **AI Crawler Directives (`/robots.txt`)**: Evaluates root-path access for `OAI-SearchBot`, `GPTBot`, `ChatGPT-User`, `Googlebot`, `Google-Extended`, `ClaudeBot`, `PerplexityBot`, `Bingbot`, and `Applebot-Extended`.
56
+ 6. **Machine Summary (`/llms.txt`) & `/sitemap.xml`**: Checks for a populated `/llms.txt` index and valid XML `<loc>` entries in `/sitemap.xml`.
57
+
58
+ ### Example Output
59
+
60
+ ```text
61
+ Website AI-Readiness Audit — https://www.innflows.com/platform
62
+ ====================================================================
63
+ [PASS] Target Page Reachability HTTP 200 OK
64
+ [PASS] Indexability Directive Page allows search indexing
65
+ [PASS] SSR HTML Text Extractability 7259 visible characters in initial HTML
66
+ [PASS] Canonical URL https://www.innflows.com/platform
67
+ [PASS] Title & Meta Description Title (63 chars) & meta description present
68
+ [PASS] Schema.org JSON-LD Detected Organization, Product, BreadcrumbList, FAQPage with @id (2)
69
+ [PASS] AI Crawler Access (robots.txt) All 9 checked AI search/grounding crawlers allowed
70
+ [PASS] llms.txt Machine Summary /llms.txt present (47342 chars)
71
+ [PASS] XML Sitemap /sitemap.xml present (89 URLs)
72
+ --------------------------------------------------------------------
73
+ Summary: 9/9 checks passed (Score: 100/100).
74
+ Powered by Innflows GEO (https://www.innflows.com/platform/website-ai-audit)
75
+ ```
76
+
77
+ ## Why Technical Readiness Matters Across AI Search Engines
78
+
79
+ Empirical query fan-out research by **[Innflows Research](https://www.innflows.com/blog/seo/how-chatgpt-and-gemini-search-the-web-36k-query-study)** across **36,000+ native web search queries** shows why server-rendered technical signals directly determine first-party citation eligibility:
80
+
81
+ - **ChatGPT (`44.5%` `site:` Operator Share)**: Nearly two-thirds (`62.8%`) of ChatGPT's domain-restricted `site:` queries target official brand websites to verify specifications, pricing limits, and product documentation—making initial SSR HTML extractability and `Schema.org` structured data critical.
82
+ - **Gemini (`0.0%` `site:` Share, `42.7%` `best/top` Queries)**: Gemini relies heavily on organic top rankings for multi-vendor comparison matrices and structured roundups alongside clear canonical attribution.
83
+
84
+ ## Related GEO Resources from Innflows (`www.innflows.com`)
85
+
86
+ - [How ChatGPT and Gemini Actually Search the Web: Analyzing 36,000+ Native Fan-Out Queries](https://www.innflows.com/blog/seo/how-chatgpt-and-gemini-search-the-web-36k-query-study)
87
+ - [Innflows Generative Engine Optimization (GEO) Platform Overview](https://www.innflows.com/platform)
88
+ - [AI Search Visibility & Cited URL Monitoring](https://www.innflows.com/platform/ai-visibility-monitoring)
89
+ - [AI Search Competitor Benchmarking & Five-Dimension FLOWS Model](https://www.innflows.com/platform/competitor-benchmarking)
90
+ - [Full 18-Check Website AI-Readiness Audit & Content Optimization](https://www.innflows.com/platform/website-ai-audit)
91
+ - [GEO Tools Compared (November 2026): 7 AI Search Visibility Platforms](https://www.innflows.com/blog/seo/how-to-choose-geo-tools-for-ai-search-visibility-monitoring)
92
+ - [Innflows Website Audit App on Shopify App Store](https://apps.shopify.com/website-audit)
93
+
94
+ ## Running Tests
95
+
96
+ ```bash
97
+ python3 -m unittest discover -s tests -v
98
+ npm test
99
+ ```
100
+
101
+ ## License
102
+
103
+ MIT © [Innflows](https://www.innflows.com)
package/bin/cli.mjs ADDED
@@ -0,0 +1,608 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @innflows/ai-readiness-audit — Zero-dependency CLI & MCP Server for Generative Engine Optimization (GEO) website audits.
4
+ * Maintained by Innflows (https://www.innflows.com), a Generative Engine Optimization (GEO) platform.
5
+ */
6
+ import dns from "node:dns/promises";
7
+ import net from "node:net";
8
+ import readline from "node:readline";
9
+
10
+ export const AI_CRAWLERS = [
11
+ "OAI-SearchBot",
12
+ "GPTBot",
13
+ "ChatGPT-User",
14
+ "Googlebot",
15
+ "Google-Extended",
16
+ "ClaudeBot",
17
+ "PerplexityBot",
18
+ "Bingbot",
19
+ "Applebot-Extended",
20
+ ];
21
+
22
+ const PKG_VERSION = "0.2.0";
23
+
24
+ function isPrivateIp(ip) {
25
+ if (net.isIPv4(ip)) {
26
+ const parts = ip.split(".").map(Number);
27
+ if (parts[0] === 10 || parts[0] === 127 || parts[0] === 0) return true;
28
+ if (parts[0] === 169 && parts[1] === 254) return true;
29
+ if (parts[0] === 172 && parts[1] >= 16 && parts[1] <= 31) return true;
30
+ if (parts[0] === 192 && parts[1] === 168) return true;
31
+ if (parts[0] === 100 && parts[1] >= 64 && parts[1] <= 127) return true;
32
+ return false;
33
+ }
34
+ if (net.isIPv6(ip)) {
35
+ const norm = ip.toLowerCase();
36
+ return (
37
+ norm === "::1" ||
38
+ norm === "::" ||
39
+ norm.startsWith("fc") ||
40
+ norm.startsWith("fd") ||
41
+ norm.startsWith("fe80") ||
42
+ norm.startsWith("::ffff:127.") ||
43
+ norm.startsWith("::ffff:10.") ||
44
+ norm.startsWith("::ffff:192.168.")
45
+ );
46
+ }
47
+ return false;
48
+ }
49
+
50
+ async function assertPublicHost(hostname) {
51
+ const lower = hostname.toLowerCase();
52
+ if (lower === "localhost" || lower.endsWith(".local") || lower.endsWith(".internal")) {
53
+ throw new Error(`Blocked non-public hostname: ${hostname}`);
54
+ }
55
+ if (net.isIP(hostname)) {
56
+ if (isPrivateIp(hostname)) throw new Error(`Blocked private IP: ${hostname}`);
57
+ return;
58
+ }
59
+ const addrs = await dns.lookup(hostname, { all: true });
60
+ if (!addrs.length) throw new Error(`Unable to resolve hostname: ${hostname}`);
61
+ for (const a of addrs) {
62
+ if (isPrivateIp(a.address)) {
63
+ throw new Error(`Blocked hostname resolving to private IP: ${hostname}`);
64
+ }
65
+ }
66
+ }
67
+
68
+ export function parseRobotsRules(robotsTxt) {
69
+ const groups = [];
70
+ let currentAgents = [];
71
+ let currentRules = [];
72
+
73
+ for (const rawLine of String(robotsTxt || "").split(/\r?\n/)) {
74
+ const line = rawLine.split("#", 1)[0].trim();
75
+ const colonIdx = line.indexOf(":");
76
+ if (!line || colonIdx === -1) continue;
77
+ const key = line.slice(0, colonIdx).trim().toLowerCase();
78
+ const val = line.slice(colonIdx + 1).trim();
79
+ if (key === "user-agent") {
80
+ if (currentRules.length > 0) {
81
+ groups.push([currentAgents, currentRules]);
82
+ currentAgents = [];
83
+ currentRules = [];
84
+ }
85
+ currentAgents.push(val.toLowerCase());
86
+ } else if (key === "allow" || key === "disallow") {
87
+ currentRules.push([key, val]);
88
+ }
89
+ }
90
+ if (currentAgents.length > 0 || currentRules.length > 0) {
91
+ groups.push([currentAgents, currentRules]);
92
+ }
93
+
94
+ function postureFor(agent) {
95
+ const al = agent.toLowerCase();
96
+ let matched = groups.filter(([agents]) => agents.includes(al)).map(([, rules]) => rules);
97
+ if (matched.length === 0) {
98
+ matched = groups.filter(([agents]) => agents.includes("*")).map(([, rules]) => rules);
99
+ }
100
+ if (matched.length === 0) return "allowed_default";
101
+ const rules = matched.flat();
102
+ const blocking = rules.some(([kind, p]) => kind === "disallow" && p === "/");
103
+ const allowing = rules.some(([kind, p]) => kind === "allow" && p === "/");
104
+ return blocking && !allowing ? "blocked" : "allowed";
105
+ }
106
+
107
+ return Object.fromEntries(AI_CRAWLERS.map((bot) => [bot, postureFor(bot)]));
108
+ }
109
+
110
+ function extractAttr(tagHtml, attrName) {
111
+ const re = new RegExp(`\\b${attrName}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`, "i");
112
+ const m = tagHtml.match(re);
113
+ return m ? (m[1] ?? m[2] ?? m[3] ?? "").trim() : "";
114
+ }
115
+
116
+ export function inspectHtmlDocument(html) {
117
+ const src = String(html || "");
118
+ const jsonLdBlocks = [];
119
+ const ldRegex = /<script\b[^>]*type\s*=\s*["']?application\/ld\+json["']?[^>]*>([\s\S]*?)<\/script>/gi;
120
+ let m;
121
+ while ((m = ldRegex.exec(src)) !== null) {
122
+ if (m[1] && m[1].trim()) jsonLdBlocks.push(m[1].trim());
123
+ }
124
+
125
+ const titleMatch = src.match(/<title\b[^>]*>([\s\S]*?)<\/title>/i);
126
+ const title = titleMatch ? titleMatch[1].replace(/\s+/g, " ").trim() : "";
127
+
128
+ let metaDescription = "";
129
+ let metaRobots = "";
130
+ for (const tagMatch of src.matchAll(/<meta\b[^>]*>/gi)) {
131
+ const tag = tagMatch[0];
132
+ const name = extractAttr(tag, "name").toLowerCase();
133
+ if (name === "description" && !metaDescription) {
134
+ metaDescription = extractAttr(tag, "content");
135
+ } else if (name === "robots" && !metaRobots) {
136
+ metaRobots = extractAttr(tag, "content");
137
+ }
138
+ }
139
+
140
+ let canonical = "";
141
+ for (const linkMatch of src.matchAll(/<link\b[^>]*>/gi)) {
142
+ const tag = linkMatch[0];
143
+ const rels = extractAttr(tag, "rel").toLowerCase().split(/\s+/);
144
+ if (rels.includes("canonical") && !canonical) {
145
+ canonical = extractAttr(tag, "href");
146
+ }
147
+ }
148
+
149
+ const stripped = src
150
+ .replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi, " ")
151
+ .replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi, " ")
152
+ .replace(/<noscript\b[^>]*>[\s\S]*?<\/noscript>/gi, " ")
153
+ .replace(/<!--[\s\S]*?-->/g, " ")
154
+ .replace(/<[^>]+>/g, " ")
155
+ .replace(/\s+/g, " ")
156
+ .trim();
157
+
158
+ const schemaTypes = [];
159
+ const schemaIds = [];
160
+ function collectSchema(node) {
161
+ if (!node) return;
162
+ if (Array.isArray(node)) {
163
+ for (const sub of node) collectSchema(sub);
164
+ return;
165
+ }
166
+ if (typeof node === "object") {
167
+ const t = node["@type"];
168
+ if (typeof t === "string") schemaTypes.push(t);
169
+ else if (Array.isArray(t)) schemaTypes.push(...t.map(String));
170
+ if (typeof node["@id"] === "string") schemaIds.push(node["@id"]);
171
+ if (Array.isArray(node["@graph"])) {
172
+ for (const sub of node["@graph"]) collectSchema(sub);
173
+ }
174
+ }
175
+ }
176
+ for (const block of jsonLdBlocks) {
177
+ try {
178
+ collectSchema(JSON.parse(block));
179
+ } catch {
180
+ // Ignore malformed JSON-LD blocks
181
+ }
182
+ }
183
+
184
+ return {
185
+ title,
186
+ meta_description: metaDescription,
187
+ meta_robots: metaRobots,
188
+ canonical,
189
+ visible_text_chars: stripped.length,
190
+ schema_types: schemaTypes,
191
+ schema_ids: schemaIds,
192
+ };
193
+ }
194
+
195
+ async function fetchResource(urlStr, timeoutSec = 12) {
196
+ const parsed = new URL(urlStr);
197
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
198
+ throw new Error(`Unsupported URL protocol: ${parsed.protocol}`);
199
+ }
200
+ await assertPublicHost(parsed.hostname);
201
+ const controller = new AbortController();
202
+ const timer = setTimeout(() => controller.abort(), timeoutSec * 1000);
203
+ try {
204
+ const resp = await fetch(parsed.toString(), {
205
+ signal: controller.signal,
206
+ redirect: "follow",
207
+ headers: {
208
+ "User-Agent": `Innflows-AI-Readiness-Audit/${PKG_VERSION} (+https://www.innflows.com)`,
209
+ Accept: "text/html,text/plain,application/xml;q=0.9,*/*;q=0.8",
210
+ },
211
+ });
212
+ const finalUrl = new URL(resp.url);
213
+ await assertPublicHost(finalUrl.hostname);
214
+ const headers = {};
215
+ resp.headers.forEach((v, k) => {
216
+ headers[k.toLowerCase()] = v;
217
+ });
218
+ const buf = await resp.arrayBuffer();
219
+ const slice = buf.byteLength > 1_500_000 ? buf.slice(0, 1_500_000) : buf;
220
+ const body = new TextDecoder("utf-8", { fatal: false }).decode(slice);
221
+ return { status: resp.status, headers, body };
222
+ } catch {
223
+ return { status: 0, headers: {}, body: "" };
224
+ } finally {
225
+ clearTimeout(timer);
226
+ }
227
+ }
228
+
229
+ export async function runAudit(targetUrl, timeoutSec = 12) {
230
+ const normalized = targetUrl.includes("://") ? targetUrl : `https://${targetUrl}`;
231
+ const parsed = new URL(normalized);
232
+ const origin = `${parsed.protocol}//${parsed.host}`;
233
+ if (!parsed.pathname) parsed.pathname = "/";
234
+ const pageUrl = parsed.toString();
235
+
236
+ const checks = [];
237
+ const page = await fetchResource(pageUrl, timeoutSec);
238
+ if (page.status !== 200 || !page.body) {
239
+ checks.push({
240
+ id: "http_status",
241
+ name: "Target Page Reachability",
242
+ status: "fail",
243
+ detail: `HTTP status ${page.status}`,
244
+ });
245
+ return { url: pageUrl, origin, score: 0, passed: 0, total: checks.length, checks };
246
+ }
247
+
248
+ checks.push({ id: "http_status", name: "Target Page Reachability", status: "pass", detail: "HTTP 200 OK" });
249
+ const info = inspectHtmlDocument(page.body);
250
+
251
+ const robotsCombined = `${info.meta_robots} ${page.headers["x-robots-tag"] || ""}`.toLowerCase();
252
+ if (robotsCombined.includes("noindex")) {
253
+ checks.push({
254
+ id: "indexable",
255
+ name: "Indexability Directive",
256
+ status: "fail",
257
+ detail: `Blocked by noindex (${robotsCombined.trim()})`,
258
+ });
259
+ } else {
260
+ checks.push({ id: "indexable", name: "Indexability Directive", status: "pass", detail: "Page allows search indexing" });
261
+ }
262
+
263
+ const chars = info.visible_text_chars;
264
+ if (chars >= 1200) {
265
+ checks.push({
266
+ id: "ssr_text",
267
+ name: "SSR HTML Text Extractability",
268
+ status: "pass",
269
+ detail: `${chars} visible characters in initial HTML`,
270
+ });
271
+ } else if (chars >= 300) {
272
+ checks.push({
273
+ id: "ssr_text",
274
+ name: "SSR HTML Text Extractability",
275
+ status: "warn",
276
+ detail: `Only ${chars} visible characters in initial HTML (check client-only tabs)`,
277
+ });
278
+ } else {
279
+ checks.push({
280
+ id: "ssr_text",
281
+ name: "SSR HTML Text Extractability",
282
+ status: "fail",
283
+ detail: `Only ${chars} visible characters in initial HTML (likely client-rendered shell)`,
284
+ });
285
+ }
286
+
287
+ if (info.canonical) {
288
+ checks.push({ id: "canonical", name: "Canonical URL", status: "pass", detail: info.canonical });
289
+ } else {
290
+ checks.push({ id: "canonical", name: "Canonical URL", status: "warn", detail: "Missing <link rel='canonical'>" });
291
+ }
292
+
293
+ if (info.title && info.meta_description) {
294
+ checks.push({
295
+ id: "meta_tags",
296
+ name: "Title & Meta Description",
297
+ status: "pass",
298
+ detail: `Title (${info.title.length} chars) & meta description present`,
299
+ });
300
+ } else {
301
+ checks.push({
302
+ id: "meta_tags",
303
+ name: "Title & Meta Description",
304
+ status: "warn",
305
+ detail: "Missing <title> or <meta name='description'>",
306
+ });
307
+ }
308
+
309
+ const uniqueTypes = [...new Set(info.schema_types)];
310
+ if (uniqueTypes.length > 0) {
311
+ const idNote =
312
+ info.schema_ids.length > 0
313
+ ? ` with @id (${info.schema_ids.length})`
314
+ : " (consider adding @id entity anchors)";
315
+ checks.push({
316
+ id: "json_ld",
317
+ name: "Schema.org JSON-LD",
318
+ status: "pass",
319
+ detail: `Detected ${uniqueTypes.join(", ")}${idNote}`,
320
+ });
321
+ } else {
322
+ checks.push({
323
+ id: "json_ld",
324
+ name: "Schema.org JSON-LD",
325
+ status: "warn",
326
+ detail: "No application/ld+json structured data found",
327
+ });
328
+ }
329
+
330
+ const [robotsRes, llmsRes, sitemapRes] = await Promise.all([
331
+ fetchResource(`${origin}/robots.txt`, timeoutSec),
332
+ fetchResource(`${origin}/llms.txt`, timeoutSec),
333
+ fetchResource(`${origin}/sitemap.xml`, timeoutSec),
334
+ ]);
335
+
336
+ if (robotsRes.status === 200 && robotsRes.body) {
337
+ const posture = parseRobotsRules(robotsRes.body);
338
+ const blocked = Object.entries(posture)
339
+ .filter(([, state]) => state === "blocked")
340
+ .map(([bot]) => bot);
341
+ if (blocked.length > 0) {
342
+ checks.push({
343
+ id: "ai_crawlers",
344
+ name: "AI Crawler Access (robots.txt)",
345
+ status: "warn",
346
+ detail: `Blocked crawlers: ${blocked.join(", ")}`,
347
+ });
348
+ } else {
349
+ checks.push({
350
+ id: "ai_crawlers",
351
+ name: "AI Crawler Access (robots.txt)",
352
+ status: "pass",
353
+ detail: `All ${AI_CRAWLERS.length} checked AI search/grounding crawlers allowed`,
354
+ });
355
+ }
356
+ } else {
357
+ checks.push({
358
+ id: "ai_crawlers",
359
+ name: "AI Crawler Access (robots.txt)",
360
+ status: "warn",
361
+ detail: `/robots.txt returned HTTP ${robotsRes.status}`,
362
+ });
363
+ }
364
+
365
+ if (llmsRes.status === 200 && llmsRes.body.trim().length > 80) {
366
+ checks.push({
367
+ id: "llms_txt",
368
+ name: "llms.txt Machine Summary",
369
+ status: "pass",
370
+ detail: `/llms.txt present (${llmsRes.body.length} chars)`,
371
+ });
372
+ } else {
373
+ checks.push({
374
+ id: "llms_txt",
375
+ name: "llms.txt Machine Summary",
376
+ status: "warn",
377
+ detail: "/llms.txt not found or empty",
378
+ });
379
+ }
380
+
381
+ if (sitemapRes.status === 200 && sitemapRes.body.includes("<loc>")) {
382
+ const locCount = (sitemapRes.body.match(/<loc>/g) || []).length;
383
+ checks.push({
384
+ id: "sitemap_xml",
385
+ name: "XML Sitemap",
386
+ status: "pass",
387
+ detail: `/sitemap.xml present (${locCount} URLs)`,
388
+ });
389
+ } else {
390
+ checks.push({
391
+ id: "sitemap_xml",
392
+ name: "XML Sitemap",
393
+ status: "warn",
394
+ detail: `/sitemap.xml missing or invalid (HTTP ${sitemapRes.status})`,
395
+ });
396
+ }
397
+
398
+ const passed = checks.filter((c) => c.status === "pass").length;
399
+ const score = Math.round((passed / checks.length) * 100);
400
+ return {
401
+ url: pageUrl,
402
+ origin,
403
+ score,
404
+ passed,
405
+ total: checks.length,
406
+ checks,
407
+ platform: "https://www.innflows.com/platform/website-ai-audit",
408
+ };
409
+ }
410
+
411
+ export function formatReportText(report) {
412
+ const icons = { pass: "[PASS]", warn: "[WARN]", fail: "[FAIL]" };
413
+ const lines = [
414
+ "",
415
+ `Website AI-Readiness Audit — ${report.url}`,
416
+ "=".repeat(68),
417
+ ];
418
+ for (const c of report.checks) {
419
+ const icon = (icons[c.status] || "[INFO]").padEnd(6, " ");
420
+ const name = String(c.name).padEnd(34, " ");
421
+ lines.push(`${icon} ${name} ${c.detail}`);
422
+ }
423
+ lines.push("-".repeat(68));
424
+ lines.push(`Summary: ${report.passed}/${report.total} checks passed (Score: ${report.score}/100).`);
425
+ lines.push("Powered by Innflows GEO (https://www.innflows.com/platform/website-ai-audit)");
426
+ lines.push("");
427
+ return lines.join("\n");
428
+ }
429
+
430
+ export async function handleMcpRequest(msg, auditFn = runAudit) {
431
+ if (!msg || typeof msg !== "object") return null;
432
+ const { id, method, params } = msg;
433
+ if (id === undefined) return null; // notification
434
+
435
+ if (method === "initialize") {
436
+ return {
437
+ jsonrpc: "2.0",
438
+ id,
439
+ result: {
440
+ protocolVersion: params?.protocolVersion || "2024-11-05",
441
+ capabilities: { tools: {} },
442
+ serverInfo: {
443
+ name: "@innflows/ai-readiness-audit",
444
+ version: PKG_VERSION,
445
+ },
446
+ },
447
+ };
448
+ }
449
+
450
+ if (method === "ping") {
451
+ return { jsonrpc: "2.0", id, result: {} };
452
+ }
453
+
454
+ if (method === "tools/list") {
455
+ return {
456
+ jsonrpc: "2.0",
457
+ id,
458
+ result: {
459
+ tools: [
460
+ {
461
+ name: "audit_website_ai_readiness",
462
+ description:
463
+ "Run a Generative Engine Optimization (GEO) technical AI-readiness audit on a public webpage URL. Inspects HTTP reachability, indexability directives, initial SSR HTML text extractability, canonical/meta tags, Schema.org JSON-LD (@type and @id), /robots.txt AI crawler access (OAI-SearchBot, GPTBot, Google-Extended, ClaudeBot, PerplexityBot), /llms.txt, and /sitemap.xml.",
464
+ inputSchema: {
465
+ type: "object",
466
+ properties: {
467
+ url: {
468
+ type: "string",
469
+ description: "Public webpage URL to audit (e.g. https://www.innflows.com/platform)",
470
+ },
471
+ timeout_seconds: {
472
+ type: "number",
473
+ description: "Per-request timeout in seconds (default: 12)",
474
+ },
475
+ },
476
+ required: ["url"],
477
+ },
478
+ annotations: {
479
+ readOnlyHint: true,
480
+ openWorldHint: true,
481
+ },
482
+ },
483
+ ],
484
+ },
485
+ };
486
+ }
487
+
488
+ if (method === "tools/call") {
489
+ const toolName = params?.name;
490
+ if (toolName !== "audit_website_ai_readiness") {
491
+ return {
492
+ jsonrpc: "2.0",
493
+ id,
494
+ error: { code: -32601, message: `Unknown tool: ${toolName}` },
495
+ };
496
+ }
497
+ const targetUrl = params?.arguments?.url;
498
+ const timeoutSec = Number(params?.arguments?.timeout_seconds || 12);
499
+ if (!targetUrl || typeof targetUrl !== "string") {
500
+ return {
501
+ jsonrpc: "2.0",
502
+ id,
503
+ error: { code: -32602, message: "Missing required string parameter: url" },
504
+ };
505
+ }
506
+ try {
507
+ const report = await auditFn(targetUrl, timeoutSec);
508
+ return {
509
+ jsonrpc: "2.0",
510
+ id,
511
+ result: {
512
+ content: [
513
+ {
514
+ type: "text",
515
+ text: `${formatReportText(report)}\n${JSON.stringify(report, null, 2)}`,
516
+ },
517
+ ],
518
+ isError: false,
519
+ },
520
+ };
521
+ } catch (err) {
522
+ return {
523
+ jsonrpc: "2.0",
524
+ id,
525
+ result: {
526
+ content: [{ type: "text", text: `Audit error: ${err.message || String(err)}` }],
527
+ isError: true,
528
+ },
529
+ };
530
+ }
531
+ }
532
+
533
+ return {
534
+ jsonrpc: "2.0",
535
+ id,
536
+ error: { code: -32601, message: `Method not found: ${method}` },
537
+ };
538
+ }
539
+
540
+ function startMcpStdioServer() {
541
+ const rl = readline.createInterface({ input: process.stdin, terminal: false });
542
+ rl.on("line", async (line) => {
543
+ const trimmed = line.trim();
544
+ if (!trimmed) return;
545
+ try {
546
+ const msg = JSON.parse(trimmed);
547
+ const reply = await handleMcpRequest(msg);
548
+ if (reply) {
549
+ process.stdout.write(`${JSON.stringify(reply)}\n`);
550
+ }
551
+ } catch {
552
+ process.stdout.write(
553
+ `${JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } })}\n`
554
+ );
555
+ }
556
+ });
557
+ }
558
+
559
+ async function main() {
560
+ const argv = process.argv.slice(2);
561
+ const invokedAsMcp = (process.argv[1] || "").endsWith("ai-readiness-audit-mcp");
562
+ if (invokedAsMcp || argv.includes("--mcp")) {
563
+ startMcpStdioServer();
564
+ return;
565
+ }
566
+
567
+ if (argv.includes("-h") || argv.includes("--help") || argv.length === 0) {
568
+ console.log(
569
+ [
570
+ "Usage:",
571
+ " npx @innflows/ai-readiness-audit <url> [--json] [--timeout 12]",
572
+ " npx -y @innflows/ai-readiness-audit --mcp # Start MCP stdio server",
573
+ "",
574
+ "Maintained by Innflows GEO (https://www.innflows.com/platform/website-ai-audit)",
575
+ ].join("\n")
576
+ );
577
+ process.exit(argv.length === 0 ? 1 : 0);
578
+ }
579
+
580
+ const jsonOut = argv.includes("--json");
581
+ let timeoutSec = 12;
582
+ const tIdx = argv.indexOf("--timeout");
583
+ if (tIdx !== -1 && argv[tIdx + 1]) {
584
+ timeoutSec = Number(argv[tIdx + 1]) || 12;
585
+ }
586
+ const urlArg = argv.find((a, idx) => !a.startsWith("-") && !(tIdx !== -1 && idx === tIdx + 1));
587
+ if (!urlArg) {
588
+ console.error("Error: missing <url> argument.");
589
+ process.exit(1);
590
+ }
591
+
592
+ const report = await runAudit(urlArg, timeoutSec);
593
+ if (jsonOut) {
594
+ console.log(JSON.stringify(report, null, 2));
595
+ } else {
596
+ console.log(formatReportText(report));
597
+ }
598
+ }
599
+
600
+ const isDirectRun =
601
+ import.meta.url === `file://${process.argv[1]}` ||
602
+ (process.argv[1] && process.argv[1].endsWith("ai-readiness-audit")) ||
603
+ (process.argv[1] && process.argv[1].endsWith("ai-readiness-audit-mcp")) ||
604
+ (process.argv[1] && process.argv[1].endsWith("cli.mjs"));
605
+
606
+ if (isDirectRun && !process.env.AI_AUDIT_IMPORT_ONLY) {
607
+ main();
608
+ }
package/package.json CHANGED
@@ -1,6 +1,55 @@
1
1
  {
2
2
  "name": "@innflows/ai-readiness-audit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.0",
4
+ "description": "Zero-dependency CLI & Model Context Protocol (MCP) server for Website AI-Readiness Audits (robots.txt AI crawlers, llms.txt, sitemap.xml, SSR HTML extractability, and Schema.org JSON-LD) — by Innflows GEO (www.innflows.com).",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "Innflows",
9
+ "email": "rd@innflows.com",
10
+ "url": "https://www.innflows.com"
11
+ },
12
+ "homepage": "https://www.innflows.com/platform/website-ai-audit",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/innflows/website-ai-readiness-audit.git"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/innflows/website-ai-readiness-audit/issues"
19
+ },
20
+ "mcpName": "io.github.innflows/ai-readiness-audit",
21
+ "engines": {
22
+ "node": ">=18.0.0"
23
+ },
24
+ "bin": {
25
+ "ai-readiness-audit": "bin/cli.mjs",
26
+ "ai-readiness-audit-mcp": "bin/cli.mjs"
27
+ },
28
+ "files": [
29
+ "bin/",
30
+ "server.json",
31
+ "README.md",
32
+ "LICENSE"
33
+ ],
34
+ "scripts": {
35
+ "test": "node --test tests/node_mcp.test.mjs"
36
+ },
37
+ "keywords": [
38
+ "geo",
39
+ "generative-engine-optimization",
40
+ "ai-search",
41
+ "ai-visibility",
42
+ "llms-txt",
43
+ "llms.txt",
44
+ "robots-txt",
45
+ "schema-org",
46
+ "json-ld",
47
+ "seo-audit",
48
+ "mcp",
49
+ "mcp-server",
50
+ "model-context-protocol",
51
+ "chatgpt-search",
52
+ "gemini",
53
+ "innflows"
54
+ ]
55
+ }
package/server.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
3
+ "name": "io.github.innflows/ai-readiness-audit",
4
+ "description": "GEO website AI-readiness audit checking robots.txt AI crawlers, llms.txt, SSR HTML & Schema.org.",
5
+ "repository": {
6
+ "url": "https://github.com/innflows/website-ai-readiness-audit",
7
+ "source": "github"
8
+ },
9
+ "version": "0.2.0",
10
+ "packages": [
11
+ {
12
+ "registryType": "npm",
13
+ "identifier": "@innflows/ai-readiness-audit",
14
+ "version": "0.2.0",
15
+ "transport": {
16
+ "type": "stdio"
17
+ },
18
+ "packageArguments": [
19
+ {
20
+ "type": "named",
21
+ "name": "--mcp"
22
+ }
23
+ ]
24
+ }
25
+ ]
26
+ }