@nitpicker/mcp-server 0.11.0 → 0.13.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 +25 -27
- package/lib/mcp-server.d.ts +28 -1
- package/lib/mcp-server.js +116 -15
- package/lib/tool-definitions.js +98 -6
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,35 +1,12 @@
|
|
|
1
1
|
# @nitpicker/mcp-server
|
|
2
2
|
|
|
3
|
-
`.nitpicker`
|
|
3
|
+
`.nitpicker` アーカイブを Model Context Protocol (MCP) 経由で問い合わせるためのサーバーです。
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[Model Context Protocol (MCP)](https://modelcontextprotocol.io/) を介して、`.nitpicker` アーカイブの内容を AI アシスタント(Claude Desktop 等)から直接クエリできるサーバーです。stdio トランスポートで動作し、14 のツールを提供します。
|
|
8
|
-
|
|
9
|
-
内部では `@nitpicker/query` パッケージのクエリ関数を呼び出しています。
|
|
10
|
-
|
|
11
|
-
### 提供ツール
|
|
12
|
-
|
|
13
|
-
| ツール | 説明 |
|
|
14
|
-
| ------------------------ | ---------------------------------------------------- |
|
|
15
|
-
| `open_archive` | `.nitpicker` ファイルを読み込み、archiveId を返す |
|
|
16
|
-
| `close_archive` | アーカイブを閉じてリソースを解放 |
|
|
17
|
-
| `get_summary` | サイト全体の概要統計 |
|
|
18
|
-
| `list_pages` | ページ一覧(フィルタ・ソート・ページネーション対応) |
|
|
19
|
-
| `get_page_detail` | 特定ページの詳細情報 |
|
|
20
|
-
| `get_page_html` | HTML スナップショットの取得 |
|
|
21
|
-
| `list_links` | リンク分析(壊れたリンク、外部リンク、孤立ページ) |
|
|
22
|
-
| `list_resources` | サブリソース一覧(CSS、JS、画像、フォント) |
|
|
23
|
-
| `list_images` | 画像品質チェック(alt 欠落、サイズ欠落、過大画像) |
|
|
24
|
-
| `get_violations` | 分析プラグインの違反結果 |
|
|
25
|
-
| `find_duplicates` | メタデータ重複検出 |
|
|
26
|
-
| `find_mismatches` | メタデータ不一致検出 |
|
|
27
|
-
| `get_resource_referrers` | リソース参照元ページの検出 |
|
|
28
|
-
| `check_headers` | セキュリティヘッダー確認 |
|
|
5
|
+
内部では [@nitpicker/query](../query/README.md) を使い、AIアシスタントなどからアーカイブ内容を参照できるようにします。
|
|
29
6
|
|
|
30
7
|
## セットアップ
|
|
31
8
|
|
|
32
|
-
Claude Desktop
|
|
9
|
+
Claude Desktop の設定ファイルに以下を追加します。
|
|
33
10
|
|
|
34
11
|
```json
|
|
35
12
|
{
|
|
@@ -42,7 +19,28 @@ Claude Desktop の設定ファイルに以下を追加してください。
|
|
|
42
19
|
}
|
|
43
20
|
```
|
|
44
21
|
|
|
45
|
-
|
|
22
|
+
stdio トランスポートで起動し、`.nitpicker` アーカイブを開いてページ、リンク、リソース、分析結果などを問い合わせます。
|
|
23
|
+
|
|
24
|
+
## 主なツール
|
|
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` | 分析プラグインの違反結果 |
|
|
38
|
+
|
|
39
|
+
## 関連リンク
|
|
40
|
+
|
|
41
|
+
- [Nitpicker README](../../../README.md)
|
|
42
|
+
- [CLI query docs](../cli/docs/query.md)
|
|
43
|
+
- [ARCHITECTURE.md](../../../ARCHITECTURE.md)
|
|
46
44
|
|
|
47
45
|
## ライセンス
|
|
48
46
|
|
package/lib/mcp-server.d.ts
CHANGED
|
@@ -3,7 +3,15 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
3
3
|
* Creates and configures the Nitpicker MCP server with all tools registered.
|
|
4
4
|
* Uses the low-level Server API to avoid deep type instantiation issues
|
|
5
5
|
* with McpServer + Zod schemas.
|
|
6
|
-
* @returns The configured Server instance.
|
|
6
|
+
* @returns The configured Server instance. Connect it to a transport to start serving.
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { createServer } from '@nitpicker/mcp-server';
|
|
10
|
+
* import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
11
|
+
*
|
|
12
|
+
* const server = createServer();
|
|
13
|
+
* await server.connect(new StdioServerTransport());
|
|
14
|
+
* ```
|
|
7
15
|
*/
|
|
8
16
|
export declare function createServer(): Server<{
|
|
9
17
|
method: string;
|
|
@@ -12,6 +20,9 @@ export declare function createServer(): Server<{
|
|
|
12
20
|
_meta?: {
|
|
13
21
|
[x: string]: unknown;
|
|
14
22
|
progressToken?: string | number | undefined;
|
|
23
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
24
|
+
taskId: string;
|
|
25
|
+
} | undefined;
|
|
15
26
|
} | undefined;
|
|
16
27
|
} | undefined;
|
|
17
28
|
}, {
|
|
@@ -20,16 +31,32 @@ export declare function createServer(): Server<{
|
|
|
20
31
|
[x: string]: unknown;
|
|
21
32
|
_meta?: {
|
|
22
33
|
[x: string]: unknown;
|
|
34
|
+
progressToken?: string | number | undefined;
|
|
35
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
36
|
+
taskId: string;
|
|
37
|
+
} | undefined;
|
|
23
38
|
} | undefined;
|
|
24
39
|
} | undefined;
|
|
25
40
|
}, {
|
|
26
41
|
[x: string]: unknown;
|
|
27
42
|
_meta?: {
|
|
28
43
|
[x: string]: unknown;
|
|
44
|
+
progressToken?: string | number | undefined;
|
|
45
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
46
|
+
taskId: string;
|
|
47
|
+
} | undefined;
|
|
29
48
|
} | undefined;
|
|
30
49
|
}>;
|
|
31
50
|
/**
|
|
32
51
|
* Starts the MCP server using stdio transport.
|
|
33
52
|
* This is the entry point for the `nitpicker-mcp` binary.
|
|
53
|
+
* @returns Resolves once the stdio transport is connected; the server then
|
|
54
|
+
* keeps serving requests until the process exits.
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* import { startServer } from '@nitpicker/mcp-server';
|
|
58
|
+
*
|
|
59
|
+
* await startServer();
|
|
60
|
+
* ```
|
|
34
61
|
*/
|
|
35
62
|
export declare function startServer(): Promise<void>;
|
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,
|
|
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';
|
|
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,51 @@ 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
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Extracts an optional string argument with validation.
|
|
66
|
+
* @param args - The arguments object.
|
|
67
|
+
* @param key - The argument key.
|
|
68
|
+
* @returns The string value, or `undefined` if not present.
|
|
69
|
+
* @throws {TypeError} If the value is present but not a string.
|
|
70
|
+
*/
|
|
71
|
+
function optionalString(args, key) {
|
|
72
|
+
const value = args[key];
|
|
73
|
+
if (value == null) {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
if (typeof value !== 'string') {
|
|
77
|
+
throw new TypeError(`Invalid string for argument: ${key}`);
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
38
81
|
/** Valid link analysis types. */
|
|
39
|
-
const VALID_LINK_TYPES = ['broken', 'external'
|
|
82
|
+
const VALID_LINK_TYPES = ['broken', 'external'];
|
|
40
83
|
/** Valid mismatch types. */
|
|
41
84
|
const VALID_MISMATCH_TYPES = ['canonical', 'og:title', 'og:description'];
|
|
42
85
|
/** Valid duplicate check fields. */
|
|
@@ -74,7 +117,15 @@ function omit(args, ...keys) {
|
|
|
74
117
|
* Creates and configures the Nitpicker MCP server with all tools registered.
|
|
75
118
|
* Uses the low-level Server API to avoid deep type instantiation issues
|
|
76
119
|
* with McpServer + Zod schemas.
|
|
77
|
-
* @returns The configured Server instance.
|
|
120
|
+
* @returns The configured Server instance. Connect it to a transport to start serving.
|
|
121
|
+
* @example
|
|
122
|
+
* ```ts
|
|
123
|
+
* import { createServer } from '@nitpicker/mcp-server';
|
|
124
|
+
* import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
125
|
+
*
|
|
126
|
+
* const server = createServer();
|
|
127
|
+
* await server.connect(new StdioServerTransport());
|
|
128
|
+
* ```
|
|
78
129
|
*/
|
|
79
130
|
export function createServer() {
|
|
80
131
|
// Route ArchiveManager warnings to stderr explicitly via process.stderr.write
|
|
@@ -88,7 +139,7 @@ export function createServer() {
|
|
|
88
139
|
process.stderr.write(`${message}\n`);
|
|
89
140
|
},
|
|
90
141
|
});
|
|
91
|
-
const server = new Server({ name: 'nitpicker', version: '0.
|
|
142
|
+
const server = new Server({ name: 'nitpicker', version: '0.13.0' }, { capabilities: { tools: {} } });
|
|
92
143
|
server.setRequestHandler(ListToolsRequestSchema, () => Promise.resolve({ tools: toolDefinitions }));
|
|
93
144
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
94
145
|
const { name } = request.params;
|
|
@@ -98,7 +149,7 @@ export function createServer() {
|
|
|
98
149
|
case 'open_archive': {
|
|
99
150
|
const filePath = requireString(args, 'filePath');
|
|
100
151
|
const { archiveId, accessor, mode, crawlerLockHolder } = await manager.open(filePath);
|
|
101
|
-
const summary = await
|
|
152
|
+
const summary = await getSummaryFastPath(accessor);
|
|
102
153
|
return jsonResult({
|
|
103
154
|
archiveId,
|
|
104
155
|
baseUrl: summary.baseUrl,
|
|
@@ -120,7 +171,7 @@ export function createServer() {
|
|
|
120
171
|
}
|
|
121
172
|
case 'get_summary': {
|
|
122
173
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
123
|
-
return jsonResult(await
|
|
174
|
+
return jsonResult(await getSummaryFastPath(accessor));
|
|
124
175
|
}
|
|
125
176
|
case 'list_pages': {
|
|
126
177
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
@@ -151,10 +202,11 @@ export function createServer() {
|
|
|
151
202
|
case 'list_links': {
|
|
152
203
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
153
204
|
const type = validateEnum(requireString(args, 'type'), VALID_LINK_TYPES, 'link type');
|
|
154
|
-
const linkOpts = omit(args, 'archiveId');
|
|
155
205
|
return jsonResult(await listLinks(accessor, {
|
|
156
|
-
...linkOpts,
|
|
157
206
|
type,
|
|
207
|
+
limit: optionalNumber(args, 'limit'),
|
|
208
|
+
offset: optionalNumber(args, 'offset'),
|
|
209
|
+
includeRedirectSources: optionalBoolean(args, 'includeRedirectSources'),
|
|
158
210
|
}));
|
|
159
211
|
}
|
|
160
212
|
case 'list_resources': {
|
|
@@ -163,28 +215,54 @@ export function createServer() {
|
|
|
163
215
|
}
|
|
164
216
|
case 'list_images': {
|
|
165
217
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
166
|
-
return jsonResult(await
|
|
218
|
+
return jsonResult(await getImagesFastPath(accessor, omit(args, 'archiveId')));
|
|
167
219
|
}
|
|
168
220
|
case 'get_violations': {
|
|
169
221
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
170
|
-
return jsonResult(await getViolations(accessor,
|
|
222
|
+
return jsonResult(await getViolations(accessor, {
|
|
223
|
+
validator: optionalString(args, 'validator'),
|
|
224
|
+
severity: optionalString(args, 'severity'),
|
|
225
|
+
rule: optionalString(args, 'rule'),
|
|
226
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
227
|
+
sortBy: optionalString(args, 'sortBy'),
|
|
228
|
+
sortOrder: optionalString(args, 'sortOrder'),
|
|
229
|
+
limit: optionalNumber(args, 'limit'),
|
|
230
|
+
offset: optionalNumber(args, 'offset'),
|
|
231
|
+
}));
|
|
171
232
|
}
|
|
172
233
|
case 'find_duplicates': {
|
|
173
234
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
174
235
|
const field = args.field
|
|
175
236
|
? validateEnum(String(args.field), VALID_DUPLICATE_FIELDS, 'field')
|
|
176
237
|
: undefined;
|
|
177
|
-
return jsonResult(await
|
|
238
|
+
return jsonResult(await getDuplicatesFastPath(accessor, {
|
|
239
|
+
field,
|
|
240
|
+
limit: optionalNumber(args, 'limit'),
|
|
241
|
+
offset: optionalNumber(args, 'offset'),
|
|
242
|
+
pagesLimit: optionalNumber(args, 'pagesLimit'),
|
|
243
|
+
cursor: optionalString(args, 'cursor'),
|
|
244
|
+
}));
|
|
178
245
|
}
|
|
179
246
|
case 'find_mismatches': {
|
|
180
247
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
181
248
|
const type = validateEnum(requireString(args, 'type'), VALID_MISMATCH_TYPES, 'mismatch type');
|
|
182
|
-
return jsonResult(await
|
|
249
|
+
return jsonResult(await getMismatchesFastPath(accessor, type, {
|
|
250
|
+
limit: optionalNumber(args, 'limit'),
|
|
251
|
+
offset: optionalNumber(args, 'offset'),
|
|
252
|
+
urlPattern: optionalString(args, 'urlPattern'),
|
|
253
|
+
sortBy: optionalString(args, 'sortBy'),
|
|
254
|
+
sortOrder: optionalString(args, 'sortOrder'),
|
|
255
|
+
cursor: optionalString(args, 'cursor'),
|
|
256
|
+
}));
|
|
183
257
|
}
|
|
184
258
|
case 'get_resource_referrers': {
|
|
185
259
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
186
260
|
const resourceUrl = requireString(args, 'resourceUrl');
|
|
187
|
-
const result = await getResourceReferrers(accessor,
|
|
261
|
+
const result = await getResourceReferrers(accessor, {
|
|
262
|
+
resourceUrl,
|
|
263
|
+
limit: optionalNumber(args, 'limit'),
|
|
264
|
+
cursor: optionalString(args, 'cursor'),
|
|
265
|
+
});
|
|
188
266
|
if (!result) {
|
|
189
267
|
return textResult('Resource not found.');
|
|
190
268
|
}
|
|
@@ -192,15 +270,30 @@ export function createServer() {
|
|
|
192
270
|
}
|
|
193
271
|
case 'check_headers': {
|
|
194
272
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
195
|
-
return jsonResult(await
|
|
273
|
+
return jsonResult(await getHeaderChecksFastPath(accessor, omit(args, 'archiveId')));
|
|
196
274
|
}
|
|
197
275
|
case 'list_isolated_pages': {
|
|
198
276
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
199
|
-
return jsonResult(await
|
|
277
|
+
return jsonResult(await listIsolatedPagesFastPath(accessor, {
|
|
200
278
|
limit: optionalNumber(args, 'limit'),
|
|
201
279
|
offset: optionalNumber(args, 'offset'),
|
|
202
280
|
}));
|
|
203
281
|
}
|
|
282
|
+
case 'list_isolated_clusters': {
|
|
283
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
284
|
+
return jsonResult(await listIsolatedClustersFastPath(accessor, {
|
|
285
|
+
limit: optionalNumber(args, 'limit'),
|
|
286
|
+
offset: optionalNumber(args, 'offset'),
|
|
287
|
+
}));
|
|
288
|
+
}
|
|
289
|
+
case 'get_isolated_cluster': {
|
|
290
|
+
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
291
|
+
const result = await getIsolatedClusterFastPath(accessor, requireString(args, 'representativeUrl'));
|
|
292
|
+
if (result === null) {
|
|
293
|
+
return textResult('Isolated cluster not found.');
|
|
294
|
+
}
|
|
295
|
+
return jsonResult(result);
|
|
296
|
+
}
|
|
204
297
|
case 'list_unused_resources': {
|
|
205
298
|
const accessor = manager.get(requireString(args, 'archiveId'));
|
|
206
299
|
return jsonResult(await listUnusedResources(accessor, {
|
|
@@ -272,6 +365,14 @@ export function createServer() {
|
|
|
272
365
|
/**
|
|
273
366
|
* Starts the MCP server using stdio transport.
|
|
274
367
|
* This is the entry point for the `nitpicker-mcp` binary.
|
|
368
|
+
* @returns Resolves once the stdio transport is connected; the server then
|
|
369
|
+
* keeps serving requests until the process exits.
|
|
370
|
+
* @example
|
|
371
|
+
* ```ts
|
|
372
|
+
* import { startServer } from '@nitpicker/mcp-server';
|
|
373
|
+
*
|
|
374
|
+
* await startServer();
|
|
375
|
+
* ```
|
|
275
376
|
*/
|
|
276
377
|
export async function startServer() {
|
|
277
378
|
const server = createServer();
|
package/lib/tool-definitions.js
CHANGED
|
@@ -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"
|
|
51
|
+
description: 'List pages with rich filtering: by status code (exact or range), missing metadata (title, description), noindex flag, security header presence (CSP / X-Frame-Options / X-Content-Type-Options / HSTS), URL patterns, directory paths. Supports sorting and pagination. Use for questions like "show me all 404 pages", "pages without descriptions", or "internal pages missing CSP". 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,22 @@ 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
|
+
hasCSP: {
|
|
79
|
+
type: 'boolean',
|
|
80
|
+
description: 'Filter by Content-Security-Policy header presence',
|
|
81
|
+
},
|
|
82
|
+
hasXFrameOptions: {
|
|
83
|
+
type: 'boolean',
|
|
84
|
+
description: 'Filter by X-Frame-Options header presence',
|
|
85
|
+
},
|
|
86
|
+
hasXContentTypeOptions: {
|
|
87
|
+
type: 'boolean',
|
|
88
|
+
description: 'Filter by X-Content-Type-Options header presence',
|
|
89
|
+
},
|
|
90
|
+
hasHSTS: {
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
description: 'Filter by Strict-Transport-Security header presence',
|
|
93
|
+
},
|
|
78
94
|
contentTypeCategory: {
|
|
79
95
|
type: 'string',
|
|
80
96
|
enum: [
|
|
@@ -159,7 +175,7 @@ export const toolDefinitions = [
|
|
|
159
175
|
},
|
|
160
176
|
{
|
|
161
177
|
name: 'list_links',
|
|
162
|
-
description: '
|
|
178
|
+
description: 'Analyse links: find **broken** links (canonical destination is exactly HTTP 404 Not Found — 403 Forbidden, 5xx server errors, and destinations excluded from crawling are deliberately NOT counted as broken, since those are separate concerns) 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
179
|
inputSchema: {
|
|
164
180
|
type: 'object',
|
|
165
181
|
properties: {
|
|
@@ -169,8 +185,12 @@ export const toolDefinitions = [
|
|
|
169
185
|
},
|
|
170
186
|
type: {
|
|
171
187
|
type: 'string',
|
|
172
|
-
enum: ['broken', 'external'
|
|
173
|
-
description: 'Type of link analysis: broken (
|
|
188
|
+
enum: ['broken', 'external'],
|
|
189
|
+
description: 'Type of link analysis: broken (canonical destination is exactly HTTP 404) or external (anchor leaves the in-scope hostname). Judged against the redirect-resolved canonical destination by default.',
|
|
190
|
+
},
|
|
191
|
+
includeRedirectSources: {
|
|
192
|
+
type: 'boolean',
|
|
193
|
+
description: 'When true, skip the redirect resolution and judge against the literal anchor target. Diagnostic — default is false.',
|
|
174
194
|
},
|
|
175
195
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
176
196
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
@@ -250,6 +270,20 @@ export const toolDefinitions = [
|
|
|
250
270
|
},
|
|
251
271
|
severity: { type: 'string', description: 'Filter by severity level' },
|
|
252
272
|
rule: { type: 'string', description: 'Filter by rule ID' },
|
|
273
|
+
urlPattern: {
|
|
274
|
+
type: 'string',
|
|
275
|
+
description: 'Filter URLs by SQL LIKE pattern',
|
|
276
|
+
},
|
|
277
|
+
sortBy: {
|
|
278
|
+
type: 'string',
|
|
279
|
+
enum: ['url', 'validator', 'severity', 'rule', 'message', 'code'],
|
|
280
|
+
description: 'Sort field',
|
|
281
|
+
},
|
|
282
|
+
sortOrder: {
|
|
283
|
+
type: 'string',
|
|
284
|
+
enum: ['asc', 'desc'],
|
|
285
|
+
description: 'Sort direction',
|
|
286
|
+
},
|
|
253
287
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
254
288
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
255
289
|
},
|
|
@@ -272,6 +306,11 @@ export const toolDefinitions = [
|
|
|
272
306
|
description: 'Metadata field to check for duplicates (default: "title")',
|
|
273
307
|
},
|
|
274
308
|
limit: { type: 'number', description: 'Max duplicate groups (default: 50)' },
|
|
309
|
+
offset: { type: 'number', description: 'Duplicate groups to skip (default: 0)' },
|
|
310
|
+
pagesLimit: {
|
|
311
|
+
type: 'number',
|
|
312
|
+
description: 'Max inline sample URLs per duplicate group (default: 20)',
|
|
313
|
+
},
|
|
275
314
|
},
|
|
276
315
|
required: ['archiveId'],
|
|
277
316
|
},
|
|
@@ -293,13 +332,27 @@ export const toolDefinitions = [
|
|
|
293
332
|
},
|
|
294
333
|
limit: { type: 'number', description: 'Max results (default: 100)' },
|
|
295
334
|
offset: { type: 'number', description: 'Results to skip (default: 0)' },
|
|
335
|
+
urlPattern: {
|
|
336
|
+
type: 'string',
|
|
337
|
+
description: 'SQL LIKE pattern to filter results by page URL',
|
|
338
|
+
},
|
|
339
|
+
sortBy: {
|
|
340
|
+
type: 'string',
|
|
341
|
+
enum: ['url', 'actual', 'expected'],
|
|
342
|
+
description: 'Field to sort results by (default: "url")',
|
|
343
|
+
},
|
|
344
|
+
sortOrder: {
|
|
345
|
+
type: 'string',
|
|
346
|
+
enum: ['asc', 'desc'],
|
|
347
|
+
description: 'Sort direction (default: "asc")',
|
|
348
|
+
},
|
|
296
349
|
},
|
|
297
350
|
required: ['archiveId', 'type'],
|
|
298
351
|
},
|
|
299
352
|
},
|
|
300
353
|
{
|
|
301
354
|
name: 'get_resource_referrers',
|
|
302
|
-
description: 'Find which pages reference a specific resource (CSS, JS, image). Useful for impact analysis when considering removal or updates of a resource.',
|
|
355
|
+
description: 'Find which pages reference a specific resource (CSS, JS, image). Useful for impact analysis when considering removal or updates of a resource. Results are bounded and cursor-paginated (default 100 per call) — pass the returned `nextCursor` back in to fetch the rest for a resource referenced by many pages.',
|
|
303
356
|
inputSchema: {
|
|
304
357
|
type: 'object',
|
|
305
358
|
properties: {
|
|
@@ -311,6 +364,11 @@ export const toolDefinitions = [
|
|
|
311
364
|
type: 'string',
|
|
312
365
|
description: 'The exact URL of the resource to look up',
|
|
313
366
|
},
|
|
367
|
+
limit: { type: 'number', description: 'Max referring pages (default: 100)' },
|
|
368
|
+
cursor: {
|
|
369
|
+
type: 'string',
|
|
370
|
+
description: 'Opaque cursor from a previous call, taken from its `nextCursor`',
|
|
371
|
+
},
|
|
314
372
|
},
|
|
315
373
|
required: ['archiveId', 'resourceUrl'],
|
|
316
374
|
},
|
|
@@ -478,7 +536,7 @@ export const toolDefinitions = [
|
|
|
478
536
|
},
|
|
479
537
|
{
|
|
480
538
|
name: 'list_isolated_pages',
|
|
481
|
-
description: 'List
|
|
539
|
+
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
540
|
inputSchema: {
|
|
483
541
|
type: 'object',
|
|
484
542
|
properties: {
|
|
@@ -492,6 +550,40 @@ export const toolDefinitions = [
|
|
|
492
550
|
required: ['archiveId'],
|
|
493
551
|
},
|
|
494
552
|
},
|
|
553
|
+
{
|
|
554
|
+
name: 'list_isolated_clusters',
|
|
555
|
+
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.",
|
|
556
|
+
inputSchema: {
|
|
557
|
+
type: 'object',
|
|
558
|
+
properties: {
|
|
559
|
+
archiveId: {
|
|
560
|
+
type: 'string',
|
|
561
|
+
description: 'The archive ID returned by open_archive',
|
|
562
|
+
},
|
|
563
|
+
limit: { type: 'number', description: 'Max clusters to return (default: 100)' },
|
|
564
|
+
offset: { type: 'number', description: 'Clusters to skip (default: 0)' },
|
|
565
|
+
},
|
|
566
|
+
required: ['archiveId'],
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
name: 'get_isolated_cluster',
|
|
571
|
+
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.",
|
|
572
|
+
inputSchema: {
|
|
573
|
+
type: 'object',
|
|
574
|
+
properties: {
|
|
575
|
+
archiveId: {
|
|
576
|
+
type: 'string',
|
|
577
|
+
description: 'The archive ID returned by open_archive',
|
|
578
|
+
},
|
|
579
|
+
representativeUrl: {
|
|
580
|
+
type: 'string',
|
|
581
|
+
description: "The cluster's representative URL (returned by list_isolated_clusters).",
|
|
582
|
+
},
|
|
583
|
+
},
|
|
584
|
+
required: ['archiveId', 'representativeUrl'],
|
|
585
|
+
},
|
|
586
|
+
},
|
|
495
587
|
{
|
|
496
588
|
name: 'list_unused_resources',
|
|
497
589
|
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.
|
|
3
|
+
"version": "0.13.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.13.0"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "2cd462ea6b183f4462b7caba27b4db04aaba7c70"
|
|
38
38
|
}
|