@nitpicker/mcp-server 0.13.0 → 0.15.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 CHANGED
@@ -23,18 +23,20 @@ stdio トランスポートで起動し、`.nitpicker` アーカイブを開い
23
23
 
24
24
  ## 主なツール
25
25
 
26
- | ツール | 説明 |
27
- | ----------------- | -------------------------------------------- |
28
- | `open_archive` | `.nitpicker` ファイルを開き、archiveIdを返す |
29
- | `close_archive` | アーカイブを閉じる |
30
- | `get_summary` | サイト全体の概要統計 |
31
- | `list_pages` | ページ一覧 |
32
- | `get_page_detail` | 指定ページの詳細 |
33
- | `get_page_html` | HTMLスナップショット |
34
- | `list_links` | リンク一覧 |
35
- | `list_resources` | リソース一覧 |
36
- | `list_images` | 画像一覧 |
37
- | `get_violations` | 分析プラグインの違反結果 |
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
+ | `list_links` | リンク一覧 |
36
+ | `list_resources` | リソース一覧 |
37
+ | `list_images` | 画像一覧 |
38
+ | `get_violations` | 分析プラグインの違反結果 |
39
+ | `list_console_logs` | 捕捉したconsoleログ・ページエラー(内容ごとに全ページ横断で集約) |
38
40
 
39
41
  ## 関連リンク
40
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, countPagesByJsonLdType, countPagesByTag, getDuplicatesFastPath, getHeaderChecksFastPath, getImagesFastPath, getIsolatedClusterFastPath, getMismatchesFastPath, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageTags, getResourceReferrers, getSummaryFastPath, getTagInventory, getViolations, listIsolatedClustersFastPath, listIsolatedPagesFastPath, listLinks, listPages, listPagesByJsonLdType, listPagesByTag, listResources, listUnusedResources, } from '@nitpicker/query';
4
+ import { ArchiveManager, countPagesByJsonLdType, countPagesByTag, findDuplicateBodies, getDuplicatesFastPath, getHeaderChecksFastPath, getImagesFastPath, getIsolatedClusterFastPath, getMismatchesFastPath, getPageConsoleLogs, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageMainContents, getPageTags, getResourceReferrers, getSummaryFastPath, getTagInventory, getViolations, listConsoleLogs, listInboundLinks, listIsolatedClustersFastPath, listIsolatedPagesFastPath, listLinks, listNetworkOutages, 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.
@@ -186,6 +186,19 @@ export function createServer() {
186
186
  }
187
187
  return jsonResult(result);
188
188
  }
189
+ case 'list_inbound_links': {
190
+ const accessor = manager.get(requireString(args, 'archiveId'));
191
+ const url = requireString(args, 'url');
192
+ const result = await listInboundLinks(accessor, {
193
+ url,
194
+ limit: optionalNumber(args, 'limit'),
195
+ cursor: optionalString(args, 'cursor'),
196
+ });
197
+ if (!result) {
198
+ return textResult('Page not found.');
199
+ }
200
+ return jsonResult(result);
201
+ }
189
202
  case 'get_page_html': {
190
203
  const accessor = manager.get(requireString(args, 'archiveId'));
191
204
  const url = requireString(args, 'url');
@@ -230,6 +243,20 @@ export function createServer() {
230
243
  offset: optionalNumber(args, 'offset'),
231
244
  }));
232
245
  }
246
+ case 'list_console_logs': {
247
+ const accessor = manager.get(requireString(args, 'archiveId'));
248
+ return jsonResult(await listConsoleLogs(accessor, {
249
+ type: optionalString(args, 'type'),
250
+ sortBy: optionalString(args, 'sortBy'),
251
+ sortOrder: optionalString(args, 'sortOrder'),
252
+ limit: optionalNumber(args, 'limit'),
253
+ offset: optionalNumber(args, 'offset'),
254
+ }));
255
+ }
256
+ case 'get_page_console_logs': {
257
+ const accessor = manager.get(requireString(args, 'archiveId'));
258
+ return jsonResult(await getPageConsoleLogs(accessor, requireString(args, 'url')));
259
+ }
233
260
  case 'find_duplicates': {
234
261
  const accessor = manager.get(requireString(args, 'archiveId'));
235
262
  const field = args.field
@@ -243,6 +270,10 @@ export function createServer() {
243
270
  cursor: optionalString(args, 'cursor'),
244
271
  }));
