@automatelab/citation-intelligence 0.6.0 → 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.
Files changed (71) hide show
  1. package/README.md +43 -8
  2. package/dist/adapters/anthropic.d.ts.map +1 -1
  3. package/dist/adapters/anthropic.js +4 -2
  4. package/dist/adapters/anthropic.js.map +1 -1
  5. package/dist/adapters/bing.js +1 -1
  6. package/dist/adapters/bing.js.map +1 -1
  7. package/dist/adapters/brave.js +1 -1
  8. package/dist/adapters/brave.js.map +1 -1
  9. package/dist/adapters/gemini.d.ts.map +1 -1
  10. package/dist/adapters/gemini.js +5 -1
  11. package/dist/adapters/gemini.js.map +1 -1
  12. package/dist/adapters/openai.d.ts.map +1 -1
  13. package/dist/adapters/openai.js +3 -1
  14. package/dist/adapters/openai.js.map +1 -1
  15. package/dist/adapters/perplexity.d.ts +2 -1
  16. package/dist/adapters/perplexity.d.ts.map +1 -1
  17. package/dist/adapters/perplexity.js +5 -2
  18. package/dist/adapters/perplexity.js.map +1 -1
  19. package/dist/index.js +8 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/tools/am-i-cited.d.ts +73 -10
  22. package/dist/tools/am-i-cited.d.ts.map +1 -1
  23. package/dist/tools/am-i-cited.js +115 -15
  24. package/dist/tools/am-i-cited.js.map +1 -1
  25. package/dist/tools/answer-box-position.d.ts +4 -4
  26. package/dist/tools/answer-box-position.js +2 -2
  27. package/dist/tools/answer-box-position.js.map +1 -1
  28. package/dist/tools/canonical-competitor-set.d.ts +4 -4
  29. package/dist/tools/canonical-competitor-set.js +6 -7
  30. package/dist/tools/canonical-competitor-set.js.map +1 -1
  31. package/dist/tools/check-citations.d.ts +11 -5
  32. package/dist/tools/check-citations.d.ts.map +1 -1
  33. package/dist/tools/check-citations.js +29 -10
  34. package/dist/tools/check-citations.js.map +1 -1
  35. package/dist/tools/citation-evidence.d.ts +4 -4
  36. package/dist/tools/citation-evidence.js +2 -2
  37. package/dist/tools/citation-evidence.js.map +1 -1
  38. package/dist/tools/citation-freshness-score.d.ts +4 -4
  39. package/dist/tools/citation-freshness-score.js +1 -1
  40. package/dist/tools/citation-freshness-score.js.map +1 -1
  41. package/dist/tools/citation-provenance.d.ts +6 -4
  42. package/dist/tools/citation-provenance.d.ts.map +1 -1
  43. package/dist/tools/citation-provenance.js +17 -8
  44. package/dist/tools/citation-provenance.js.map +1 -1
  45. package/dist/tools/cited-for-diff.d.ts +5 -5
  46. package/dist/tools/cited-for-diff.js +1 -1
  47. package/dist/tools/cited-for-diff.js.map +1 -1
  48. package/dist/tools/cited-for.d.ts +5 -5
  49. package/dist/tools/cited-for.js +1 -1
  50. package/dist/tools/cited-for.js.map +1 -1
  51. package/dist/tools/compete-for-query.d.ts +4 -4
  52. package/dist/tools/compete-for-query.js +1 -1
  53. package/dist/tools/compete-for-query.js.map +1 -1
  54. package/dist/tools/gsc-citation-gap.d.ts +5 -5
  55. package/dist/tools/gsc-citation-gap.d.ts.map +1 -1
  56. package/dist/tools/gsc-citation-gap.js +7 -2
  57. package/dist/tools/gsc-citation-gap.js.map +1 -1
  58. package/dist/tools/run-panel.d.ts +5 -5
  59. package/dist/tools/run-panel.d.ts.map +1 -1
  60. package/dist/tools/run-panel.js +13 -4
  61. package/dist/tools/run-panel.js.map +1 -1
  62. package/dist/tools/structured-data-repair.d.ts +30 -0
  63. package/dist/tools/structured-data-repair.d.ts.map +1 -0
  64. package/dist/tools/structured-data-repair.js +297 -0
  65. package/dist/tools/structured-data-repair.js.map +1 -0
  66. package/dist/types.d.ts +10 -1
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js +24 -1
  69. package/dist/types.js.map +1 -1
  70. package/package.json +59 -58
  71. package/smithery.yaml +50 -0
