@nitpicker/mcp-server 0.11.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.
@@ -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, countPagesByJsonLdType, countPagesByTag, findDuplicates, findMismatches, getPageDetail, getPageHtml, getPageJsonLd, getPageJsonLdOverview, getPageTags, getResourceReferrers, getSummary, getTagInventory, getViolations, listImages, listIsolatedPages, listLinks, listPages, listPagesByJsonLdType, listPagesByTag, listResources, listUnusedResources, } 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', 'orphaned'];
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. */
@@ -151,10 +177,11 @@ export function createServer() {
151
177
  case 'list_links': {
152
178
  const accessor = manager.get(requireString(args, 'archiveId'));
153
179
  const type = validateEnum(requireString(args, 'type'), VALID_LINK_TYPES, 'link type');
154
- const linkOpts = omit(args, 'archiveId');
155
180
  return jsonResult(await listLinks(accessor, {
156
- ...linkOpts,
157
181
  type,
182
+ limit: optionalNumber(args, 'limit'),
183
+ offset: optionalNumber(args, 'offset'),
184
+ includeRedirectSources: optionalBoolean(args, 'includeRedirectSources'),
158
185
  }));
159
186
  }
160
187
  case 'list_resources': {
@@ -201,6 +228,21 @@ export function createServer() {
201
228
  offset: optionalNumber(args, 'offset'),
202
229
  }));
203
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
+ }
204
246
  case 'list_unused_resources': {
205
247
  const accessor = manager.get(requireString(args, 'archiveId'));
206
248
  return jsonResult(await listUnusedResources(accessor, {
@@ -159,7 +159,7 @@ export const toolDefinitions = [
159
159
  },
160
160
  {
161
161
  name: 'list_links',
162
- description: 'Analyze links: find broken links (4xx/5xx status), external links, or orphaned pages (no incoming links). Use for link health checks and site structure analysis.',
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.',
163
163
  inputSchema: {
164
164
  type: 'object',
165
165
  properties: {
@@ -169,8 +169,12 @@ export const toolDefinitions = [
169
169
  },
170
170
  type: {
171
171
  type: 'string',
172
- enum: ['broken', 'external', 'orphaned'],
173
- description: 'Type of link analysis: broken (4xx/5xx), external, or orphaned (no inbound links)',
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.',
174
178
  },
175
179
  limit: { type: 'number', description: 'Max results (default: 100)' },
176
180
  offset: { type: 'number', description: 'Results to skip (default: 0)' },
@@ -478,7 +482,7 @@ export const toolDefinitions = [
478
482
  },
479
483
  {
480
484
  name: 'list_isolated_pages',
481
- description: 'List internal HTML pages that no other archived page anchors to (excluding archived roots). These are the "orphan landing pages" the recursive crawl could not reach via the link graph. Combine with `crawl --inventory` to surface pages that only exist on the server but are unreachable from the site map. Each row carries a `source` badge (`crawled` / `inventory-seed` / `inventory-discovered`) indicating how the page entered the archive.',
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.',
482
486
  inputSchema: {
483
487
  type: 'object',
484
488
  properties: {
@@ -492,6 +496,40 @@ export const toolDefinitions = [
492
496
  required: ['archiveId'],
493
497
  },
494
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
+ },
495
533
  {
496
534
  name: 'list_unused_resources',
497
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.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitpicker/mcp-server",
3
- "version": "0.11.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.12.1",
35
- "@nitpicker/query": "0.11.0"
34
+ "@modelcontextprotocol/sdk": "1.29.0",
35
+ "@nitpicker/query": "0.12.0"
36
36
  },
37
- "gitHead": "b11dbe3691746b3cb980476808d1f745bc6d0e98"
37
+ "gitHead": "58b68416e0b6e3dcdd92772bee754f186a35505f"
38
38
  }