245
272
  }
273
+ case 'find_duplicate_bodies': {
274
+ const accessor = manager.get(requireString(args, 'archiveId'));
275
+ return jsonResult(await findDuplicateBodies(accessor, optionalNumber(args, 'limit'), optionalNumber(args, 'offset')));
276
+ }
246
277
  case 'find_mismatches': {
247
278
  const accessor = manager.get(requireString(args, 'archiveId'));
248
279
  const type = validateEnum(requireString(args, 'type'), VALID_MISMATCH_TYPES, 'mismatch type');
@@ -301,6 +332,13 @@ export function createServer() {
301
332
  offset: optionalNumber(args, 'offset'),
302
333
  }));
303
334
  }
335
+ case 'list_network_outages': {
336
+ const accessor = manager.get(requireString(args, 'archiveId'));
337
+ return jsonResult(await listNetworkOutages(accessor, {
338
+ limit: optionalNumber(args, 'limit'),
339
+ offset: optionalNumber(args, 'offset'),
340
+ }));
341
+ }
304
342
  case 'list_pages_by_tag': {
305
343
  const accessor = manager.get(requireString(args, 'archiveId'));
306
344
  return jsonResult(await listPagesByTag(accessor, {
@@ -348,6 +386,10 @@ export function createServer() {
348
386
  const accessor = manager.get(requireString(args, 'archiveId'));
349
387
  return jsonResult(await getPageTags(accessor, requireString(args, 'url')));
350
388
  }
389
+ case 'get_page_main_contents': {
390
+ const accessor = manager.get(requireString(args, 'archiveId'));
391
+ return jsonResult(await getPageMainContents(accessor, requireString(args, 'url')));
392
+ }
351
393
  default: {
352
394
  return {
353
395
  content: [{ type: 'text', text: `Unknown tool: ${name}` }],
@@ -138,7 +138,7 @@ export const toolDefinitions = [
138
138
  },
139
139
  {
140
140
  name: 'get_page_detail',
141
- 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.',
141
+ 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), main-content **aggregate counts only** (mainContentSelector, mainContentWordCount/BodyWordCount, mainContentHeadingCount/ImageCount/TableCount/ButtonCount/IframeCount/VideoCount/AudioCount/CanvasCount, scrollHeightDesktop/Mobile — null when the page was never rendered), outbound links, redirect sources, response headers, and within-archive timestamps (firstCrawledAt / lastCrawledAt). Inbound links are NOT included here — a page's referrer count can reach the hundreds of thousands on a large site; use `list_inbound_links` instead. Raw JSON-LD entries, full tag rows, and the main-content child-entity arrays are also NOT included — fetch them via `get_page_jsonld` / `get_page_tags` / `get_page_main_contents`. Use when drilling down into a specific page.",
142
142
  inputSchema: {
143
143
  type: 'object',
144
144
  properties: {
@@ -151,6 +151,32 @@ export const toolDefinitions = [
151
151
  required: ['archiveId', 'url'],
152
152
  },
153
153
  },
154
+ {
155
+ name: 'list_inbound_links',
156
+ description: "Find which pages link to a specific page — the reverse of the page's outbound links. Results are bounded and cursor-paginated (default 100 per call) — pass the returned `nextCursor` back in to fetch the rest for a page linked from many pages. Redirect sources and URL-normalization aliases resolve to their canonical page, the same resolution `get_page_detail` applies. Pass `limit: 0` to get only the total referrer count without any rows.",
157
+ inputSchema: {
158
+ type: 'object',
159
+ properties: {
160
+ archiveId: {
161
+ type: 'string',
162
+ description: 'The archive ID returned by open_archive',
163
+ },
164
+ url: {
165
+ type: 'string',
166
+ description: 'The exact URL of the page whose inbound links to list',
167
+ },
168
+ limit: {
169
+ type: 'number',
170
+ description: 'Max referring pages (default: 100; 0 for count only)',
171
+ },
172
+ cursor: {
173
+ type: 'string',
174
+ description: 'Opaque cursor from a previous call, taken from its `nextCursor`',
175
+ },
176
+ },
177
+ required: ['archiveId', 'url'],
178
+ },
179
+ },
154
180
  {
155
181
  name: 'get_page_html',
156
182
  description: 'Retrieve the saved HTML snapshot of a page. Returns the raw HTML content. Use maxLength to limit size for large pages. Useful for inspecting actual page structure and content.',
@@ -290,6 +316,51 @@ export const toolDefinitions = [
290
316
  required: ['archiveId'],
291
317
  },
292
318
  },
319
+ {
320
+ name: 'list_console_logs',
321
+ description: 'List distinct console messages / page errors captured during the crawl, aggregated across every page they occurred on. Each entry reports pageCount (distinct pages) and totalCount (total occurrences) — the same message logged by a shared framework on many pages collapses to one entry. Filter by type (e.g. "error", "warn", "pageerror" for uncaught exceptions). Use for finding site-wide JS errors.',
322
+ inputSchema: {
323
+ type: 'object',
324
+ properties: {
325
+ archiveId: {
326
+ type: 'string',
327
+ description: 'The archive ID returned by open_archive',
328
+ },
329
+ type: {
330
+ type: 'string',
331
+ description: 'Filter by console message type (e.g. "log", "warn", "error", "pageerror" for uncaught exceptions)',
332
+ },
333
+ sortBy: {
334
+ type: 'string',
335
+ enum: ['totalCount', 'pageCount', 'text', 'type'],
336
+ description: 'Sort field (default: totalCount)',
337
+ },
338
+ sortOrder: {
339
+ type: 'string',
340
+ enum: ['asc', 'desc'],
341
+ description: 'Sort direction (default: desc)',
342
+ },
343
+ limit: { type: 'number', description: 'Max results (default: 100)' },
344
+ offset: { type: 'number', description: 'Results to skip (default: 0)' },
345
+ },
346
+ required: ['archiveId'],
347
+ },
348
+ },
349
+ {
350
+ name: 'get_page_console_logs',
351
+ description: 'Get every console message / page error captured for a single page, in capture order. Includes args, source location, and stack trace (for "pageerror" entries).',
352
+ inputSchema: {
353
+ type: 'object',
354
+ properties: {
355
+ archiveId: {
356
+ type: 'string',
357
+ description: 'The archive ID returned by open_archive',
358
+ },
359
+ url: { type: 'string', description: 'The page URL' },
360
+ },
361
+ required: ['archiveId', 'url'],
362
+ },
363
+ },
293
364
  {
294
365
  name: 'find_duplicates',
295
366
  description: 'Find pages with identical title or description. Detects SEO issues where multiple pages share the same metadata. Use for deduplication audits.',
@@ -315,6 +386,22 @@ export const toolDefinitions = [
315
386
  required: ['archiveId'],
316
387
  },
317
388
  },
389
+ {
390
+ name: 'find_duplicate_bodies',
391
+ description: 'Find pages whose rendered <body> content is byte-identical after masking dynamic ids and /index.{ext} URL-suffix variance. Unlike find_duplicates (which compares title/description metadata), this compares actual page content — use it to catch server-side URL normalization gaps, http/https or path-variant duplicate crawls, and pages that dynamically render identical content under different URLs, regardless of HTTP status or hostname.',
392
+ inputSchema: {
393
+ type: 'object',
394
+ properties: {
395
+ archiveId: {
396
+ type: 'string',
397
+ description: 'The archive ID returned by open_archive',
398
+ },
399
+ limit: { type: 'number', description: 'Max duplicate groups (default: 50)' },
400
+ offset: { type: 'number', description: 'Duplicate groups to skip (default: 0)' },
401
+ },
402
+ required: ['archiveId'],
403
+ },
404
+ },
318
405
  {
319
406
  name: 'find_mismatches',
320
407
  description: 'Find metadata mismatches: canonical URL ≠ page URL, og:title ≠ title, og:description ≠ description. Use for SEO consistency checks.',
@@ -514,6 +601,21 @@ export const toolDefinitions = [
514
601
  required: ['archiveId', 'url'],
515
602
  },
516
603
  },
604
+ {
605
+ name: 'get_page_main_contents',
606
+ description: 'Returns the detected main-content region for a page: its identity (nodeName, id, classList, role, a diagnostic selector), aggregate counts already available via get_page_detail (wordCount, bodyWordCount, scrollHeight at desktop/mobile), and full drill-down for all 8 child-entity arrays in DOM order - headings (text + level), images (src + alt), tables (rows/cols/hasHeader/hasFooter/hasMergedCell), buttons (nodeName/role/type/text/disabled), iframes (src/title/width/height), videos (src/poster/width/height), audios (src), canvases (width/height). Returns null only when the page was never rendered (external page, failed scrape). When the page was rendered but beholder found no main-content element, returns a full object with `main: null`, empty child arrays, and `wordCount: 0` (bodyWordCount and scrollHeight still reflect the whole document, since those are measured independently of main-region detection). Use after get_page_detail when you need the actual entries, not just the counts.',
607
+ inputSchema: {
608
+ type: 'object',
609
+ properties: {
610
+ archiveId: {
611
+ type: 'string',
612
+ description: 'The archive ID returned by open_archive',
613
+ },
614
+ url: { type: 'string', description: 'The page URL' },
615
+ },
616
+ required: ['archiveId', 'url'],
617
+ },
618
+ },
517
619
  {
518
620
  name: 'check_headers',
519
621
  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.',
@@ -600,4 +702,20 @@ export const toolDefinitions = [
600
702
  required: ['archiveId'],
601
703
  },
602
704
  },
705
+ {
706
+ name: 'list_network_outages',
707
+ description: 'List recorded operator-network outages — periods where the crawl operator\'s own connectivity, not the target sites, was suspected down and worker fetches were paused. Each row has `started_at` / `ended_at` (epoch ms; `ended_at` is never null — a row left open by a crashed session resolves to the archive\'s last observed activity) and the trigger evidence (`probe_host`, `trigger_error_count`, `trigger_host_count`). Use this to distinguish "this page failed because the target site is down" from "this page failed because our own network was down at the time" — the latter is retried automatically by `crawl --retry-failed` even though its error message classifies as a normally-permanent kind (e.g. `dns`).',
708
+ inputSchema: {
709
+ type: 'object',
710
+ properties: {
711
+ archiveId: {
712
+ type: 'string',
713
+ description: 'The archive ID returned by open_archive',
714
+ },
715
+ limit: { type: 'number', description: 'Max results (default: 100)' },
716
+ offset: { type: 'number', description: 'Results to skip (default: 0)' },
717
+ },
718
+ required: ['archiveId'],
719
+ },
720
+ },
603
721
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitpicker/mcp-server",
3
- "version": "0.13.0",
3
+ "version": "0.15.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",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@modelcontextprotocol/sdk": "1.29.0",
35
- "@nitpicker/query": "0.13.0"
35
+ "@nitpicker/query": "0.15.0"
36
36
  },
37
- "gitHead": "2cd462ea6b183f4462b7caba27b4db04aaba7c70"
37
+ "gitHead": "d1485df6e43375c6a44edfe07a0293fd39d7810d"
38
38
  }