@@ -0,0 +1,297 @@
1
+ import { z } from "zod";
2
+ import * as cheerio from "cheerio";
3
+ import { fetchText, ToolFetchError } from "../lib/fetch.js";
4
+ export const structuredDataRepairInputSchema = {
5
+ url: z
6
+ .string()
7
+ .url()
8
+ .describe("URL to inspect for missing JSON-LD. The page is fetched and its content signals are used to suggest schema types."),
9
+ };
10
+ const inputSchema = z.object(structuredDataRepairInputSchema);
11
+ // Detect @types already present in any JSON-LD block on the page.
12
+ function extractPresentTypes(html) {
13
+ const $ = cheerio.load(html);
14
+ const present = new Set();
15
+ $('script[type="application/ld+json"]').each((_, el) => {
16
+ try {
17
+ const json = JSON.parse($(el).text());
18
+ collectTypes(json, present);
19
+ }
20
+ catch {
21
+ // ignore malformed blocks
22
+ }
23
+ });
24
+ return present;
25
+ }
26
+ function collectTypes(node, out) {
27
+ if (!node || typeof node !== "object")
28
+ return;
29
+ if (Array.isArray(node)) {
30
+ node.forEach((n) => collectTypes(n, out));
31
+ return;
32
+ }
33
+ const obj = node;
34
+ const t = obj["@type"];
35
+ const types = Array.isArray(t)
36
+ ? t.filter((x) => typeof x === "string")
37
+ : typeof t === "string"
38
+ ? [t]
39
+ : [];
40
+ for (const type of types)
41
+ out.add(type);
42
+ for (const v of Object.values(obj))
43
+ collectTypes(v, out);
44
+ }
45
+ function buildBlogPostingTemplate($, url) {
46
+ const headline = $('meta[property="og:title"]').attr("content") ||
47
+ $("h1").first().text().trim() ||
48
+ "FILL: Article headline";
49
+ const description = $('meta[property="og:description"]').attr("content") ||
50
+ $('meta[name="description"]').attr("content") ||
51
+ "FILL: Article description";
52
+ const datePublished = $('meta[property="article:published_time"]').attr("content") ||
53
+ $('time[datetime]').first().attr("datetime") ||
54
+ "FILL: 2025-01-01T00:00:00Z";
55
+ const author = $('meta[name="author"]').attr("content") ||
56
+ $('[rel="author"]').first().text().trim() ||
57
+ "FILL: Author Name";
58
+ const image = $('meta[property="og:image"]').attr("content") || "FILL: https://…/image.jpg";
59
+ return {
60
+ "@context": "https://schema.org",
61
+ "@type": "BlogPosting",
62
+ headline,
63
+ description,
64
+ url,
65
+ datePublished,
66
+ author: { "@type": "Person", name: author },
67
+ image,
68
+ };
69
+ }
70
+ function buildFaqTemplate($, pairs) {
71
+ const mainEntity = pairs.slice(0, 5).map(({ q, a }) => ({
72
+ "@type": "Question",
73
+ name: q,
74
+ acceptedAnswer: { "@type": "Answer", text: a },
75
+ }));
76
+ if (mainEntity.length === 0) {
77
+ mainEntity.push({
78
+ "@type": "Question",
79
+ name: "FILL: Question text?",
80
+ acceptedAnswer: { "@type": "Answer", text: "FILL: Answer text." },
81
+ });
82
+ }
83
+ return {
84
+ "@context": "https://schema.org",
85
+ "@type": "FAQPage",
86
+ mainEntity,
87
+ };
88
+ }
89
+ function buildHowToTemplate(steps, $) {
90
+ const name = $('meta[property="og:title"]').attr("content") ||
91
+ $("h1").first().text().trim() ||
92
+ "FILL: How-to title";
93
+ const stepItems = steps.length > 0
94
+ ? steps.slice(0, 10).map((text, i) => ({
95
+ "@type": "HowToStep",
96
+ position: i + 1,
97
+ text: text.trim(),
98
+ }))
99
+ : [
100
+ { "@type": "HowToStep", position: 1, text: "FILL: Step 1 instructions." },
101
+ { "@type": "HowToStep", position: 2, text: "FILL: Step 2 instructions." },
102
+ ];
103
+ return {
104
+ "@context": "https://schema.org",
105
+ "@type": "HowTo",
106
+ name,
107
+ step: stepItems,
108
+ };
109
+ }
110
+ function buildBreadcrumbTemplate(url, $) {
111
+ const parsed = new URL(url);
112
+ const parts = parsed.pathname.replace(/\/$/, "").split("/").filter(Boolean);
113
+ const itemListElement = [
114
+ {
115
+ "@type": "ListItem",
116
+ position: 1,
117
+ name: $('meta[property="og:site_name"]').attr("content") || "Home",
118
+ item: `${parsed.protocol}//${parsed.host}/`,
119
+ },
120
+ ...parts.map((seg, i) => ({
121
+ "@type": "ListItem",
122
+ position: i + 2,
123
+ name: seg
124
+ .replace(/[-_]/g, " ")
125
+ .replace(/\b\w/g, (c) => c.toUpperCase()) || "FILL: Section name",
126
+ item: `${parsed.protocol}//${parsed.host}/${parts.slice(0, i + 1).join("/")}/`,
127
+ })),
128
+ ];
129
+ return {
130
+ "@context": "https://schema.org",
131
+ "@type": "BreadcrumbList",
132
+ itemListElement,
133
+ };
134
+ }
135
+ function buildOrganizationTemplate($, url) {
136
+ const parsed = new URL(url);
137
+ const name = $('meta[property="og:site_name"]').attr("content") ||
138
+ $("title").text().trim() ||
139
+ "FILL: Organization name";
140
+ const logo = $('link[rel="icon"][type="image/png"]').attr("href") ||
141
+ $('link[rel="apple-touch-icon"]').attr("href") ||
142
+ "FILL: https://…/logo.png";
143
+ return {
144
+ "@context": "https://schema.org",
145
+ "@type": "Organization",
146
+ name,
147
+ url: `${parsed.protocol}//${parsed.host}/`,
148
+ logo,
149
+ sameAs: ["FILL: https://twitter.com/…", "FILL: https://linkedin.com/company/…"],
150
+ };
151
+ }
152
+ // Heuristics to detect content signals.
153
+ function detectSignals(html, url) {
154
+ const $ = cheerio.load(html);
155
+ const signals = new Map();
156
+ // BlogPosting signal: og:type=article or a byline element
157
+ const ogType = $('meta[property="og:type"]').attr("content");
158
+ const hasAuthor = $('[rel="author"], .author, .byline, [class*="author"], [class*="byline"]').length > 0;
159
+ if (ogType === "article" || hasAuthor) {
160
+ signals.set("BlogPosting", ogType === "article" ? "og:type=article" : "byline element found");
161
+ }
162
+ // FAQPage signal: heading that looks like a question followed by a paragraph
163
+ const faqPairs = [];
164
+ $("h2, h3, h4, dt").each((_, el) => {
165
+ const text = $(el).text().trim();
166
+ if (text.endsWith("?") || /^(what|how|why|when|where|who|can|does|is|are|do)/i.test(text)) {
167
+ const answer = $(el).next("p, dd").text().trim() ||
168
+ $(el).next("div").find("p").first().text().trim();
169
+ if (answer.length > 20) {
170
+ faqPairs.push({ q: text, a: answer.slice(0, 300) });
171
+ }
172
+ }
173
+ });
174
+ if (faqPairs.length >= 2) {
175
+ signals.set("FAQPage", `${faqPairs.length} question/answer pairs detected`);
176
+ signals.set("_faqPairs", faqPairs);
177
+ }
178
+ // HowTo signal: ordered list or headings with step/numbered prefix
179
+ const olItems = [];
180
+ $("ol > li").each((_, el) => {
181
+ olItems.push($(el).text().trim());
182
+ });
183
+ const stepHeadings = [];
184
+ $("h2, h3").each((_, el) => {
185
+ const t = $(el).text().trim();
186
+ if (/^step\s*\d+/i.test(t) || /^\d+[\.\)]\s/.test(t)) {
187
+ stepHeadings.push(t);
188
+ }
189
+ });
190
+ if (olItems.length >= 3) {
191
+ signals.set("HowTo", `ordered list with ${olItems.length} items`);
192
+ signals.set("_steps", olItems);
193
+ }
194
+ else if (stepHeadings.length >= 2) {
195
+ signals.set("HowTo", `${stepHeadings.length} step headings`);
196
+ signals.set("_steps", stepHeadings);
197
+ }
198
+ // BreadcrumbList signal: pathname has 2+ segments
199
+ try {
200
+ const parts = new URL(url).pathname.replace(/\/$/, "").split("/").filter(Boolean);
201
+ if (parts.length >= 2) {
202
+ signals.set("BreadcrumbList", `URL has ${parts.length + 1} path segments`);
203
+ }
204
+ }
205
+ catch {
206
+ // ignore
207
+ }
208
+ // Organization signal: root URL (homepage)
209
+ try {
210
+ const parsed = new URL(url);
211
+ if (parsed.pathname === "/" || parsed.pathname === "") {
212
+ signals.set("Organization", "homepage URL");
213
+ }
214
+ }
215
+ catch {
216
+ // ignore
217
+ }
218
+ return signals;
219
+ }
220
+ export async function structuredDataRepair(input) {
221
+ const parsed = inputSchema.parse(input);
222
+ const url = parsed.url;
223
+ const { text, status } = await fetchText(url, { timeoutMs: 15_000 });
224
+ if (status >= 400) {
225
+ throw new ToolFetchError({
226
+ type: "fetch_error",
227
+ url,
228
+ status,
229
+ message: `URL returned HTTP ${status} - cannot inspect a non-existent page.`,
230
+ });
231
+ }
232
+ const $ = cheerio.load(text);
233
+ const presentTypes = extractPresentTypes(text);
234
+ const signals = detectSignals(text, url);
235
+ // Build suggestions for signalled types that are not already present.
236
+ const suggestions = [];
237
+ if (signals.has("BlogPosting") && !presentTypes.has("BlogPosting") && !presentTypes.has("Article")) {
238
+ suggestions.push({
239
+ type: "BlogPosting",
240
+ signal: signals.get("BlogPosting"),
241
+ template: buildBlogPostingTemplate($, url),
242
+ });
243
+ }
244
+ if (signals.has("FAQPage") && !presentTypes.has("FAQPage")) {
245
+ const faqPairs = signals.get("_faqPairs");
246
+ suggestions.push({
247
+ type: "FAQPage",
248
+ signal: signals.get("FAQPage"),
249
+ template: buildFaqTemplate($, faqPairs ?? []),
250
+ });
251
+ }
252
+ if (signals.has("HowTo") && !presentTypes.has("HowTo")) {
253
+ const steps = signals.get("_steps");
254
+ suggestions.push({
255
+ type: "HowTo",
256
+ signal: signals.get("HowTo"),
257
+ template: buildHowToTemplate(steps ?? [], $),
258
+ });
259
+ }
260
+ if (signals.has("BreadcrumbList") && !presentTypes.has("BreadcrumbList")) {
261
+ suggestions.push({
262
+ type: "BreadcrumbList",
263
+ signal: signals.get("BreadcrumbList"),
264
+ template: buildBreadcrumbTemplate(url, $),
265
+ });
266
+ }
267
+ if (signals.has("Organization") && !presentTypes.has("Organization")) {
268
+ suggestions.push({
269
+ type: "Organization",
270
+ signal: signals.get("Organization"),
271
+ template: buildOrganizationTemplate($, url),
272
+ });
273
+ }
274
+ const signalEntries = {};
275
+ for (const [k, v] of signals.entries()) {
276
+ if (!k.startsWith("_"))
277
+ signalEntries[k] = v;
278
+ }
279
+ return {
280
+ url,
281
+ fetched_at: new Date().toISOString(),
282
+ schema_types_present: [...presentTypes],
283
+ signals_detected: signalEntries,
284
+ suggestions: suggestions.map((s) => ({
285
+ type: s.type,
286
+ signal: s.signal,
287
+ ready_to_paste: JSON.stringify(s.template, null, 2),
288
+ })),
289
+ summary: {
290
+ types_present: presentTypes.size,
291
+ signals_detected: Object.keys(signalEntries).length,
292
+ suggestions_count: suggestions.length,
293
+ },
294
+ note: "Fields marked 'FILL:' require manual completion. Paste each ready_to_paste block into a <script type=\"application/ld+json\"> tag in <head>.",
295
+ };
296
+ }
297
+ //# sourceMappingURL=structured-data-repair.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"structured-data-repair.js","sourceRoot":"","sources":["../../src/tools/structured-data-repair.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,O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GAAG;QACH,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACpC,oBAAoB,EAAE,CAAC,GAAG,YAAY,CAAC;QACvC,gBAAgB,EAAE,aAAa;QAC/B,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACnC,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;SACpD,CAAC,CAAC;QACH,OAAO,EAAE;YACP,aAAa,EAAE,YAAY,CAAC,IAAI;YAChC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM;YACnD,iBAAiB,EAAE,WAAW,CAAC,MAAM;SACtC;QACD,IAAI,EAAE,8IAA8I;KACrJ,CAAC;AACJ,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,4 +1,12 @@
1
- export type Engine = "perplexity" | "claude" | "openai" | "gemini" | "bing" | "brave" | "google_ai_mode" | "auto";
1
+ export type Engine = "perplexity" | "claude" | "openai" | "gemini" | "bing_serp" | "brave_serp" | "brave" | "google_ai_mode" | "auto";
2
+ /** How the data was collected — lets callers understand what the result actually measures. */
3
+ export type Surface = "consumer_scrape" | "api_proxy" | "web_rank" | "static_signal";
4
+ export declare const ENGINE_SURFACE: Record<Exclude<Engine, "auto">, Surface>;
5
+ /**
6
+ * One-line note explaining what each engine result actually measures vs the
7
+ * consumer product. Included in every tool response as `interpretation_note`.
8
+ */
9
+ export declare const ENGINE_INTERPRETATION_NOTE: Record<Exclude<Engine, "auto">, string>;
2
10
  export type Citation = {
3
11
  url: string;
4
12
  title?: string;
@@ -8,6 +16,7 @@ export type Citation = {
8
16
  export type NormalizedCitationResult = {
9
17
  query: string;
10
18
  engine: Engine;
19
+ surface: Surface;
11
20
  fetched_at: string;
12
21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AAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC5F;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC"}
package/dist/types.js CHANGED
@@ -1,2 +1,25 @@
1
- export {};
1
+ export const ENGINE_SURFACE = {
2
+ perplexity: "consumer_scrape",
3
+ claude: "api_proxy",
4
+ openai: "api_proxy",
5
+ gemini: "api_proxy",
6
+ google_ai_mode: "consumer_scrape",
7
+ bing_serp: "web_rank",
8
+ brave_serp: "web_rank",
9
+ brave: "web_rank",
10
+ };
11
+ /**
12
+ * One-line note explaining what each engine result actually measures vs the
13
+ * consumer product. Included in every tool response as `interpretation_note`.
14
+ */
15
+ export const ENGINE_INTERPRETATION_NOTE = {
16
+ google_ai_mode: "SerpAPI scrape of the real Google AI Overview — pixel-accurate to what google.com users see.",
17
+ perplexity: "sonar-pro API with a consumer-equivalent system prompt. Real perplexity.ai users may see sonar-reasoning-pro with multi-turn follow-ups.",
18
+ openai: "gpt-4o-search-preview API. Real chatgpt.com users get gpt-4o + SearchGPT with different ranking and UI-level re-scoring.",
19
+ claude: "claude-sonnet-4-7 API with web_search tool (max 5 uses). Real claude.ai users get a different model tier and citation UI.",
20
+ gemini: "gemini-2.5-pro API with google_search grounding. Real gemini.google.com uses the same grounding index but different re-ranking.",
21
+ bing_serp: "Bing Web Search API — traditional SERP rank, NOT LLM citation behavior.",
22
+ brave_serp: "Brave Search API — traditional SERP rank, NOT LLM citation behavior.",
23
+ brave: "Brave Search API — traditional SERP rank, NOT LLM citation behavior.",
24
+ };
2
25
  //# sourceMappingURL=types.js.map
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,cAAc,GAA6C;IACtE,UAAU,EAAE,iBAAiB;IAC7B,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,cAAc,EAAE,iBAAiB;IACjC,SAAS,EAAE,UAAU;IACrB,UAAU,EAAE,UAAU;IACtB,KAAK,EAAE,UAAU;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAA4C;IACjF,cAAc,EACZ,8FAA8F;IAChG,UAAU,EACR,0IAA0I;IAC5I,MAAM,EACJ,0HAA0H;IAC5H,MAAM,EACJ,2HAA2H;IAC7H,MAAM,EACJ,iIAAiI;IACnI,SAAS,EACP,yEAAyE;IAC3E,UAAU,EACR,sEAAsE;IACxE,KAAK,EACH,sEAAsE;CACzE,CAAC"}
package/package.json CHANGED
@@ -1,58 +1,59 @@
1
- {
2
- "name": "@automatelab/citation-intelligence",
3
- "version": "0.6.0",
4
- "mcpName": "io.github.AutomateLab-tech/citation-intelligence",
5
- "description": "What LLMs cite, for agents. MCP server: check what Perplexity, Claude, ChatGPT, Gemini, Bing, and Google AI Overviews cite for any query. Self-hosted, BYO API key.",
6
- "license": "MIT",
7
- "author": "automatelab.tech",
8
- "homepage": "https://github.com/AutomateLab-tech/citation-intelligence",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/AutomateLab-tech/citation-intelligence.git"
12
- },
13
- "engines": { "node": ">=20" },
14
- "type": "module",
15
- "bin": {
16
- "citation-intelligence": "dist/index.js"
17
- },
18
- "main": "dist/index.js",
19
- "scripts": {
20
- "build": "tsc",
21
- "dev": "tsx src/index.ts",
22
- "start": "node dist/index.js",
23
- "test": "vitest run",
24
- "test:watch": "vitest",
25
- "typecheck": "tsc --noEmit"
26
- },
27
- "dependencies": {
28
- "@modelcontextprotocol/sdk": "1.29.0",
29
- "cheerio": "1.0.0",
30
- "google-auth-library": "9.15.0",
31
- "robots-parser": "3.0.1",
32
- "undici": "7.25.0",
33
- "zod": "3.25.76"
34
- },
35
- "devDependencies": {
36
- "@types/node": "22.19.19",
37
- "tsx": "4.22.0",
38
- "typescript": "5.7.3",
39
- "vitest": "3.2.4"
40
- },
41
- "files": [
42
- "dist",
43
- "README.md",
44
- "LICENSE"
45
- ],
46
- "keywords": [
47
- "mcp",
48
- "citation",
49
- "ai-search",
50
- "geo",
51
- "aeo",
52
- "llm-visibility",
53
- "perplexity",
54
- "ai-overview",
55
- "agent",
56
- "self-hosted"
57
- ]
58
- }
1
+ {
2
+ "name": "@automatelab/citation-intelligence",
3
+ "version": "0.7.0",
4
+ "mcpName": "io.github.AutomateLab-tech/citation-intelligence",
5
+ "description": "What LLMs cite, for agents. MCP server: check what Perplexity, Claude, ChatGPT, Gemini, Bing, and Google AI Overviews cite for any query. Self-hosted, BYO API key.",
6
+ "license": "MIT",
7
+ "author": "automatelab.tech",
8
+ "homepage": "https://github.com/AutomateLab-tech/citation-intelligence",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/AutomateLab-tech/citation-intelligence.git"
12
+ },
13
+ "engines": { "node": ">=20" },
14
+ "type": "module",
15
+ "bin": {
16
+ "citation-intelligence": "dist/index.js"
17
+ },
18
+ "main": "dist/index.js",
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsx src/index.ts",
22
+ "start": "node dist/index.js",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest",
25
+ "typecheck": "tsc --noEmit"
26
+ },
27
+ "dependencies": {
28
+ "@modelcontextprotocol/sdk": "1.29.0",
29
+ "cheerio": "1.0.0",
30
+ "google-auth-library": "9.15.0",
31
+ "robots-parser": "3.0.1",
32
+ "undici": "7.25.0",
33
+ "zod": "3.25.76"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "22.19.19",
37
+ "tsx": "4.22.0",
38
+ "typescript": "5.7.3",
39
+ "vitest": "3.2.4"
40
+ },
41
+ "files": [
42
+ "dist",
43
+ "smithery.yaml",
44
+ "README.md",
45
+ "LICENSE"
46
+ ],
47
+ "keywords": [
48
+ "mcp",
49
+ "citation",
50
+ "ai-search",
51
+ "geo",
52
+ "aeo",
53
+ "llm-visibility",
54
+ "perplexity",
55
+ "ai-overview",
56
+ "agent",
57
+ "self-hosted"
58
+ ]
59
+ }
package/smithery.yaml ADDED
@@ -0,0 +1,50 @@
1
+ startCommand:
2
+ type: stdio
3
+
4
+ configSchema:
5
+ type: object
6
+ properties:
7
+ serpApiKey:
8
+ type: string
9
+ title: SerpAPI key
10
+ description: Enables Google AI Mode / AI Overviews citation data. Get one at serpapi.com.
11
+ perplexityApiKey:
12
+ type: string
13
+ title: Perplexity API key
14
+ description: Enables Perplexity citation data. Get one at perplexity.ai.
15
+ anthropicApiKey:
16
+ type: string
17
+ title: Anthropic API key
18
+ description: Enables Claude citation data.
19
+ openaiApiKey:
20
+ type: string
21
+ title: OpenAI API key
22
+ description: Enables ChatGPT citation data.
23
+ geminiApiKey:
24
+ type: string
25
+ title: Gemini API key
26
+ description: Enables Google Gemini citation data.
27
+ bingApiKey:
28
+ type: string
29
+ title: Bing Search API key
30
+ description: Enables Bing/Copilot citation data.
31
+ braveApiKey:
32
+ type: string
33
+ title: Brave Search API key
34
+ description: Enables Brave Search citation data.
35
+ required: []
36
+
37
+ commandFunction: |-
38
+ config => ({
39
+ command: "npx",
40
+ args: ["-y", "@automatelab/citation-intelligence"],
41
+ env: {
42
+ ...(config.serpApiKey ? { SERPAPI_KEY: config.serpApiKey } : {}),
43
+ ...(config.perplexityApiKey ? { PERPLEXITY_API_KEY: config.perplexityApiKey } : {}),
44
+ ...(config.anthropicApiKey ? { ANTHROPIC_API_KEY: config.anthropicApiKey } : {}),
45
+ ...(config.openaiApiKey ? { OPENAI_API_KEY: config.openaiApiKey } : {}),
46
+ ...(config.geminiApiKey ? { GEMINI_API_KEY: config.geminiApiKey } : {}),
47
+ ...(config.bingApiKey ? { BING_API_KEY: config.bingApiKey } : {}),
48
+ ...(config.braveApiKey ? { BRAVE_API_KEY: config.braveApiKey } : {}),
49
+ }
50
+ })