@automatelab/citation-intelligence 0.5.1 → 0.7.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 +74 -8
- package/dist/adapters/anthropic.d.ts.map +1 -1
- package/dist/adapters/anthropic.js +4 -2
- package/dist/adapters/anthropic.js.map +1 -1
- package/dist/adapters/bing.js +1 -1
- package/dist/adapters/bing.js.map +1 -1
- package/dist/adapters/brave.js +1 -1
- package/dist/adapters/brave.js.map +1 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +5 -1
- package/dist/adapters/gemini.js.map +1 -1
- package/dist/adapters/google-ai-mode.d.ts +6 -0
- package/dist/adapters/google-ai-mode.d.ts.map +1 -0
- package/dist/adapters/google-ai-mode.js +48 -0
- package/dist/adapters/google-ai-mode.js.map +1 -0
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +3 -1
- package/dist/adapters/openai.js.map +1 -1
- package/dist/adapters/perplexity.d.ts +2 -1
- package/dist/adapters/perplexity.d.ts.map +1 -1
- package/dist/adapters/perplexity.js +5 -2
- package/dist/adapters/perplexity.js.map +1 -1
- package/dist/index.js +50 -2
- package/dist/index.js.map +1 -1
- package/dist/prompts.d.ts +3 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +137 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resources.d.ts +3 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +242 -0
- package/dist/resources.js.map +1 -0
- package/dist/tools/am-i-cited.d.ts +73 -10
- package/dist/tools/am-i-cited.d.ts.map +1 -1
- package/dist/tools/am-i-cited.js +115 -15
- package/dist/tools/am-i-cited.js.map +1 -1
- package/dist/tools/answer-box-position.d.ts +4 -4
- package/dist/tools/answer-box-position.js +2 -2
- package/dist/tools/answer-box-position.js.map +1 -1
- package/dist/tools/canonical-competitor-set.d.ts +73 -0
- package/dist/tools/canonical-competitor-set.d.ts.map +1 -0
- package/dist/tools/canonical-competitor-set.js +208 -0
- package/dist/tools/canonical-competitor-set.js.map +1 -0
- package/dist/tools/check-citations.d.ts +11 -5
- package/dist/tools/check-citations.d.ts.map +1 -1
- package/dist/tools/check-citations.js +41 -8
- package/dist/tools/check-citations.js.map +1 -1
- package/dist/tools/citation-evidence.d.ts +54 -0
- package/dist/tools/citation-evidence.d.ts.map +1 -0
- package/dist/tools/citation-evidence.js +148 -0
- package/dist/tools/citation-evidence.js.map +1 -0
- package/dist/tools/citation-freshness-score.d.ts +4 -4
- package/dist/tools/citation-freshness-score.js +1 -1
- package/dist/tools/citation-freshness-score.js.map +1 -1
- package/dist/tools/citation-provenance.d.ts +6 -4
- package/dist/tools/citation-provenance.d.ts.map +1 -1
- package/dist/tools/citation-provenance.js +17 -8
- package/dist/tools/citation-provenance.js.map +1 -1
- package/dist/tools/cited-for-diff.d.ts +5 -5
- package/dist/tools/cited-for-diff.js +1 -1
- package/dist/tools/cited-for-diff.js.map +1 -1
- package/dist/tools/cited-for.d.ts +5 -5
- package/dist/tools/cited-for.js +1 -1
- package/dist/tools/cited-for.js.map +1 -1
- package/dist/tools/compete-for-query.d.ts +4 -4
- package/dist/tools/compete-for-query.js +1 -1
- package/dist/tools/compete-for-query.js.map +1 -1
- package/dist/tools/crawler-access-audit.d.ts +49 -0
- package/dist/tools/crawler-access-audit.d.ts.map +1 -0
- package/dist/tools/crawler-access-audit.js +256 -0
- package/dist/tools/crawler-access-audit.js.map +1 -0
- package/dist/tools/gsc-citation-gap.d.ts +5 -5
- package/dist/tools/gsc-citation-gap.d.ts.map +1 -1
- package/dist/tools/gsc-citation-gap.js +7 -2
- package/dist/tools/gsc-citation-gap.js.map +1 -1
- package/dist/tools/run-panel.d.ts +5 -5
- package/dist/tools/run-panel.d.ts.map +1 -1
- package/dist/tools/run-panel.js +13 -4
- package/dist/tools/run-panel.js.map +1 -1
- package/dist/tools/sitemap-citation-map.d.ts +77 -0
- package/dist/tools/sitemap-citation-map.d.ts.map +1 -0
- package/dist/tools/sitemap-citation-map.js +149 -0
- package/dist/tools/sitemap-citation-map.js.map +1 -0
- package/dist/tools/structured-data-repair.d.ts +30 -0
- package/dist/tools/structured-data-repair.d.ts.map +1 -0
- package/dist/tools/structured-data-repair.js +297 -0
- package/dist/tools/structured-data-repair.js.map +1 -0
- package/dist/types.d.ts +11 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +24 -1
- package/dist/types.js.map +1 -1
- package/package.json +59 -57
- package/smithery.yaml +50 -0
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Prompt templates exposed via MCP. Each prompt returns one or more user
|
|
2
|
+
// messages that guide the calling LLM to run a coherent sequence of this
|
|
3
|
+
// server's tools - so a client doesn't have to know which tools to chain.
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
function userMessage(text) {
|
|
6
|
+
return { role: "user", content: { type: "text", text } };
|
|
7
|
+
}
|
|
8
|
+
export function registerPrompts(server) {
|
|
9
|
+
server.registerPrompt("audit_citation_readiness", {
|
|
10
|
+
title: "Audit citation readiness",
|
|
11
|
+
description: "Score a URL's citation likelihood across public signals, then deep-validate its schema.org markup, then list the top fixes. Uses predict_citation + schema_audit.",
|
|
12
|
+
argsSchema: {
|
|
13
|
+
url: z.string().describe("The page URL to audit."),
|
|
14
|
+
},
|
|
15
|
+
}, ({ url }) => ({
|
|
16
|
+
description: `Citation readiness audit for ${url}`,
|
|
17
|
+
messages: [
|
|
18
|
+
userMessage([
|
|
19
|
+
`Audit the citation readiness of ${url}.`,
|
|
20
|
+
``,
|
|
21
|
+
`1. Call predict_citation with url="${url}" to get the public-signal score, grade, and ranked fixes.`,
|
|
22
|
+
`2. Call schema_audit with url="${url}" to deep-validate any JSON-LD / microdata and surface missing required fields.`,
|
|
23
|
+
`3. Summarize the result as:`,
|
|
24
|
+
` - one-sentence verdict`,
|
|
25
|
+
` - top 3 fixes (by impact)`,
|
|
26
|
+
` - quick-wins (anything cheap that lifts score by >=5)`,
|
|
27
|
+
``,
|
|
28
|
+
`Do not call any other tools. Do not invent fixes that predict_citation didn't surface.`,
|
|
29
|
+
].join("\n")),
|
|
30
|
+
],
|
|
31
|
+
}));
|
|
32
|
+
server.registerPrompt("competitor_snapshot", {
|
|
33
|
+
title: "Competitor citation snapshot",
|
|
34
|
+
description: "Build a cross-engine competitor map for a query and compare your own URL to the top-cited competitors. Uses canonical_competitor_set + compete_for_query.",
|
|
35
|
+
argsSchema: {
|
|
36
|
+
query: z.string().describe("The search query to analyze."),
|
|
37
|
+
your_url: z
|
|
38
|
+
.string()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe("Your URL to benchmark against the competitor set. Optional."),
|
|
41
|
+
},
|
|
42
|
+
}, ({ query, your_url }) => ({
|
|
43
|
+
description: `Competitor snapshot for "${query}"`,
|
|
44
|
+
messages: [
|
|
45
|
+
userMessage([
|
|
46
|
+
`Build a competitor citation snapshot for the query: "${query}".`,
|
|
47
|
+
``,
|
|
48
|
+
`1. Call canonical_competitor_set with query="${query}" to get the top cited domains across engines (sorted by cross-engine consensus).`,
|
|
49
|
+
your_url
|
|
50
|
+
? `2. Call compete_for_query with query="${query}" and your_url="${your_url}" to score your URL against the top competitors.`
|
|
51
|
+
: `2. (Skipped - no your_url provided.) If you want a head-to-head score, ask the user for the URL to benchmark.`,
|
|
52
|
+
`3. Report:`,
|
|
53
|
+
` - 3-5 sentence narrative: who dominates this query, how much consensus, where the gaps are`,
|
|
54
|
+
` - top 5 competitor domains with engine_count + sample URLs`,
|
|
55
|
+
your_url
|
|
56
|
+
? ` - your URL's score vs the competitor average, and the largest signal gap`
|
|
57
|
+
: ` - n/a (no your_url)`,
|
|
58
|
+
``,
|
|
59
|
+
`Do not call check_citations directly - the two tools above already fan out.`,
|
|
60
|
+
].join("\n")),
|
|
61
|
+
],
|
|
62
|
+
}));
|
|
63
|
+
server.registerPrompt("ai_crawler_checkup", {
|
|
64
|
+
title: "AI crawler access checkup",
|
|
65
|
+
description: "Verify that all major AI crawlers (GPTBot, ClaudeBot, PerplexityBot, CCBot, Google-Extended, etc.) can fetch a URL and aren't being blocked at robots.txt or the server. Uses crawler_access_audit.",
|
|
66
|
+
argsSchema: {
|
|
67
|
+
url: z.string().describe("The page URL to check crawler access for."),
|
|
68
|
+
},
|
|
69
|
+
}, ({ url }) => ({
|
|
70
|
+
description: `AI crawler access check for ${url}`,
|
|
71
|
+
messages: [
|
|
72
|
+
userMessage([
|
|
73
|
+
`Check whether AI crawlers can fetch ${url}.`,
|
|
74
|
+
``,
|
|
75
|
+
`1. Call crawler_access_audit with url="${url}" (default bot list, fetch_with_ua=true).`,
|
|
76
|
+
`2. Report:`,
|
|
77
|
+
` - which bots are 'allowed' vs 'blocked'`,
|
|
78
|
+
` - any robots.txt rules that block citation-relevant bots`,
|
|
79
|
+
` - any UA-based gating (allowed in robots, but the server 4xx/5xx'd under the bot's UA)`,
|
|
80
|
+
` - one concrete action item per blocked bot (e.g. "remove Disallow: / for GPTBot from robots.txt")`,
|
|
81
|
+
``,
|
|
82
|
+
`If any consumer-facing AI engine bot (GPTBot, OAI-SearchBot, ClaudeBot, PerplexityBot) is blocked, surface it as a citation-blocking risk.`,
|
|
83
|
+
].join("\n")),
|
|
84
|
+
],
|
|
85
|
+
}));
|
|
86
|
+
server.registerPrompt("citation_gap_analysis", {
|
|
87
|
+
title: "Find queries with high Google rank but no AI citation",
|
|
88
|
+
description: "Surface queries where a domain ranks well on Google but isn't cited by AI engines - the closest editorial wins. Uses gsc_citation_gap.",
|
|
89
|
+
argsSchema: {
|
|
90
|
+
domain: z.string().describe("Your domain, e.g. 'automatelab.tech'."),
|
|
91
|
+
days: z
|
|
92
|
+
.string()
|
|
93
|
+
.optional()
|
|
94
|
+
.describe("Window in days for GSC data (default: 28)."),
|
|
95
|
+
},
|
|
96
|
+
}, ({ domain, days }) => ({
|
|
97
|
+
description: `Citation gap analysis for ${domain}`,
|
|
98
|
+
messages: [
|
|
99
|
+
userMessage([
|
|
100
|
+
`Find queries where ${domain} ranks well on Google but isn't cited by AI.`,
|
|
101
|
+
``,
|
|
102
|
+
`1. Call gsc_citation_gap with domain="${domain}"${days ? ` and days=${days}` : ""}.`,
|
|
103
|
+
`2. Report the top 10 gap queries (rank <=10 on Google AND not cited by AI), with:`,
|
|
104
|
+
` - the query`,
|
|
105
|
+
` - Google rank + impressions`,
|
|
106
|
+
` - the AI engine that should have cited it but didn't`,
|
|
107
|
+
`3. For the top 3, suggest the page-level fix most likely to flip the AI citation (refer to predict_citation signals).`,
|
|
108
|
+
``,
|
|
109
|
+
`These are the highest-leverage editorial targets: traffic interest already proven, citation just missing.`,
|
|
110
|
+
].join("\n")),
|
|
111
|
+
],
|
|
112
|
+
}));
|
|
113
|
+
server.registerPrompt("sitemap_coverage_review", {
|
|
114
|
+
title: "Sitemap citation coverage review",
|
|
115
|
+
description: "Map a sitemap against the citation cache to see which URLs have been cited and which haven't. Identifies systemic visibility gaps. Uses sitemap_citation_map.",
|
|
116
|
+
argsSchema: {
|
|
117
|
+
sitemap_url: z.string().describe("Sitemap URL (sitemap.xml or sitemap index)."),
|
|
118
|
+
},
|
|
119
|
+
}, ({ sitemap_url }) => ({
|
|
120
|
+
description: `Sitemap citation coverage for ${sitemap_url}`,
|
|
121
|
+
messages: [
|
|
122
|
+
userMessage([
|
|
123
|
+
`Review citation coverage across the sitemap at ${sitemap_url}.`,
|
|
124
|
+
``,
|
|
125
|
+
`1. Call sitemap_citation_map with sitemap_url="${sitemap_url}".`,
|
|
126
|
+
`2. Report:`,
|
|
127
|
+
` - coverage_pct (mapped/total)`,
|
|
128
|
+
` - top 5 most-cited URLs (by engine_count + citation_count)`,
|
|
129
|
+
` - top 10 unmapped URLs that look high-value (judge by URL slug)`,
|
|
130
|
+
`3. Recommend 3 unmapped URLs to prioritize for citation-readiness audits next.`,
|
|
131
|
+
``,
|
|
132
|
+
`Cache must be primed first - if citations_in_cache is 0, tell the user to run check_citations or run_panel for representative queries before re-running this.`,
|
|
133
|
+
].join("\n")),
|
|
134
|
+
],
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,yEAAyE;AACzE,0EAA0E;AAE1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,SAAS,WAAW,CAAC,IAAY;IAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC/C,MAAM,CAAC,cAAc,CACnB,0BAA0B,EAC1B;QACE,KAAK,EAAE,0BAA0B;QACjC,WAAW,EACT,mKAAmK;QACrK,UAAU,EAAE;YACV,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;SACnD;KACF,EACD,CAAC,EAAE,GAAG,EAAE,EAAmB,EAAE,CAAC,CAAC;QAC7B,WAAW,EAAE,gCAAgC,GAAG,EAAE;QAClD,QAAQ,EAAE;YACR,WAAW,CACT;gBACE,mCAAmC,GAAG,GAAG;gBACzC,EAAE;gBACF,sCAAsC,GAAG,4DAA4D;gBACrG,kCAAkC,GAAG,iFAAiF;gBACtH,6BAA6B;gBAC7B,2BAA2B;gBAC3B,8BAA8B;gBAC9B,0DAA0D;gBAC1D,EAAE;gBACF,wFAAwF;aACzF,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,cAAc,CACnB,qBAAqB,EACrB;QACE,KAAK,EAAE,8BAA8B;QACrC,WAAW,EACT,2JAA2J;QAC7J,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ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E;gBACF,+JAA+J;aAChK,CAAC,IAAI,CAAC,IAAI,CAAC,CACb;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAKA,OAAO,EAEL,KAAK,SAAS,EACf,MAAM,yCAAyC,CAAC;AA2MjD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAiGzD"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
// MCP resources surfaced by this server. Each resource returns cache state
|
|
2
|
+
// the client can read or subscribe to without firing tool calls.
|
|
3
|
+
import { readFile, readdir, stat } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { ResourceTemplate, } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
|
+
import { CONFIG_DIR, CACHE_FILE } from "./lib/config.js";
|
|
7
|
+
import { citedForDomain } from "./lib/cache.js";
|
|
8
|
+
function asJson(uri, value) {
|
|
9
|
+
return {
|
|
10
|
+
contents: [
|
|
11
|
+
{
|
|
12
|
+
uri,
|
|
13
|
+
mimeType: "application/json",
|
|
14
|
+
text: JSON.stringify(value, null, 2),
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
async function loadCacheSummary() {
|
|
20
|
+
let size = 0;
|
|
21
|
+
let exists = false;
|
|
22
|
+
try {
|
|
23
|
+
const s = await stat(CACHE_FILE);
|
|
24
|
+
size = s.size;
|
|
25
|
+
exists = true;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// missing cache file - return empty summary
|
|
29
|
+
}
|
|
30
|
+
let entries = [];
|
|
31
|
+
if (exists) {
|
|
32
|
+
try {
|
|
33
|
+
const raw = await readFile(CACHE_FILE, "utf8");
|
|
34
|
+
const parsed = JSON.parse(raw);
|
|
35
|
+
entries = parsed.entries ?? [];
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// ignore corrupt cache
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const byType = {};
|
|
42
|
+
const byEngine = {};
|
|
43
|
+
const queries = new Set();
|
|
44
|
+
const urls = new Set();
|
|
45
|
+
let oldest = null;
|
|
46
|
+
let newest = null;
|
|
47
|
+
for (const e of entries) {
|
|
48
|
+
if (e.type)
|
|
49
|
+
byType[e.type] = (byType[e.type] ?? 0) + 1;
|
|
50
|
+
if (e.engine)
|
|
51
|
+
byEngine[e.engine] = (byEngine[e.engine] ?? 0) + 1;
|
|
52
|
+
if (e.query)
|
|
53
|
+
queries.add(e.query.toLowerCase());
|
|
54
|
+
for (const c of e.citations ?? [])
|
|
55
|
+
if (c.url)
|
|
56
|
+
urls.add(c.url);
|
|
57
|
+
for (const c of e.sources ?? [])
|
|
58
|
+
if (c.url)
|
|
59
|
+
urls.add(c.url);
|
|
60
|
+
if (e.fetched_at) {
|
|
61
|
+
if (!oldest || e.fetched_at < oldest)
|
|
62
|
+
oldest = e.fetched_at;
|
|
63
|
+
if (!newest || e.fetched_at > newest)
|
|
64
|
+
newest = e.fetched_at;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
cache_file: CACHE_FILE,
|
|
69
|
+
exists,
|
|
70
|
+
size_bytes: size,
|
|
71
|
+
entries_total: entries.length,
|
|
72
|
+
by_type: byType,
|
|
73
|
+
by_engine: byEngine,
|
|
74
|
+
unique_queries: queries.size,
|
|
75
|
+
unique_urls: urls.size,
|
|
76
|
+
oldest_fetched_at: oldest,
|
|
77
|
+
newest_fetched_at: newest,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async function loadPanelsList() {
|
|
81
|
+
const panelDir = join(CONFIG_DIR, "panels");
|
|
82
|
+
const snapshotDir = join(CONFIG_DIR, "snapshots");
|
|
83
|
+
const panels = [];
|
|
84
|
+
try {
|
|
85
|
+
const files = await readdir(panelDir);
|
|
86
|
+
for (const f of files.filter((f) => f.endsWith(".json"))) {
|
|
87
|
+
const name = f.slice(0, -5);
|
|
88
|
+
try {
|
|
89
|
+
const raw = await readFile(join(panelDir, f), "utf8");
|
|
90
|
+
const p = JSON.parse(raw);
|
|
91
|
+
panels.push({
|
|
92
|
+
name,
|
|
93
|
+
queries: p.queries?.length ?? 0,
|
|
94
|
+
domain: p.domain,
|
|
95
|
+
updated_at: p.updated_at,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
panels.push({ name, queries: 0 });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
// panels dir doesn't exist yet
|
|
105
|
+
}
|
|
106
|
+
const snapshotsByPanel = {};
|
|
107
|
+
try {
|
|
108
|
+
const panelDirs = await readdir(snapshotDir);
|
|
109
|
+
for (const p of panelDirs) {
|
|
110
|
+
try {
|
|
111
|
+
const files = await readdir(join(snapshotDir, p));
|
|
112
|
+
snapshotsByPanel[p] = files.filter((f) => f.endsWith(".json")).length;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
// skip
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
// snapshots dir doesn't exist yet
|
|
121
|
+
}
|
|
122
|
+
return {
|
|
123
|
+
config_dir: CONFIG_DIR,
|
|
124
|
+
panels,
|
|
125
|
+
snapshots_by_panel: snapshotsByPanel,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
const LLMS_TXT_PRIMER = [
|
|
129
|
+
"# llms.txt — what it is",
|
|
130
|
+
"",
|
|
131
|
+
"Proposed by llmstxt.org. A markdown file at /llms.txt that orients LLM",
|
|
132
|
+
"crawlers to your site: H1 title, short blurb, then sectioned link lists.",
|
|
133
|
+
"Distinct from robots.txt (gates) and sitemap.xml (URL enumeration) - it",
|
|
134
|
+
"tells the model *what's important*, not just *what exists*.",
|
|
135
|
+
"",
|
|
136
|
+
"## Mainstream signal status",
|
|
137
|
+
"",
|
|
138
|
+
"- OpenAI, Anthropic, Perplexity: no public statement of consumption.",
|
|
139
|
+
"- Adopters use it as a documentation / discoverability nudge.",
|
|
140
|
+
"- Generally harmless to ship; benefit > zero, cost ~ zero.",
|
|
141
|
+
"",
|
|
142
|
+
"## How this server helps",
|
|
143
|
+
"",
|
|
144
|
+
"- `llms_txt_generator` builds a draft from your sitemap.",
|
|
145
|
+
"- `audit_sitemap` ranks pages by citation-readiness before you include them.",
|
|
146
|
+
"- `predict_citation` scores any URL on the public signals (llms.txt is one).",
|
|
147
|
+
"",
|
|
148
|
+
"## Spec",
|
|
149
|
+
"",
|
|
150
|
+
"https://llmstxt.org",
|
|
151
|
+
].join("\n");
|
|
152
|
+
const CRAWLERS_PRIMER = [
|
|
153
|
+
"# AI crawlers cheatsheet",
|
|
154
|
+
"",
|
|
155
|
+
"## Training/index bots (robots.txt gate)",
|
|
156
|
+
"",
|
|
157
|
+
"- GPTBot — OpenAI ChatGPT training",
|
|
158
|
+
"- OAI-SearchBot — ChatGPT Search index",
|
|
159
|
+
"- ClaudeBot — Anthropic training",
|
|
160
|
+
"- PerplexityBot — Perplexity index",
|
|
161
|
+
"- CCBot — Common Crawl (feeds many LLM corpora)",
|
|
162
|
+
"- Google-Extended — robots-only opt-out token for Gemini training",
|
|
163
|
+
"- Applebot-Extended — robots-only opt-out for Apple Intelligence",
|
|
164
|
+
"- Bytespider — ByteDance Doubao",
|
|
165
|
+
"- Meta-ExternalAgent — Llama",
|
|
166
|
+
"",
|
|
167
|
+
"## Real-time fetch bots (UA gate)",
|
|
168
|
+
"",
|
|
169
|
+
"- ChatGPT-User — OpenAI on-prompt fetch",
|
|
170
|
+
"- Claude-Web — Anthropic on-prompt fetch",
|
|
171
|
+
"- Perplexity-User — Perplexity on-query fetch",
|
|
172
|
+
"",
|
|
173
|
+
"## Audit",
|
|
174
|
+
"",
|
|
175
|
+
"Use `crawler_access_audit` to verify these can each fetch a URL. Use the",
|
|
176
|
+
"`ai_crawler_checkup` prompt for an LLM-driven write-up.",
|
|
177
|
+
].join("\n");
|
|
178
|
+
export function registerResources(server) {
|
|
179
|
+
server.registerResource("cache_summary", "citation://cache/summary", {
|
|
180
|
+
title: "Citation cache summary",
|
|
181
|
+
description: "Aggregate counts of cached entries by type, engine, unique queries, and unique URLs. Read-only view of the local citation cache.",
|
|
182
|
+
mimeType: "application/json",
|
|
183
|
+
}, async (uri) => {
|
|
184
|
+
const summary = await loadCacheSummary();
|
|
185
|
+
return asJson(uri.toString(), summary);
|
|
186
|
+
});
|
|
187
|
+
server.registerResource("panels_list", "citation://panels", {
|
|
188
|
+
title: "Saved panels",
|
|
189
|
+
description: "List of saved query panels and per-panel snapshot counts. Mirrors track_queries action=list with snapshot context.",
|
|
190
|
+
mimeType: "application/json",
|
|
191
|
+
}, async (uri) => {
|
|
192
|
+
const panels = await loadPanelsList();
|
|
193
|
+
return asJson(uri.toString(), panels);
|
|
194
|
+
});
|
|
195
|
+
server.registerResource("llms_txt_primer", "citation://docs/llms-txt", {
|
|
196
|
+
title: "llms.txt primer",
|
|
197
|
+
description: "What llms.txt is, what it isn't, and how this server's tools help build one. Short markdown primer.",
|
|
198
|
+
mimeType: "text/markdown",
|
|
199
|
+
}, (uri) => ({
|
|
200
|
+
contents: [
|
|
201
|
+
{
|
|
202
|
+
uri: uri.toString(),
|
|
203
|
+
mimeType: "text/markdown",
|
|
204
|
+
text: LLMS_TXT_PRIMER,
|
|
205
|
+
},
|
|
206
|
+
],
|
|
207
|
+
}));
|
|
208
|
+
server.registerResource("crawlers_primer", "citation://docs/ai-crawlers", {
|
|
209
|
+
title: "AI crawlers cheatsheet",
|
|
210
|
+
description: "Quick reference for the AI crawlers `crawler_access_audit` checks, grouped by training vs real-time fetch.",
|
|
211
|
+
mimeType: "text/markdown",
|
|
212
|
+
}, (uri) => ({
|
|
213
|
+
contents: [
|
|
214
|
+
{
|
|
215
|
+
uri: uri.toString(),
|
|
216
|
+
mimeType: "text/markdown",
|
|
217
|
+
text: CRAWLERS_PRIMER,
|
|
218
|
+
},
|
|
219
|
+
],
|
|
220
|
+
}));
|
|
221
|
+
server.registerResource("cited_for_domain", new ResourceTemplate("citation://domain/{domain}/cited-for", {
|
|
222
|
+
list: undefined,
|
|
223
|
+
}), {
|
|
224
|
+
title: "Citations for a domain",
|
|
225
|
+
description: "Cached citations for {domain}. Returns the most recent 200 entries. Same source as cited_for tool, surfaced as a resource for clients that subscribe.",
|
|
226
|
+
mimeType: "application/json",
|
|
227
|
+
}, async (uri, variables) => {
|
|
228
|
+
const domainVar = variables.domain;
|
|
229
|
+
const domain = Array.isArray(domainVar) ? domainVar[0] : domainVar;
|
|
230
|
+
const safe = typeof domain === "string" ? domain : "";
|
|
231
|
+
const results = safe
|
|
232
|
+
? await citedForDomain(safe, undefined, undefined, 200)
|
|
233
|
+
: [];
|
|
234
|
+
return asJson(uri.toString(), {
|
|
235
|
+
domain: safe,
|
|
236
|
+
results,
|
|
237
|
+
total: results.length,
|
|
238
|
+
source: "local_cache",
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../src/resources.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,iEAAiE;AAEjE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,gBAAgB,GAEjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAUhD,SAAS,MAAM,CAAC,GAAW,EAAE,KAAc;IACzC,OAAO;QACL,QA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G,CAAC,QAAQ,EAAE;gBACnB,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,eAAe;aACtB;SACF;KACF,CAAC,CACH,CAAC;IAEF,MAAM,CAAC,gBAAgB,CACrB,kBAAkB,EAClB,IAAI,gBAAgB,CAAC,sCAAsC,EAAE;QAC3D,IAAI,EAAE,SAAS;KAChB,CAAC,EACF;QACE,KAAK,EAAE,wBAAwB;QAC/B,WAAW,EACT,uJAAuJ;QACzJ,QAAQ,EAAE,kBAAkB;KAC7B,EACD,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE;QACvB,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC;QACnC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACnE,MAAM,IAAI,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,MAAM,cAAc,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,CAAC;YACvD,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE;YAC5B,MAAM,EAAE,IAAI;YACZ,OAAO;YACP,KAAK,EAAE,OAAO,CAAC,MAAM;YACrB,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,37 +3,100 @@ import type { Engine } from "../types.js";
|
|
|
3
3
|
export declare const amICitedInputSchema: {
|
|
4
4
|
domain: z.ZodString;
|
|
5
5
|
queries: z.ZodArray<z.ZodString, "many">;
|
|
6
|
-
engine: z.ZodDefault<z.ZodEnum<["perplexity", "claude", "openai", "gemini", "
|
|
6
|
+
engine: z.ZodDefault<z.ZodEnum<["perplexity", "claude", "openai", "gemini", "bing_serp", "brave_serp", "google_ai_mode", "auto"]>>;
|
|
7
7
|
};
|
|
8
8
|
declare const inputSchema: z.ZodObject<{
|
|
9
9
|
domain: z.ZodString;
|
|
10
10
|
queries: z.ZodArray<z.ZodString, "many">;
|
|
11
|
-
engine: z.ZodDefault<z.ZodEnum<["perplexity", "claude", "openai", "gemini", "
|
|
11
|
+
engine: z.ZodDefault<z.ZodEnum<["perplexity", "claude", "openai", "gemini", "bing_serp", "brave_serp", "google_ai_mode", "auto"]>>;
|
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
|
13
|
-
engine: "perplexity" | "claude" | "openai" | "gemini" | "
|
|
13
|
+
engine: "perplexity" | "claude" | "openai" | "gemini" | "bing_serp" | "brave_serp" | "google_ai_mode" | "auto";
|
|
14
14
|
domain: string;
|
|
15
15
|
queries: string[];
|
|
16
16
|
}, {
|
|
17
17
|
domain: string;
|
|
18
18
|
queries: string[];
|
|
19
|
-
engine?: "perplexity" | "claude" | "openai" | "gemini" | "
|
|
19
|
+
engine?: "perplexity" | "claude" | "openai" | "gemini" | "bing_serp" | "brave_serp" | "google_ai_mode" | "auto" | undefined;
|
|
20
20
|
}>;
|
|
21
|
+
type PerQueryResult = {
|
|
22
|
+
query: string;
|
|
23
|
+
cited: boolean;
|
|
24
|
+
rank?: number;
|
|
25
|
+
matching_urls: string[];
|
|
26
|
+
};
|
|
21
27
|
export declare function amICited(input: z.infer<typeof inputSchema>): Promise<{
|
|
22
28
|
domain: string;
|
|
23
|
-
|
|
29
|
+
mode: string;
|
|
30
|
+
fetched_at: string;
|
|
31
|
+
engines: never[];
|
|
32
|
+
per_engine: never[];
|
|
33
|
+
consensus: {
|
|
34
|
+
queries_cited_by_all: number;
|
|
35
|
+
queries_total: number;
|
|
36
|
+
consensus_rate: number;
|
|
37
|
+
queries?: undefined;
|
|
38
|
+
};
|
|
39
|
+
note: string;
|
|
40
|
+
engine?: undefined;
|
|
41
|
+
surface?: undefined;
|
|
42
|
+
interpretation_note?: undefined;
|
|
43
|
+
results?: undefined;
|
|
44
|
+
summary?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
domain: string;
|
|
47
|
+
mode: string;
|
|
24
48
|
fetched_at: string;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
49
|
+
engines: {
|
|
50
|
+
engine: Engine;
|
|
51
|
+
surface: import("../types.js").Surface;
|
|
52
|
+
ok: boolean;
|
|
53
|
+
queries_cited: number;
|
|
54
|
+
citation_rate: number;
|
|
55
|
+
}[];
|
|
56
|
+
per_engine: {
|
|
57
|
+
engine: Engine;
|
|
58
|
+
surface: import("../types.js").Surface;
|
|
59
|
+
interpretation_note: string;
|
|
60
|
+
ok: boolean;
|
|
61
|
+
error: string | undefined;
|
|
62
|
+
results: PerQueryResult[];
|
|
63
|
+
summary: {
|
|
64
|
+
queries_total: number;
|
|
65
|
+
queries_cited: number;
|
|
66
|
+
citation_rate: number;
|
|
67
|
+
average_rank: number | undefined;
|
|
68
|
+
};
|
|
30
69
|
}[];
|
|
70
|
+
consensus: {
|
|
71
|
+
queries_cited_by_all: number;
|
|
72
|
+
queries_total: number;
|
|
73
|
+
consensus_rate: number;
|
|
74
|
+
queries: string[];
|
|
75
|
+
};
|
|
76
|
+
note: string;
|
|
77
|
+
engine?: undefined;
|
|
78
|
+
surface?: undefined;
|
|
79
|
+
interpretation_note?: undefined;
|
|
80
|
+
results?: undefined;
|
|
81
|
+
summary?: undefined;
|
|
82
|
+
} | {
|
|
83
|
+
domain: string;
|
|
84
|
+
mode: string;
|
|
85
|
+
engine: "perplexity" | "claude" | "openai" | "gemini" | "google_ai_mode";
|
|
86
|
+
surface: import("../types.js").Surface;
|
|
87
|
+
interpretation_note: string;
|
|
88
|
+
fetched_at: string;
|
|
89
|
+
results: PerQueryResult[];
|
|
31
90
|
summary: {
|
|
32
91
|
queries_total: number;
|
|
33
92
|
queries_cited: number;
|
|
34
93
|
citation_rate: number;
|
|
35
94
|
average_rank: number | undefined;
|
|
36
95
|
};
|
|
96
|
+
engines?: undefined;
|
|
97
|
+
per_engine?: undefined;
|
|
98
|
+
consensus?: undefined;
|
|
99
|
+
note?: undefined;
|
|
37
100
|
}>;
|
|
38
101
|
export {};
|
|
39
102
|
//# sourceMappingURL=am-i-cited.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"am-i-cited.d.ts","sourceRoot":"","sources":["../../src/tools/am-i-cited.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"am-i-cited.d.ts","sourceRoot":"","sources":["../../src/tools/am-i-cited.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,eAAO,MAAM,mBAAmB;;;;CAiB/B,CAAC;AAEF,QAAA,MAAM,WAAW;;;;;;;;;;;;EAAgC,CAAC;AA+BlD,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,EAAE,CAAC;CACzB,CAAC;AAyBF,wBAAsB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoHhE"}
|