@nitpicker/mcp-server 0.23.0 → 0.24.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 +18 -14
- package/lib/mcp-server.js +105 -5
- package/lib/tool-definitions.js +199 -7
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -23,20 +23,24 @@ stdio トランスポートで起動し、`.nitpicker` アーカイブを開い
|
|
|
23
23
|
|
|
24
24
|
## 主なツール
|
|
25
25
|
|
|
26
|
-
| ツール
|
|
27
|
-
|
|
|
28
|
-
| `open_archive`
|
|
29
|
-
| `close_archive`
|
|
30
|
-
| `get_summary`
|
|
31
|
-
| `list_pages`
|
|
32
|
-
| `get_page_detail`
|
|
33
|
-
| `list_inbound_links`
|
|
34
|
-
| `get_page_html`
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
26
|
+
| ツール | 説明 |
|
|
27
|
+
| ----------------------------- | ----------------------------------------------------------------- |
|
|
28
|
+
| `open_archive` | `.nitpicker` ファイルを開き、archiveIdを返す |
|
|
29
|
+
| `close_archive` | アーカイブを閉じる |
|
|
30
|
+
| `get_summary` | サイト全体の概要統計 |
|
|
31
|
+
| `list_pages` | ページ一覧 |
|
|
32
|
+
| `get_page_detail` | 指定ページの詳細 |
|
|
33
|
+
| `list_inbound_links` | 指定ページへの被リンク一覧 |
|
|
34
|
+
| `get_page_html` | HTMLスナップショット |
|
|
35
|
+
| `search_html` | 保存済みHTMLの文字列/正規表現検索(analyze不要・書き込みなし) |
|
|
36
|
+
| `match_selector` | 保存済みHTMLにCSSセレクタ一致要素を持つページを列挙(構造で探す) |
|
|
37
|
+
| `list_links` | リンク一覧(broken / external / 全件、URLパターンで絞り込み) |
|
|
38
|
+
| `list_resources` | リソース一覧(URLパターン・Content-Typeカテゴリで絞り込み) |
|
|
39
|
+
| `list_pages_by_resource` | 条件に一致するリソースを読み込むページ一覧(フォント利用など) |
|
|
40
|
+
| `get_resource_host_inventory` | リソースのホスト別集計(サードパーティ依存の棚卸し) |
|
|
41
|
+
| `list_images` | 画像一覧 |
|
|
42
|
+
| `get_violations` | 分析プラグインの違反結果 |
|
|
43
|
+
| `list_console_logs` | 捕捉したconsoleログ・ページエラー(内容ごとに全ページ横断で集約) |
|
|
40
44
|
|
|
41
45
|
## 関連リンク
|
|
42
46
|
|
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, countPagesByJsonLdType, countPagesByTechnology, findDuplicateBodies, getDuplicatesFastPath, getHeaderChecksFastPath, getImagesFastPath, getIsolatedClusterFastPath, getMismatchesFastPath, getPageConsoleLogs, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageMainContents, getPageTechnologies, getResourceReferrers, getSummaryFastPath, getTechnologyInventoryFastPath, getViolations, listConsoleLogs, listDedupeCapEvents, listDuplicateBodyClusters, listInboundLinks, listIsolatedClustersFastPath, listIsolatedPagesFastPath, listLinks, listNetworkOutages, listPages, listPagesByJsonLdType, listPagesByTechnology, listResources, listUnusedResources, } from '@nitpicker/query';
|
|
4
|
+
import { ArchiveManager, countPagesByJsonLdType, CONTENT_TYPE_CATEGORIES, countPagesByTechnology, findDuplicateBodies, getDuplicatesFastPath, getHeaderChecksFastPath, getImagesFastPath, getIsolatedClusterFastPath, getMismatchesFastPath, getPageConsoleLogs, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageMainContents, getPageTechnologies, getResourceHostInventory, getResourceReferrers, getSummaryFastPath, getTechnologyInventoryFastPath, getViolations, listConsoleLogs, listDedupeCapEvents, listDuplicateBodyClusters, listInboundLinks, listIsolatedClustersFastPath, listIsolatedPagesFastPath, listLinks, listNetworkOutages, listPages, listPagesByJsonLdType, listPagesByResource, listPagesByTechnology, listResources, listUnusedResources, matchSelector, searchHtml, } from '@nitpicker/query';
|
|
5
5
|
import { formatExtractProgressLine } from './format-extract-progress-line.js';
|
|
6
6
|
import { toolDefinitions } from './tool-definitions.js';
|
|
7
7
|
/**
|
|
@@ -80,7 +80,31 @@ function optionalString(args, key) {
|
|
|
80
80
|
return value;
|
|
81
81
|
}
|
|
82
82
|
/** Valid link analysis types. */
|
|
83
|
-
const VALID_LINK_TYPES = ['broken', 'external'];
|
|
83
|
+
const VALID_LINK_TYPES = ['broken', 'external', 'all'];
|
|
84
|
+
/** Valid sort directions. */
|
|
85
|
+
const VALID_SORT_ORDERS = ['asc', 'desc'];
|
|
86
|
+
/** Valid `list_links` sort fields. */
|
|
87
|
+
const VALID_LINK_SORT_FIELDS = [
|
|
88
|
+
'sourceUrl',
|
|
89
|
+
'destUrl',
|
|
90
|
+
'status',
|
|
91
|
+
'isExternal',
|
|
92
|
+
'textContent',
|
|
93
|
+
];
|
|
94
|
+
/** Valid `list_resources` sort fields. */
|
|
95
|
+
const VALID_RESOURCE_SORT_FIELDS = [
|
|
96
|
+
'url',
|
|
97
|
+
'status',
|
|
98
|
+
'statusText',
|
|
99
|
+
'contentType',
|
|
100
|
+
'contentLength',
|
|
101
|
+
'isExternal',
|
|
102
|
+
'referrerCount',
|
|
103
|
+
'compress',
|
|
104
|
+
'cdn',
|
|
105
|
+
];
|
|
106
|
+
/** Valid `get_resource_host_inventory` sort fields. */
|
|
107
|
+
const VALID_HOST_SORT_FIELDS = ['resourceCount', 'pageCount', 'host'];
|
|
84
108
|
/** Valid mismatch types. */
|
|
85
109
|
const VALID_MISMATCH_TYPES = ['canonical', 'og:title', 'og:description'];
|
|
86
110
|
/** Valid duplicate check fields. */
|
|
@@ -99,6 +123,19 @@ function validateEnum(value, allowed, label) {
|
|
|
99
123
|
}
|
|
100
124
|
return value;
|
|
101
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Extracts an optional string argument that must be one of `allowed`.
|
|
128
|
+
* @param args - The arguments object.
|
|
129
|
+
* @param key - The argument key.
|
|
130
|
+
* @param allowed - The list of allowed values.
|
|
131
|
+
* @param label - A label for the argument (used in error messages).
|
|
132
|
+
* @returns The validated value, or `undefined` if not present.
|
|
133
|
+
* @throws {Error} If the value is present but not in the allowed list.
|
|
134
|
+
*/
|
|
135
|
+
function optionalEnum(args, key, allowed, label) {
|
|
136
|
+
const value = optionalString(args, key);
|
|
137
|
+
return value === undefined ? undefined : validateEnum(value, allowed, label);
|
|
138
|
+
}
|
|
102
139
|
/**
|
|
103
140
|
* Returns a shallow copy of args with the specified keys removed.
|
|
104
141
|
* @param args - The arguments object.
|
|
@@ -241,9 +278,14 @@ export function createServer() {
|
|
|
241
278
|
}
|
|
242
279
|
case 'list_links': {
|
|
243
280
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
244
|
-
const type = validateEnum(requireString(args, 'type'), VALID_LINK_TYPES, 'link type');
|
|
245
281
|
return jsonResult(await listLinks(accessor, {
|
|
246
|
-
type,
|
|
282
|
+
type: optionalEnum(args, 'type', VALID_LINK_TYPES, 'link type'),
|
|
283
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
284
|
+
sourceUrlPattern: optionalString(args, 'sourceUrlPattern'),
|
|
285
|
+
destUrlPattern: optionalString(args, 'destUrlPattern'),
|
|
286
|
+
status: optionalNumber(args, 'status'),
|
|
287
|
+
sortBy: optionalEnum(args, 'sortBy', VALID_LINK_SORT_FIELDS, 'sortBy'),
|
|
288
|
+
sortOrder: optionalEnum(args, 'sortOrder', VALID_SORT_ORDERS, 'sortOrder'),
|
|
247
289
|
limit: optionalNumber(args, 'limit'),
|
|
248
290
|
offset: optionalNumber(args, 'offset'),
|
|
249
291
|
includeRedirectSources: optionalBoolean(args, 'includeRedirectSources'),
|
|
@@ -251,7 +293,65 @@ export function createServer() {
|
|
|
251
293
|
}
|
|
252
294
|
case 'list_resources': {
|
|
253
295
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
254
|
-
return jsonResult(await listResources(accessor,
|
|
296
|
+
return jsonResult(await listResources(accessor, {
|
|
297
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
298
|
+
status: optionalNumber(args, 'status'),
|
|
299
|
+
contentType: optionalString(args, 'contentType'),
|
|
300
|
+
contentTypeCategory: optionalEnum(args, 'contentTypeCategory', CONTENT_TYPE_CATEGORIES, 'contentTypeCategory'),
|
|
301
|
+
isExternal: optionalBoolean(args, 'isExternal'),
|
|
302
|
+
sortBy: optionalEnum(args, 'sortBy', VALID_RESOURCE_SORT_FIELDS, 'sortBy'),
|
|
303
|
+
sortOrder: optionalEnum(args, 'sortOrder', VALID_SORT_ORDERS, 'sortOrder'),
|
|
304
|
+
limit: optionalNumber(args, 'limit'),
|
|
305
|
+
offset: optionalNumber(args, 'offset'),
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
case 'list_pages_by_resource': {
|
|
309
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
310
|
+
const urlPattern = optionalString(args, 'urlPattern');
|
|
311
|
+
const contentTypeCategory = optionalEnum(args, 'contentTypeCategory', CONTENT_TYPE_CATEGORIES, 'contentTypeCategory');
|
|
312
|
+
if (!urlPattern && !contentTypeCategory) {
|
|
313
|
+
throw new Error('At least one of urlPattern or contentTypeCategory is required.');
|
|
314
|
+
}
|
|
315
|
+
return jsonResult(await listPagesByResource(accessor, {
|
|
316
|
+
urlPattern,
|
|
317
|
+
contentTypeCategory,
|
|
318
|
+
isExternal: optionalBoolean(args, 'isExternal'),
|
|
319
|
+
status: optionalNumber(args, 'status'),
|
|
320
|
+
resourcesLimit: optionalNumber(args, 'resourcesLimit'),
|
|
321
|
+
limit: optionalNumber(args, 'limit'),
|
|
322
|
+
offset: optionalNumber(args, 'offset'),
|
|
323
|
+
}));
|
|
324
|
+
}
|
|
325
|
+
case 'get_resource_host_inventory': {
|
|
326
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
327
|
+
return jsonResult(await getResourceHostInventory(accessor, {
|
|
328
|
+
isExternal: optionalBoolean(args, 'isExternal'),
|
|
329
|
+
sortBy: optionalEnum(args, 'sortBy', VALID_HOST_SORT_FIELDS, 'sortBy'),
|
|
330
|
+
sortOrder: optionalEnum(args, 'sortOrder', VALID_SORT_ORDERS, 'sortOrder'),
|
|
331
|
+
limit: optionalNumber(args, 'limit'),
|
|
332
|
+
offset: optionalNumber(args, 'offset'),
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
case 'search_html': {
|
|
336
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
337
|
+
return jsonResult(await searchHtml(accessor, {
|
|
338
|
+
pattern: requireString(args, 'pattern'),
|
|
339
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
340
|
+
directory: optionalString(args, 'directory'),
|
|
341
|
+
snippetLength: optionalNumber(args, 'snippetLength'),
|
|
342
|
+
limit: optionalNumber(args, 'limit'),
|
|
343
|
+
offset: optionalNumber(args, 'offset'),
|
|
344
|
+
}));
|
|
345
|
+
}
|
|
346
|
+
case 'match_selector': {
|
|
347
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
348
|
+
return jsonResult(await matchSelector(accessor, {
|
|
349
|
+
selector: requireString(args, 'selector'),
|
|
350
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
351
|
+
directory: optionalString(args, 'directory'),
|
|
352
|
+
limit: optionalNumber(args, 'limit'),
|
|
353
|
+
offset: optionalNumber(args, 'offset'),
|
|
354
|
+
}));
|
|
255
355
|
}
|
|
256
356
|
case 'list_images': {
|
|
257
357
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
package/lib/tool-definitions.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CONTENT_TYPE_CATEGORIES, SUPPORTED_SELECTOR_GRAMMAR } from '@nitpicker/query';
|
|
1
2
|
/**
|
|
2
3
|
* All MCP tool definitions for the Nitpicker archive query server.
|
|
3
4
|
* Each tool includes a name, description with LLM guidance, and JSON Schema
|
|
@@ -139,7 +140,10 @@ export const toolDefinitions = [
|
|
|
139
140
|
type: 'string',
|
|
140
141
|
description: 'URL pattern to search (SQL LIKE: use % as wildcard)',
|
|
141
142
|
},
|
|
142
|
-
directory: {
|
|
143
|
+
directory: {
|
|
144
|
+
type: 'string',
|
|
145
|
+
description: 'Directory to filter by: the page itself and everything under it ("/blog" matches /blog and /blog/post, not /blogging or /en/blog/). A full URL ("https://example.com/blog") also restricts the host.',
|
|
146
|
+
},
|
|
143
147
|
sortBy: {
|
|
144
148
|
type: 'string',
|
|
145
149
|
enum: ['url', 'status', 'title'],
|
|
@@ -231,8 +235,34 @@ export const toolDefinitions = [
|
|
|
231
235
|
},
|
|
232
236
|
type: {
|
|
233
237
|
type: 'string',
|
|
234
|
-
enum: ['broken', 'external'],
|
|
235
|
-
description: 'Type of link analysis: broken (canonical destination is exactly HTTP 404)
|
|
238
|
+
enum: ['broken', 'external', 'all'],
|
|
239
|
+
description: 'Type of link analysis: broken (canonical destination is exactly HTTP 404), external (anchor leaves the in-scope hostname), or all (no type restriction — the default). Judged against the redirect-resolved canonical destination by default.',
|
|
240
|
+
},
|
|
241
|
+
urlPattern: {
|
|
242
|
+
type: 'string',
|
|
243
|
+
description: 'SQL LIKE pattern matched against the source URL OR the destination URL (e.g. "%/blog/%").',
|
|
244
|
+
},
|
|
245
|
+
sourceUrlPattern: {
|
|
246
|
+
type: 'string',
|
|
247
|
+
description: 'SQL LIKE pattern restricted to the source page URL.',
|
|
248
|
+
},
|
|
249
|
+
destUrlPattern: {
|
|
250
|
+
type: 'string',
|
|
251
|
+
description: 'SQL LIKE pattern restricted to the (redirect-resolved) destination URL. Example: "%.pdf" lists every link pointing at a PDF.',
|
|
252
|
+
},
|
|
253
|
+
status: {
|
|
254
|
+
type: 'number',
|
|
255
|
+
description: 'Filter by the destination HTTP status (exact match).',
|
|
256
|
+
},
|
|
257
|
+
sortBy: {
|
|
258
|
+
type: 'string',
|
|
259
|
+
enum: ['sourceUrl', 'destUrl', 'status', 'isExternal', 'textContent'],
|
|
260
|
+
description: 'Field to sort by (default: sourceUrl).',
|
|
261
|
+
},
|
|
262
|
+
sortOrder: {
|
|
263
|
+
type: 'string',
|
|
264
|
+
enum: ['asc', 'desc'],
|
|
265
|
+
description: 'Sort direction.',
|
|
236
266
|
},
|
|
237
267
|
includeRedirectSources: {
|
|
238
268
|
type: 'boolean',
|
|
@@ -241,12 +271,12 @@ export const toolDefinitions = [
|
|
|
241
271
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
242
272
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
243
273
|
},
|
|
244
|
-
required: ['archiveId'
|
|
274
|
+
required: ['archiveId'],
|
|
245
275
|
},
|
|
246
276
|
},
|
|
247
277
|
{
|
|
248
278
|
name: 'list_resources',
|
|
249
|
-
description: 'List sub-resources (CSS, JS, images, fonts) with filtering by content type and origin. Shows compression and
|
|
279
|
+
description: 'List sub-resources (CSS, JS, images, fonts) with filtering by URL pattern, status, content type (prefix or category) and origin. Shows compression, CDN status and referrer count. Use for tech stack analysis, library detection (jQuery, React), web font inventory (contentTypeCategory "font"), and performance checks. Only resource metadata is stored — CSS/JS bodies are not, so @font-face / font-family inside a stylesheet cannot be searched; font FILES the browser fetched are listed here, and `list_pages_by_resource` finds the pages that load them. To find which pages use a given resource, use `list_pages_by_resource` or `get_resource_referrers`.',
|
|
250
280
|
inputSchema: {
|
|
251
281
|
type: 'object',
|
|
252
282
|
properties: {
|
|
@@ -254,20 +284,182 @@ export const toolDefinitions = [
|
|
|
254
284
|
type: 'string',
|
|
255
285
|
description: 'The archive ID returned by open_archive',
|
|
256
286
|
},
|
|
287
|
+
urlPattern: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
description: 'SQL LIKE pattern matched against the resource URL (e.g. "%fonts.example.net%", "%jquery%.js").',
|
|
290
|
+
},
|
|
291
|
+
status: { type: 'number', description: 'Filter by HTTP status (exact match).' },
|
|
257
292
|
contentType: {
|
|
258
293
|
type: 'string',
|
|
259
294
|
description: 'Filter by content type prefix (e.g., "text/css", "application/javascript")',
|
|
260
295
|
},
|
|
296
|
+
contentTypeCategory: {
|
|
297
|
+
type: 'string',
|
|
298
|
+
enum: [...CONTENT_TYPE_CATEGORIES],
|
|
299
|
+
description: 'Filter by Content-Type category (e.g. "font" covers font/*, application/font-*, application/vnd.ms-fontobject). ANDed with contentType.',
|
|
300
|
+
},
|
|
261
301
|
isExternal: {
|
|
262
302
|
type: 'boolean',
|
|
263
303
|
description: 'Filter by external (true) or internal (false)',
|
|
264
304
|
},
|
|
305
|
+
sortBy: {
|
|
306
|
+
type: 'string',
|
|
307
|
+
enum: [
|
|
308
|
+
'url',
|
|
309
|
+
'status',
|
|
310
|
+
'statusText',
|
|
311
|
+
'contentType',
|
|
312
|
+
'contentLength',
|
|
313
|
+
'isExternal',
|
|
314
|
+
'referrerCount',
|
|
315
|
+
'compress',
|
|
316
|
+
'cdn',
|
|
317
|
+
],
|
|
318
|
+
description: 'Field to sort by (default: url).',
|
|
319
|
+
},
|
|
320
|
+
sortOrder: {
|
|
321
|
+
type: 'string',
|
|
322
|
+
enum: ['asc', 'desc'],
|
|
323
|
+
description: 'Sort direction.',
|
|
324
|
+
},
|
|
265
325
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
266
326
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
267
327
|
},
|
|
268
328
|
required: ['archiveId'],
|
|
269
329
|
},
|
|
270
330
|
},
|
|
331
|
+
{
|
|
332
|
+
name: 'list_pages_by_resource',
|
|
333
|
+
description: 'List the pages that load at least one resource matching a URL pattern and/or Content-Type category — the reverse of `list_resources`. Answers "which pages use a web font" (contentTypeCategory "font"), "which pages load anything from fonts.example.net" (urlPattern "%fonts.example.net%"), or "which pages include jquery" (urlPattern "%jquery%"). Works on resource URLs/MIME types the browser actually fetched; resource bodies are not stored, so it cannot see @font-face rules that were never fetched. At least one of urlPattern / contentTypeCategory is required. Each page carries matchedResourceCount and a bounded sample of matched resource URLs (resourcesLimit). For an exact resource URL use `get_resource_referrers`.',
|
|
334
|
+
inputSchema: {
|
|
335
|
+
type: 'object',
|
|
336
|
+
properties: {
|
|
337
|
+
archiveId: {
|
|
338
|
+
type: 'string',
|
|
339
|
+
description: 'The archive ID returned by open_archive',
|
|
340
|
+
},
|
|
341
|
+
urlPattern: {
|
|
342
|
+
type: 'string',
|
|
343
|
+
description: 'SQL LIKE pattern matched against the resource URL.',
|
|
344
|
+
},
|
|
345
|
+
contentTypeCategory: {
|
|
346
|
+
type: 'string',
|
|
347
|
+
enum: [...CONTENT_TYPE_CATEGORIES],
|
|
348
|
+
description: 'Restrict to resources of this Content-Type category.',
|
|
349
|
+
},
|
|
350
|
+
isExternal: {
|
|
351
|
+
type: 'boolean',
|
|
352
|
+
description: 'Restrict to external (true) or internal (false) resources.',
|
|
353
|
+
},
|
|
354
|
+
status: { type: 'number', description: 'Restrict to this resource HTTP status.' },
|
|
355
|
+
resourcesLimit: {
|
|
356
|
+
type: 'number',
|
|
357
|
+
description: 'Max matched resource URLs sampled per page (default: 20)',
|
|
358
|
+
},
|
|
359
|
+
limit: { type: 'number', description: 'Max pages (default: 100)' },
|
|
360
|
+
offset: { type: 'number', description: 'Pages to skip (default: 0)' },
|
|
361
|
+
},
|
|
362
|
+
required: ['archiveId'],
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
name: 'get_resource_host_inventory',
|
|
367
|
+
description: 'Aggregate sub-resources by serving host (host + port): distinct resource count, distinct referencing page count, and the Content-Type category mix per host. Use for third-party dependency questions ("which external hosts does the site load scripts/fonts from?") in one call instead of paging through `list_resources`. Resources whose URL is a large data: URI have no host and are excluded.',
|
|
368
|
+
inputSchema: {
|
|
369
|
+
type: 'object',
|
|
370
|
+
properties: {
|
|
371
|
+
archiveId: {
|
|
372
|
+
type: 'string',
|
|
373
|
+
description: 'The archive ID returned by open_archive',
|
|
374
|
+
},
|
|
375
|
+
isExternal: {
|
|
376
|
+
type: 'boolean',
|
|
377
|
+
description: 'Restrict to external (true) or internal (false) resources.',
|
|
378
|
+
},
|
|
379
|
+
sortBy: {
|
|
380
|
+
type: 'string',
|
|
381
|
+
enum: ['resourceCount', 'pageCount', 'host'],
|
|
382
|
+
description: 'Field to sort by (default: resourceCount, descending).',
|
|
383
|
+
},
|
|
384
|
+
sortOrder: {
|
|
385
|
+
type: 'string',
|
|
386
|
+
enum: ['asc', 'desc'],
|
|
387
|
+
description: 'Sort direction.',
|
|
388
|
+
},
|
|
389
|
+
limit: { type: 'number', description: 'Max hosts (default: 100)' },
|
|
390
|
+
offset: { type: 'number', description: 'Hosts to skip (default: 0)' },
|
|
391
|
+
},
|
|
392
|
+
required: ['archiveId'],
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
name: 'search_html',
|
|
397
|
+
description: 'Search the stored HTML snapshots of all pages for a string or regular expression, WITHOUT running an analyze plugin and without writing to the archive. The search runs on the raw markup `get_page_html` returns, so <script>, <style>, inline style and every attribute are searchable (e.g. `fonts.example.org`, `font-family`, `gtag(`, `/UA-\\d+-\\d+/`) — unlike the analyze-search plugin, which matches DOM text nodes only. `pattern` is a plain literal substring, or `/regex/flags` (flags g, i, m) for a regular expression. Returns matching pages in page-id order with matchCount and a whitespace-collapsed snippet around the first hit, plus `total`, `scannedSnapshots` and `candidatePages` (in-scope pages with a stored snapshot; if it is 0 or far below the page count, HTML was not stored and "no match" is meaningless). This is a linear scan over every distinct snapshot, so large archives can take tens of seconds: call once with `limit: 0` to size `total`, narrow with urlPattern/directory, and prefer the CLI for bulk extraction: `nitpicker query <file> search-html --pattern "..." | jq`. Cannot search CSS/JS file bodies (not stored). To find pages by DOM structure (a CSS selector) rather than by text, use `match_selector`.',
|
|
398
|
+
inputSchema: {
|
|
399
|
+
type: 'object',
|
|
400
|
+
properties: {
|
|
401
|
+
archiveId: {
|
|
402
|
+
type: 'string',
|
|
403
|
+
description: 'The archive ID returned by open_archive',
|
|
404
|
+
},
|
|
405
|
+
pattern: {
|
|
406
|
+
type: 'string',
|
|
407
|
+
description: 'Literal substring, or /regex/flags (flags g, i, m) for a regular expression.',
|
|
408
|
+
},
|
|
409
|
+
urlPattern: {
|
|
410
|
+
type: 'string',
|
|
411
|
+
description: 'SQL LIKE pattern restricting the page URLs to scan.',
|
|
412
|
+
},
|
|
413
|
+
directory: {
|
|
414
|
+
type: 'string',
|
|
415
|
+
description: 'Directory the scanned pages must be in or under, with the same meaning as list_pages (e.g. "/blog").',
|
|
416
|
+
},
|
|
417
|
+
snippetLength: {
|
|
418
|
+
type: 'number',
|
|
419
|
+
description: 'Snippet window size in characters (default: 160)',
|
|
420
|
+
},
|
|
421
|
+
limit: {
|
|
422
|
+
type: 'number',
|
|
423
|
+
description: 'Max matching pages (default: 100). 0 returns only the counts.',
|
|
424
|
+
},
|
|
425
|
+
offset: { type: 'number', description: 'Matching pages to skip (default: 0)' },
|
|
426
|
+
},
|
|
427
|
+
required: ['archiveId', 'pattern'],
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
name: 'match_selector',
|
|
432
|
+
description: 'Find pages whose stored HTML snapshot contains at least one element matching a CSS selector (e.g. `img:not([alt])`, `nav > a[href^="/products/"]`, `a[target="_blank"]:not([rel~="noopener"])`), WITHOUT running an analyze plugin and without writing to the archive. Use it to search by DOM structure; use `search_html` to search by text. It is an existence check per page: matching element positions and counts are not returned. Returns matching pages in page-id order as `{ pageId, url }`, plus `total`, `scannedSnapshots` and `candidatePages` (in-scope pages with a stored snapshot; if it is 0 or far below the page count, HTML was not stored and "no match" is meaningless). Only the subset of CSS that can be evaluated exactly in a single pass over the markup is supported; anything else is rejected with an error that lists this grammar, never approximated.\n\n' +
|
|
433
|
+
SUPPORTED_SELECTOR_GRAMMAR +
|
|
434
|
+
'\n\nThis is a linear scan over every distinct snapshot, so large archives can take tens of seconds: call once with `limit: 0` to size `total`, narrow with urlPattern/directory, and prefer the CLI for bulk extraction: `nitpicker query <file> match-selector --selector "..." | jq`. Cannot inspect CSS/JS file bodies (not stored).',
|
|
435
|
+
inputSchema: {
|
|
436
|
+
type: 'object',
|
|
437
|
+
properties: {
|
|
438
|
+
archiveId: {
|
|
439
|
+
type: 'string',
|
|
440
|
+
description: 'The archive ID returned by open_archive',
|
|
441
|
+
},
|
|
442
|
+
selector: {
|
|
443
|
+
type: 'string',
|
|
444
|
+
description: 'CSS selector list to look for in the stored HTML (comma-separated alternatives allowed). Limited to the supported grammar described above.',
|
|
445
|
+
},
|
|
446
|
+
urlPattern: {
|
|
447
|
+
type: 'string',
|
|
448
|
+
description: 'SQL LIKE pattern restricting the page URLs to scan.',
|
|
449
|
+
},
|
|
450
|
+
directory: {
|
|
451
|
+
type: 'string',
|
|
452
|
+
description: 'Directory the scanned pages must be in or under, with the same meaning as list_pages (e.g. "/blog").',
|
|
453
|
+
},
|
|
454
|
+
limit: {
|
|
455
|
+
type: 'number',
|
|
456
|
+
description: 'Max matching pages (default: 100). 0 returns only the counts.',
|
|
457
|
+
},
|
|
458
|
+
offset: { type: 'number', description: 'Matching pages to skip (default: 0)' },
|
|
459
|
+
},
|
|
460
|
+
required: ['archiveId', 'selector'],
|
|
461
|
+
},
|
|
462
|
+
},
|
|
271
463
|
{
|
|
272
464
|
name: 'list_images',
|
|
273
465
|
description: 'List images with quality checks: missing alt text, missing width/height dimensions, oversized images (exceeding threshold). Use for accessibility and performance auditing.',
|
|
@@ -302,7 +494,7 @@ export const toolDefinitions = [
|
|
|
302
494
|
},
|
|
303
495
|
{
|
|
304
496
|
name: 'get_violations',
|
|
305
|
-
description: 'Get analysis violations from plugins (axe, markuplint, textlint
|
|
497
|
+
description: 'Get analysis violations from plugins (axe, markuplint, textlint). Filter by validator, severity, or rule. Use for accessibility and code quality reports.',
|
|
306
498
|
inputSchema: {
|
|
307
499
|
type: 'object',
|
|
308
500
|
properties: {
|
|
@@ -312,7 +504,7 @@ export const toolDefinitions = [
|
|
|
312
504
|
},
|
|
313
505
|
validator: {
|
|
314
506
|
type: 'string',
|
|
315
|
-
description: 'Filter by validator name (e.g., "axe", "markuplint", "textlint"
|
|
507
|
+
description: 'Filter by validator name (e.g., "axe", "markuplint", "textlint")',
|
|
316
508
|
},
|
|
317
509
|
severity: { type: 'string', description: 'Filter by severity level' },
|
|
318
510
|
rule: { type: 'string', description: 'Filter by rule ID' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nitpicker/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.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",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"clean": "tsc --build --clean"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@modelcontextprotocol/sdk": "1.
|
|
38
|
-
"@nitpicker/query": "0.
|
|
37
|
+
"@modelcontextprotocol/sdk": "1.31.0",
|
|
38
|
+
"@nitpicker/query": "0.24.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "840a594573c4abe0aaff1257469b7f2108fcdb19"
|
|
41
41
|
}
|