@nitpicker/mcp-server 0.9.0 → 0.12.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/lib/mcp-server.d.ts +11 -0
- package/lib/mcp-server.js +127 -7
- package/lib/tool-definitions.js +243 -8
- package/package.json +4 -4
package/lib/mcp-server.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export declare function createServer(): Server<{
|
|
|
12
12
|
_meta?: {
|
|
13
13
|
[x: string]: unknown;
|
|
14
14
|
progressToken?: string | number | undefined;
|
|
15
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
16
|
+
taskId: string;
|
|
17
|
+
} | undefined;
|
|
15
18
|
} | undefined;
|
|
16
19
|
} | undefined;
|
|
17
20
|
}, {
|
|
@@ -20,12 +23,20 @@ export declare function createServer(): Server<{
|
|
|
20
23
|
[x: string]: unknown;
|
|
21
24
|
_meta?: {
|
|
22
25
|
[x: string]: unknown;
|
|
26
|
+
progressToken?: string | number | undefined;
|
|
27
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
28
|
+
taskId: string;
|
|
29
|
+
} | undefined;
|
|
23
30
|
} | undefined;
|
|
24
31
|
} | undefined;
|
|
25
32
|
}, {
|
|
26
33
|
[x: string]: unknown;
|
|
27
34
|
_meta?: {
|
|
28
35
|
[x: string]: unknown;
|
|
36
|
+
progressToken?: string | number | undefined;
|
|
37
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
38
|
+
taskId: string;
|
|
39
|
+
} | undefined;
|
|
29
40
|
} | undefined;
|
|
30
41
|
}>;
|
|
31
42
|
/**
|
package/lib/mcp-server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
3
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
-
import { ArchiveManager, checkHeaders, findDuplicates, findMismatches, getPageDetail, getPageHtml, getResourceReferrers, getSummary, getViolations, listImages, listLinks, listPages, listResources, } from '@nitpicker/query';
|
|
4
|
+
import { ArchiveManager, checkHeaders, countPagesByJsonLdType, countPagesByTag, findDuplicates, findMismatches, getIsolatedCluster, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageTags, getResourceReferrers, getSummary, getTagInventory, getViolations, listImages, listIsolatedClusters, listIsolatedPages, listLinks, listPages, listPagesByJsonLdType, listPagesByTag, listResources, listUnusedResources, } from '@nitpicker/query';
|
|
5
5
|
import { toolDefinitions } from './tool-definitions.js';
|
|
6
6
|
/**
|
|
7
7
|
* Validates that a required string argument is present and returns it.
|
|
@@ -35,8 +35,34 @@ function optionalNumber(args, key) {
|
|
|
35
35
|
}
|
|
36
36
|
return num;
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Validates an optional boolean argument, coercing common string forms
|
|
40
|
+
* (`"true"` / `"false"`) so LLM clients that JSON-encode tool arguments
|
|
41
|
+
* don't silently fall into the truthy-string trap (`"false"` being truthy
|
|
42
|
+
* would otherwise flip a diagnostic flag on when the caller asked it off).
|
|
43
|
+
* @param args - The MCP tool-call arguments object.
|
|
44
|
+
* @param key - The argument key.
|
|
45
|
+
* @returns The boolean value, or `undefined` if not present.
|
|
46
|
+
* @throws {TypeError} If the value is present but not a boolean / coercible string.
|
|
47
|
+
*/
|
|
48
|
+
function optionalBoolean(args, key) {
|
|
49
|
+
const value = args[key];
|
|
50
|
+
if (value == null) {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
if (typeof value === 'boolean') {
|
|
54
|
+
return value;
|
|
55
|
+
}
|
|
56
|
+
if (value === 'true') {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (value === 'false') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
throw new TypeError(`Invalid boolean for argument: ${key}`);
|
|
63
|
+
}
|
|
38
64
|
/** Valid link analysis types. */
|
|
39
|
-
const VALID_LINK_TYPES = ['broken', 'external'
|
|
65
|
+
const VALID_LINK_TYPES = ['broken', 'external'];
|
|
40
66
|
/** Valid mismatch types. */
|
|
41
67
|
const VALID_MISMATCH_TYPES = ['canonical', 'og:title', 'og:description'];
|
|
42
68
|
/** Valid duplicate check fields. */
|
|
@@ -77,8 +103,18 @@ function omit(args, ...keys) {
|
|
|
77
103
|
* @returns The configured Server instance.
|
|
78
104
|
*/
|
|
79
105
|
export function createServer() {
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
// Route ArchiveManager warnings to stderr explicitly via process.stderr.write
|
|
107
|
+
// instead of `console.warn`, but more importantly: do NOT let them leak into
|
|
108
|
+
// `process.stdout`, which is reserved for JSON-RPC framing on MCP stdio.
|
|
109
|
+
// `console.warn` already writes to stderr on Node, but going through onWarn
|
|
110
|
+
// gives us a single chokepoint to silence/redirect (e.g. when an MCP host
|
|
111
|
+
// surfaces stderr to the user as red error banners).
|
|
112
|
+
const manager = new ArchiveManager({
|
|
113
|
+
onWarn: (message) => {
|
|
114
|
+
process.stderr.write(`${message}\n`);
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
const server = new Server({ name: 'nitpicker', version: '0.10.0' }, { capabilities: { tools: {} } });
|
|
82
118
|
server.setRequestHandler(ListToolsRequestSchema, () => Promise.resolve({ tools: toolDefinitions }));
|
|
83
119
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
84
120
|
const { name } = request.params;
|
|
@@ -87,13 +123,20 @@ export function createServer() {
|
|
|
87
123
|
switch (name) {
|
|
88
124
|
case 'open_archive': {
|
|
89
125
|
const filePath = requireString(args, 'filePath');
|
|
90
|
-
const { archiveId, accessor } = await manager.open(filePath);
|
|
126
|
+
const { archiveId, accessor, mode, crawlerLockHolder } = await manager.open(filePath);
|
|
91
127
|
const summary = await getSummary(accessor);
|
|
92
128
|
return jsonResult({
|
|
93
129
|
archiveId,
|
|
94
130
|
baseUrl: summary.baseUrl,
|
|
95
131
|
roots: summary.roots,
|
|
96
132
|
totalPages: summary.totalPages,
|
|
133
|
+
// Surface the source kind so an LLM caller knows whether
|
|
134
|
+
// the data is finalised or a moving snapshot.
|
|
135
|
+
mode,
|
|
136
|
+
// PID of a crawler currently writing the stub (when
|
|
137
|
+
// detectable). `null` for finished archives and
|
|
138
|
+
// interrupted-but-no-longer-running crawls.
|
|
139
|
+
crawlerPid: crawlerLockHolder?.alive ? crawlerLockHolder.pid : null,
|
|
97
140
|
});
|
|
98
141
|
}
|
|
99
142
|
case 'close_archive': {
|
|
@@ -134,10 +177,11 @@ export function createServer() {
|
|
|
134
177
|
case 'list_links': {
|
|
135
178
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
136
179
|
const type = validateEnum(requireString(args, 'type'), VALID_LINK_TYPES, 'link type');
|
|
137
|
-
const linkOpts = omit(args, 'archiveId');
|
|
138
180
|
return jsonResult(await listLinks(accessor, {
|
|
139
|
-
...linkOpts,
|
|
140
181
|
type,
|
|
182
|
+
limit: optionalNumber(args, 'limit'),
|
|
183
|
+
offset: optionalNumber(args, 'offset'),
|
|
184
|
+
includeRedirectSources: optionalBoolean(args, 'includeRedirectSources'),
|
|
141
185
|
}));
|
|
142
186
|
}
|
|
143
187
|
case 'list_resources': {
|
|
@@ -177,6 +221,82 @@ export function createServer() {
|
|
|
177
221
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
178
222
|
return jsonResult(await checkHeaders(accessor, omit(args, 'archiveId')));
|
|
179
223
|
}
|
|
224
|
+
case 'list_isolated_pages': {
|
|
225
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
226
|
+
return jsonResult(await listIsolatedPages(accessor, {
|
|
227
|
+
limit: optionalNumber(args, 'limit'),
|
|
228
|
+
offset: optionalNumber(args, 'offset'),
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
case 'list_isolated_clusters': {
|
|
232
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
233
|
+
return jsonResult(await listIsolatedClusters(accessor, {
|
|
234
|
+
limit: optionalNumber(args, 'limit'),
|
|
235
|
+
offset: optionalNumber(args, 'offset'),
|
|
236
|
+
}));
|
|
237
|
+
}
|
|
238
|
+
case 'get_isolated_cluster': {
|
|
239
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
240
|
+
const result = await getIsolatedCluster(accessor, requireString(args, 'representativeUrl'));
|
|
241
|
+
if (result === null) {
|
|
242
|
+
return textResult('Isolated cluster not found.');
|
|
243
|
+
}
|
|
244
|
+
return jsonResult(result);
|
|
245
|
+
}
|
|
246
|
+
case 'list_unused_resources': {
|
|
247
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
248
|
+
return jsonResult(await listUnusedResources(accessor, {
|
|
249
|
+
limit: optionalNumber(args, 'limit'),
|
|
250
|
+
offset: optionalNumber(args, 'offset'),
|
|
251
|
+
}));
|
|
252
|
+
}
|
|
253
|
+
case 'list_pages_by_tag': {
|
|
254
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
255
|
+
return jsonResult(await listPagesByTag(accessor, {
|
|
256
|
+
provider: requireString(args, 'provider'),
|
|
257
|
+
externalId: typeof args.externalId === 'string' ? args.externalId : undefined,
|
|
258
|
+
limit: optionalNumber(args, 'limit'),
|
|
259
|
+
offset: optionalNumber(args, 'offset'),
|
|
260
|
+
}));
|
|
261
|
+
}
|
|
262
|
+
case 'count_pages_by_tag': {
|
|
263
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
264
|
+
return jsonResult(await countPagesByTag(accessor, {
|
|
265
|
+
provider: requireString(args, 'provider'),
|
|
266
|
+
externalId: typeof args.externalId === 'string' ? args.externalId : undefined,
|
|
267
|
+
}));
|
|
268
|
+
}
|
|
269
|
+
case 'list_pages_by_jsonld_type': {
|
|
270
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
271
|
+
return jsonResult(await listPagesByJsonLdType(accessor, {
|
|
272
|
+
type: requireString(args, 'type'),
|
|
273
|
+
limit: optionalNumber(args, 'limit'),
|
|
274
|
+
offset: optionalNumber(args, 'offset'),
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
case 'count_pages_by_jsonld_type': {
|
|
278
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
279
|
+
return jsonResult(await countPagesByJsonLdType(accessor, {
|
|
280
|
+
type: requireString(args, 'type'),
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
case 'get_tag_inventory': {
|
|
284
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
285
|
+
return jsonResult(await getTagInventory(accessor));
|
|
286
|
+
}
|
|
287
|
+
case 'get_page_jsonld': {
|
|
288
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
289
|
+
const slim = typeof args.slim === 'boolean' ? args.slim : true;
|
|
290
|
+
return jsonResult(await getPageJsonLd(accessor, requireString(args, 'url'), slim));
|
|
291
|
+
}
|
|
292
|
+
case 'get_page_jsonld_overview': {
|
|
293
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
294
|
+
return jsonResult(await getPageJsonLdOverview(accessor, requireString(args, 'url')));
|
|
295
|
+
}
|
|
296
|
+
case 'get_page_tags': {
|
|
297
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
298
|
+
return jsonResult(await getPageTags(accessor, requireString(args, 'url')));
|
|
299
|
+
}
|
|
180
300
|
default: {
|
|
181
301
|
return {
|
|
182
302
|
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
package/lib/tool-definitions.js
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
export const toolDefinitions = [
|
|
7
7
|
{
|
|
8
8
|
name: 'open_archive',
|
|
9
|
-
description: 'Load a .nitpicker archive file
|
|
9
|
+
description: 'Load a Nitpicker archive source for querying. Accepts either a finished `.nitpicker` archive file OR a crawl stub directory (an `._nitpicker-*` working directory left behind when a crawl is interrupted). Returns an archiveId, the detected `mode` (`"archive"` or `"stub"`), and `crawlerPid` (the PID of a crawler currently writing the stub, or `null` for finished archives and interrupted-but-no-longer-running crawls). When `mode === "stub"`, treat the data as a point-in-time snapshot: any counts/violations may shift if the user resumes the crawl. Always call this first before using any other tools.',
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
|
13
13
|
filePath: {
|
|
14
14
|
type: 'string',
|
|
15
|
-
description: 'Absolute or relative path to
|
|
15
|
+
description: 'Absolute or relative path to a `.nitpicker` archive file OR a crawl stub directory (containing `db.sqlite`).',
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
required: ['filePath'],
|
|
@@ -34,7 +34,7 @@ export const toolDefinitions = [
|
|
|
34
34
|
},
|
|
35
35
|
{
|
|
36
36
|
name: 'get_summary',
|
|
37
|
-
description: 'Get site-wide overview:
|
|
37
|
+
description: 'Get site-wide overview. Returns: internal/external HTML page counts (`internalPages` / `externalPages`), internal/external content-row counts across every MIME (`internalContents` / `externalContents` — HTML + PDF + Office docs + CSVs + archives + ...), HTTP status distribution, Content-Type distribution over 18 categories (html, pdf, csv, word, excel, powerpoint, image, css, javascript, json+yaml, xml, font, audio, video, archive, text, other, unknown), and metadata fulfillment rates (title, description, OG tags) for internal HTML pages only. `internalContents` is always >= `internalPages` (the latter applies the historical HTML-or-null filter, the former does not). Use this first to understand the archive contents.',
|
|
38
38
|
inputSchema: {
|
|
39
39
|
type: 'object',
|
|
40
40
|
properties: {
|
|
@@ -48,7 +48,7 @@ export const toolDefinitions = [
|
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
50
|
name: 'list_pages',
|
|
51
|
-
description: 'List pages with rich filtering: by status code (exact or range), missing metadata (title, description), noindex flag, URL patterns, directory paths. Supports sorting and pagination. Use for questions like "show me all 404 pages" or "pages without descriptions".',
|
|
51
|
+
description: 'List pages with rich filtering: by status code (exact or range), missing metadata (title, description), noindex flag, URL patterns, directory paths. Supports sorting and pagination. Use for questions like "show me all 404 pages" or "pages without descriptions". For large sites, set `limit` to keep the response bounded — to dump the whole list use the CLI (`nitpicker query pages`) and pipe through `jq` instead of pulling everything through MCP.',
|
|
52
52
|
inputSchema: {
|
|
53
53
|
type: 'object',
|
|
54
54
|
properties: {
|
|
@@ -75,6 +75,30 @@ export const toolDefinitions = [
|
|
|
75
75
|
description: 'Filter to pages missing description',
|
|
76
76
|
},
|
|
77
77
|
noindex: { type: 'boolean', description: 'Filter to pages with noindex set' },
|
|
78
|
+
contentTypeCategory: {
|
|
79
|
+
type: 'string',
|
|
80
|
+
enum: [
|
|
81
|
+
'html',
|
|
82
|
+
'pdf',
|
|
83
|
+
'csv',
|
|
84
|
+
'word',
|
|
85
|
+
'excel',
|
|
86
|
+
'powerpoint',
|
|
87
|
+
'image',
|
|
88
|
+
'css',
|
|
89
|
+
'javascript',
|
|
90
|
+
'json',
|
|
91
|
+
'xml',
|
|
92
|
+
'font',
|
|
93
|
+
'audio',
|
|
94
|
+
'video',
|
|
95
|
+
'archive',
|
|
96
|
+
'text',
|
|
97
|
+
'other',
|
|
98
|
+
'unknown',
|
|
99
|
+
],
|
|
100
|
+
description: 'Restrict to one Content-Type category. When set, the default HTML-or-null base filter is relaxed so non-HTML categories (PDF, image, archive…) become reachable through this listing — useful for audits like "show every PDF in scope". csv groups .csv + .tsv; word groups .doc + .docx; excel groups .xls + .xlsx; powerpoint groups .ppt + .pptx; json groups JSON + YAML; text groups .txt + .md.',
|
|
101
|
+
},
|
|
78
102
|
urlPattern: {
|
|
79
103
|
type: 'string',
|
|
80
104
|
description: 'URL pattern to search (SQL LIKE: use % as wildcard)',
|
|
@@ -98,7 +122,7 @@ export const toolDefinitions = [
|
|
|
98
122
|
},
|
|
99
123
|
{
|
|
100
124
|
name: 'get_page_detail',
|
|
101
|
-
description: 'Get full details for a specific page URL:
|
|
125
|
+
description: 'Get full details for a specific page URL: ~47 flat meta fields (title, description, OG, Twitter, robots, link, charset, manifest, themeColor, fb_app_id, verification_google, format_detection, og:image:alt/width/height, og:locale, og:article timestamps, twitter:site/creator, etc.), `metaExtras` JSON (referrer, viewport parsed, httpEquiv, apple, msapplication, verification.{bing|yandex|...}, geo, citation, hreflang alternates, others.*, originTrial), JSON-LD/SpeculationRules **summary** (count + unique @types + parseErrorCount), Wappalyzer tag **summary** (count + provider→ids map), outbound/inbound links, redirect sources, response headers, and within-archive timestamps (firstCrawledAt / lastCrawledAt). Raw JSON-LD entries and full tag rows are NOT included — fetch them via `get_page_jsonld` / `get_page_tags`. Use when drilling down into a specific page.',
|
|
102
126
|
inputSchema: {
|
|
103
127
|
type: 'object',
|
|
104
128
|
properties: {
|
|
@@ -135,7 +159,7 @@ export const toolDefinitions = [
|
|
|
135
159
|
},
|
|
136
160
|
{
|
|
137
161
|
name: 'list_links',
|
|
138
|
-
description: '
|
|
162
|
+
description: 'Analyse links: find **broken** links (4xx/5xx status or no status) or **external** links. Anchor destinations are resolved through `pages.redirectDestId` to the canonical final destination before judgment, so a 301 intermediate that lands on a 404 reports as broken with the 404 URL — not as a stale 301. Pass `includeRedirectSources: true` to disable the resolution and see the literal anchor target (diagnostic view). For orphan analysis, use `list_isolated_pages` (singletons) or `list_isolated_clusters` (interconnected orphan groups) — the previous `orphaned` type was removed in favour of those two well-separated concepts.',
|
|
139
163
|
inputSchema: {
|
|
140
164
|
type: 'object',
|
|
141
165
|
properties: {
|
|
@@ -145,8 +169,12 @@ export const toolDefinitions = [
|
|
|
145
169
|
},
|
|
146
170
|
type: {
|
|
147
171
|
type: 'string',
|
|
148
|
-
enum: ['broken', 'external'
|
|
149
|
-
description: 'Type of link analysis: broken (4xx/5xx)
|
|
172
|
+
enum: ['broken', 'external'],
|
|
173
|
+
description: 'Type of link analysis: broken (4xx/5xx or no status) or external (anchor leaves the in-scope hostname). Judged against the redirect-resolved canonical destination by default.',
|
|
174
|
+
},
|
|
175
|
+
includeRedirectSources: {
|
|
176
|
+
type: 'boolean',
|
|
177
|
+
description: 'When true, skip the redirect resolution and judge against the literal anchor target. Diagnostic — default is false.',
|
|
150
178
|
},
|
|
151
179
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
152
180
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
@@ -291,6 +319,147 @@ export const toolDefinitions = [
|
|
|
291
319
|
required: ['archiveId', 'resourceUrl'],
|
|
292
320
|
},
|
|
293
321
|
},
|
|
322
|
+
{
|
|
323
|
+
name: 'list_pages_by_tag',
|
|
324
|
+
description: 'List pages that have a Wappalyzer-detected tag matching the given `provider` (and optionally a specific `externalId` like a GTM container ID or GA4 measurement ID). Returns the same shape as `list_pages`. Before pulling the full list, consider calling `count_pages_by_tag` to size-check — on a large site GTM may cover most pages and the response can run into MB. For full bulk extraction prefer the CLI: `nitpicker query pages-by-tag --provider "Google Tag Manager" | jq`.',
|
|
325
|
+
inputSchema: {
|
|
326
|
+
type: 'object',
|
|
327
|
+
properties: {
|
|
328
|
+
archiveId: {
|
|
329
|
+
type: 'string',
|
|
330
|
+
description: 'The archive ID returned by open_archive',
|
|
331
|
+
},
|
|
332
|
+
provider: {
|
|
333
|
+
type: 'string',
|
|
334
|
+
description: 'Wappalyzer provider name (e.g. "Google Tag Manager", "Google Analytics 4")',
|
|
335
|
+
},
|
|
336
|
+
externalId: {
|
|
337
|
+
type: 'string',
|
|
338
|
+
description: 'Optional external identifier extracted from the page (GTM-XXXX / G-XXXX / …). Omit for any.',
|
|
339
|
+
},
|
|
340
|
+
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
341
|
+
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
342
|
+
},
|
|
343
|
+
required: ['archiveId', 'provider'],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: 'count_pages_by_tag',
|
|
348
|
+
description: 'Lightweight count-only sibling of `list_pages_by_tag`. Returns `{ pageCount }` for the given provider (and optional `externalId`). Use this to size-check before fetching the full list.',
|
|
349
|
+
inputSchema: {
|
|
350
|
+
type: 'object',
|
|
351
|
+
properties: {
|
|
352
|
+
archiveId: {
|
|
353
|
+
type: 'string',
|
|
354
|
+
description: 'The archive ID returned by open_archive',
|
|
355
|
+
},
|
|
356
|
+
provider: { type: 'string', description: 'Wappalyzer provider name' },
|
|
357
|
+
externalId: {
|
|
358
|
+
type: 'string',
|
|
359
|
+
description: 'Optional external identifier (GTM-XXXX / G-XXXX / …)',
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
required: ['archiveId', 'provider'],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
name: 'list_pages_by_jsonld_type',
|
|
367
|
+
description: 'List pages with at least one JSON-LD entry having the given top-level `@type` (e.g. "Product", "BreadcrumbList", "FAQPage"). Returns the same shape as `list_pages`. Before pulling the full list, consider calling `count_pages_by_jsonld_type` — on an e-commerce site "Product" may match thousands of pages. For full bulk extraction prefer the CLI: `nitpicker query pages-by-jsonld-type --type Product | jq`.',
|
|
368
|
+
inputSchema: {
|
|
369
|
+
type: 'object',
|
|
370
|
+
properties: {
|
|
371
|
+
archiveId: {
|
|
372
|
+
type: 'string',
|
|
373
|
+
description: 'The archive ID returned by open_archive',
|
|
374
|
+
},
|
|
375
|
+
type: {
|
|
376
|
+
type: 'string',
|
|
377
|
+
description: 'Top-level JSON-LD `@type` value to filter by (e.g. "Product")',
|
|
378
|
+
},
|
|
379
|
+
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
380
|
+
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
381
|
+
},
|
|
382
|
+
required: ['archiveId', 'type'],
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: 'count_pages_by_jsonld_type',
|
|
387
|
+
description: 'Lightweight count-only sibling of `list_pages_by_jsonld_type`. Returns `{ pageCount }` for the given JSON-LD `@type`. Use to size-check before fetching the full list.',
|
|
388
|
+
inputSchema: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
properties: {
|
|
391
|
+
archiveId: {
|
|
392
|
+
type: 'string',
|
|
393
|
+
description: 'The archive ID returned by open_archive',
|
|
394
|
+
},
|
|
395
|
+
type: { type: 'string', description: 'Top-level JSON-LD `@type` value' },
|
|
396
|
+
},
|
|
397
|
+
required: ['archiveId', 'type'],
|
|
398
|
+
},
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: 'get_tag_inventory',
|
|
402
|
+
description: 'Returns the site-wide Wappalyzer technology inventory: one entry per detected provider, with the count of distinct pages where it was found, sorted by page count desc. Use as a "what tech does this site use?" answer for audit kick-offs. On 1M-page archives this can be MB-sized; for bulk consumption prefer the CLI: `nitpicker query tag-inventory | jq`.',
|
|
403
|
+
inputSchema: {
|
|
404
|
+
type: 'object',
|
|
405
|
+
properties: {
|
|
406
|
+
archiveId: {
|
|
407
|
+
type: 'string',
|
|
408
|
+
description: 'The archive ID returned by open_archive',
|
|
409
|
+
},
|
|
410
|
+
},
|
|
411
|
+
required: ['archiveId'],
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: 'get_page_jsonld',
|
|
416
|
+
description: 'Returns the JSON-LD / SpeculationRules entries for a page. Defaults to `slim=true` which omits the `raw` JSON text and the `parsed` object — only `kind`, `type`, `rawByteSize`, and `parseError` are returned per entry. Use `slim=false` for full raw payload, but be aware: an e-commerce product page can have 50 schemas × 50KB each. Before requesting `slim=false`, call `get_page_jsonld_overview` to see entry sizes. For full raw bulk extraction prefer the CLI: `nitpicker query page-jsonld --url <URL> --full | jq`.',
|
|
417
|
+
inputSchema: {
|
|
418
|
+
type: 'object',
|
|
419
|
+
properties: {
|
|
420
|
+
archiveId: {
|
|
421
|
+
type: 'string',
|
|
422
|
+
description: 'The archive ID returned by open_archive',
|
|
423
|
+
},
|
|
424
|
+
url: { type: 'string', description: 'The page URL' },
|
|
425
|
+
slim: {
|
|
426
|
+
type: 'boolean',
|
|
427
|
+
description: 'Omit `raw` and `parsed` (default true). Set to false for full payload.',
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
required: ['archiveId', 'url'],
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: 'get_page_jsonld_overview',
|
|
435
|
+
description: 'Lightweight overview of a page\'s JSON-LD: one entry per `<script type="application/ld+json">` or `<script type="speculationrules">` with `kind`, `type`, `rawByteSize`, and `parseError`. Designed as the "metadata before data" probe — see total bytes before fetching the full payload via `get_page_jsonld(slim=false)`.',
|
|
436
|
+
inputSchema: {
|
|
437
|
+
type: 'object',
|
|
438
|
+
properties: {
|
|
439
|
+
archiveId: {
|
|
440
|
+
type: 'string',
|
|
441
|
+
description: 'The archive ID returned by open_archive',
|
|
442
|
+
},
|
|
443
|
+
url: { type: 'string', description: 'The page URL' },
|
|
444
|
+
},
|
|
445
|
+
required: ['archiveId', 'url'],
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
name: 'get_page_tags',
|
|
450
|
+
description: 'Returns the Wappalyzer tag rows for a page (one per provider × external-id), with `categories`, `version`, `confidence`, and `sources` preserved. Use after `get_page_detail` returned a tags summary and you need provider details. Bounded payload (KB-scale per page); no slim mode needed.',
|
|
451
|
+
inputSchema: {
|
|
452
|
+
type: 'object',
|
|
453
|
+
properties: {
|
|
454
|
+
archiveId: {
|
|
455
|
+
type: 'string',
|
|
456
|
+
description: 'The archive ID returned by open_archive',
|
|
457
|
+
},
|
|
458
|
+
url: { type: 'string', description: 'The page URL' },
|
|
459
|
+
},
|
|
460
|
+
required: ['archiveId', 'url'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
294
463
|
{
|
|
295
464
|
name: 'check_headers',
|
|
296
465
|
description: 'Check security HTTP headers (CSP, X-Frame-Options, X-Content-Type-Options, HSTS) for internal pages. Use missingOnly=true to find pages lacking security headers.',
|
|
@@ -311,4 +480,70 @@ export const toolDefinitions = [
|
|
|
311
480
|
required: ['archiveId'],
|
|
312
481
|
},
|
|
313
482
|
},
|
|
483
|
+
{
|
|
484
|
+
name: 'list_isolated_pages',
|
|
485
|
+
description: 'List **完全孤立** — inventory-* HTML pages that form singleton components in the inventory subgraph (no resolved-anchor inbound from any other inventory-* node). `source` is typically `inventory-seed`, but an `inventory-discovered` row can also surface here if its discoverer was later demoted to `crawled` (the crawled-wins downgrade). `crawled` rows never appear here by definition — that label asserts "reachable via the recursive crawl chain", which excludes orphan status. For interconnected orphan groups (size ≥ 2), use `list_isolated_clusters` instead.',
|
|
486
|
+
inputSchema: {
|
|
487
|
+
type: 'object',
|
|
488
|
+
properties: {
|
|
489
|
+
archiveId: {
|
|
490
|
+
type: 'string',
|
|
491
|
+
description: 'The archive ID returned by open_archive',
|
|
492
|
+
},
|
|
493
|
+
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
494
|
+
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
495
|
+
},
|
|
496
|
+
required: ['archiveId'],
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
name: 'list_isolated_clusters',
|
|
501
|
+
description: "List **孤立集合** — connected components of the inventory-* subgraph with size ≥ 2. Each cluster is identified by `representativeUrl` (the lexicographically smallest member URL), with `size` and the representative member's title/status for at-a-glance scanning. Sort: size DESC, representativeUrl ASC. Follow up with `get_isolated_cluster` to fetch the full member list of a specific cluster. Singletons are reported by `list_isolated_pages`; cluster listing omits them so the operator sees interconnected orphan groups (typical: date-series archive pages, paginated category indexes, etc.) without singleton noise.",
|
|
502
|
+
inputSchema: {
|
|
503
|
+
type: 'object',
|
|
504
|
+
properties: {
|
|
505
|
+
archiveId: {
|
|
506
|
+
type: 'string',
|
|
507
|
+
description: 'The archive ID returned by open_archive',
|
|
508
|
+
},
|
|
509
|
+
limit: { type: 'number', description: 'Max clusters to return (default: 100)' },
|
|
510
|
+
offset: { type: 'number', description: 'Clusters to skip (default: 0)' },
|
|
511
|
+
},
|
|
512
|
+
required: ['archiveId'],
|
|
513
|
+
},
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: 'get_isolated_cluster',
|
|
517
|
+
description: "Fetch the full member list of one isolated cluster, identified by its `representativeUrl` (from `list_isolated_clusters`). Returns null when no cluster matches — typically because a follow-up crawl reached one of the cluster's members via the crawled chain, demoting the inventory-* labels and collapsing the cluster. Members are sorted by URL ASC, so `members[0].url === representativeUrl` is invariant.",
|
|
518
|
+
inputSchema: {
|
|
519
|
+
type: 'object',
|
|
520
|
+
properties: {
|
|
521
|
+
archiveId: {
|
|
522
|
+
type: 'string',
|
|
523
|
+
description: 'The archive ID returned by open_archive',
|
|
524
|
+
},
|
|
525
|
+
representativeUrl: {
|
|
526
|
+
type: 'string',
|
|
527
|
+
description: "The cluster's representative URL (returned by list_isolated_clusters).",
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
required: ['archiveId', 'representativeUrl'],
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
name: 'list_unused_resources',
|
|
535
|
+
description: 'List internal sub-resources that no archived page references — candidates for deletion from the server. Each row carries a `source` badge so callers can distinguish files registered via `crawl --inventory` (no page ever loaded them) from files that were once referenced but lost their last referrer.',
|
|
536
|
+
inputSchema: {
|
|
537
|
+
type: 'object',
|
|
538
|
+
properties: {
|
|
539
|
+
archiveId: {
|
|
540
|
+
type: 'string',
|
|
541
|
+
description: 'The archive ID returned by open_archive',
|
|
542
|
+
},
|
|
543
|
+
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
544
|
+
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
545
|
+
},
|
|
546
|
+
required: ['archiveId'],
|
|
547
|
+
},
|
|
548
|
+
},
|
|
314
549
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitpicker/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "MCP server for querying .nitpicker archive files via AI assistants",
|
|
5
5
|
"author": "D-ZERO",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"clean": "tsc --build --clean"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@modelcontextprotocol/sdk": "1.
|
|
35
|
-
"@nitpicker/query": "0.
|
|
34
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
35
|
+
"@nitpicker/query": "0.12.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "58b68416e0b6e3dcdd92772bee754f186a35505f"
|
|
38
38
|
}
|