@j0hanz/filesystem-mcp 1.16.2 → 1.17.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/dist/assets/logo.svg +26 -11
- package/dist/cli.js +1 -1
- package/dist/completions.d.ts +1 -1
- package/dist/completions.js +1 -2
- package/dist/lib/constants.d.ts +2 -0
- package/dist/lib/constants.js +2 -3
- package/dist/lib/fs-helpers.d.ts +1 -1
- package/dist/lib/fs-helpers.js +0 -1
- package/dist/lib/logger.d.ts +3 -4
- package/dist/lib/logger.js +1 -1
- package/dist/lib/paths.d.ts +1 -1
- package/dist/prompts.d.ts +1 -1
- package/dist/prompts.js +11 -11
- package/dist/resources/workflows.js +12 -0
- package/dist/resources.d.ts +1 -1
- package/dist/resources.js +1 -1
- package/dist/schemas.d.ts +4 -4
- package/dist/server/bootstrap.d.ts +1 -10
- package/dist/server/bootstrap.js +165 -95
- package/dist/server/roots-manager.d.ts +3 -2
- package/dist/server/roots-manager.js +30 -4
- package/dist/server/task-store.d.ts +2 -3
- package/dist/server/task-store.js +1 -1
- package/dist/tools/apply-patch.d.ts +1 -1
- package/dist/tools/apply-patch.js +16 -12
- package/dist/tools/calculate-hash.d.ts +1 -1
- package/dist/tools/calculate-hash.js +8 -12
- package/dist/tools/contract.d.ts +5 -0
- package/dist/tools/create-directory.d.ts +1 -1
- package/dist/tools/create-directory.js +7 -10
- package/dist/tools/delete-file.d.ts +1 -1
- package/dist/tools/delete-file.js +12 -11
- package/dist/tools/diff-files.d.ts +1 -1
- package/dist/tools/diff-files.js +8 -11
- package/dist/tools/edit-file.d.ts +1 -1
- package/dist/tools/edit-file.js +12 -11
- package/dist/tools/icons.d.ts +15 -0
- package/dist/tools/icons.js +24 -0
- package/dist/tools/list-directory.d.ts +1 -1
- package/dist/tools/list-directory.js +7 -10
- package/dist/tools/move-file.d.ts +1 -1
- package/dist/tools/move-file.js +12 -11
- package/dist/tools/read-multiple.d.ts +1 -1
- package/dist/tools/read-multiple.js +8 -12
- package/dist/tools/read.d.ts +1 -1
- package/dist/tools/read.js +7 -10
- package/dist/tools/replace-in-files.d.ts +1 -1
- package/dist/tools/replace-in-files.js +11 -13
- package/dist/tools/roots.d.ts +1 -1
- package/dist/tools/roots.js +7 -10
- package/dist/tools/search-content.d.ts +1 -1
- package/dist/tools/search-content.js +8 -13
- package/dist/tools/search-files.d.ts +1 -1
- package/dist/tools/search-files.js +11 -16
- package/dist/tools/shared.d.ts +15 -12
- package/dist/tools/shared.js +84 -56
- package/dist/tools/stat-many.d.ts +1 -1
- package/dist/tools/stat-many.js +8 -12
- package/dist/tools/stat.d.ts +1 -1
- package/dist/tools/stat.js +7 -10
- package/dist/tools/task-support.d.ts +14 -12
- package/dist/tools/task-support.js +98 -92
- package/dist/tools/tree.d.ts +1 -1
- package/dist/tools/tree.js +11 -15
- package/dist/tools/write-file.d.ts +1 -1
- package/dist/tools/write-file.js +12 -11
- package/dist/tools.d.ts +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
[](https://lmstudio.ai/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19) [](https://cursor.com/en/install-mcp?name=filesystem&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBqMGhhbnovZmlsZXN5c3RlbS1tY3BAbGF0ZXN0Il19)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Secure filesystem MCP server for reading, writing, searching, diffing, and patching files.
|
|
10
10
|
|
|
11
11
|
## Table of Contents
|
|
12
12
|
|
|
@@ -30,13 +30,13 @@ A local filesystem MCP server that lets LLMs and AI agents read, write, search,
|
|
|
30
30
|
|
|
31
31
|
A secure, production-ready [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI assistants controlled access to the local filesystem. All operations are sandboxed to explicitly allowed directories with path traversal prevention, sensitive file blocking, and optional Bearer token authentication.
|
|
32
32
|
|
|
33
|
-
Supports stdio (default) and Streamable HTTP transport
|
|
33
|
+
Supports stdio (default) and Node Streamable HTTP transport. HTTP sessions are implemented with isolated per-session server state. The HTTP transport is stateful by default and currently non-resumable; it does not persist an event store for `Last-Event-ID` replay.
|
|
34
34
|
|
|
35
35
|
## Key Features
|
|
36
36
|
|
|
37
37
|
- **18 filesystem tools** — read, write, search, diff, patch, hash, and bulk operations with structured output schemas
|
|
38
|
-
- **Security-first** — path validation, symlink escape prevention, sensitive file denylist, localhost-only CORS, optional API key auth
|
|
39
|
-
- **Dual transport** — stdio for local use, Streamable HTTP
|
|
38
|
+
- **Security-first** — path validation, symlink escape prevention, sensitive file denylist, localhost-only CORS, Host header validation for loopback HTTP binds, optional API key auth
|
|
39
|
+
- **Dual transport** — stdio for local use, Node Streamable HTTP for networked/multi-session deployments
|
|
40
40
|
- **Structured output** — all tools return typed `outputSchema` / `structuredContent` for reliable LLM parsing
|
|
41
41
|
- **Self-documenting** — 6 built-in resources (`internal://instructions`, `internal://tool-catalog`, etc.) and 4 built-in prompts (`get-help`, `compare-files`, `analyze-path`, `get-tool-help`)
|
|
42
42
|
|
|
@@ -524,7 +524,7 @@ Create directories, move/rename files, delete files, and verify file integrity v
|
|
|
524
524
|
```text
|
|
525
525
|
[MCP Client]
|
|
526
526
|
|
|
|
527
|
-
| Transport: stdio (default) or Streamable HTTP
|
|
527
|
+
| Transport: stdio (default) or Node Streamable HTTP (--port)
|
|
528
528
|
v
|
|
529
529
|
[MCP Server: filesystem-mcp]
|
|
530
530
|
| Entry: src/index.ts -> src/server/bootstrap.ts
|
|
@@ -940,7 +940,7 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
|
|
|
940
940
|
| Method | Path | Purpose |
|
|
941
941
|
| -------- | ------ | ----------------------------------------------------- |
|
|
942
942
|
| `POST` | `/mcp` | Initialize session or send requests (Streamable HTTP) |
|
|
943
|
-
| `GET` | `/mcp` |
|
|
943
|
+
| `GET` | `/mcp` | HTTP streaming session endpoint |
|
|
944
944
|
| `DELETE` | `/mcp` | Terminate a session |
|
|
945
945
|
|
|
946
946
|
**Required headers:**
|
|
@@ -952,6 +952,8 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
|
|
|
952
952
|
|
|
953
953
|
**CORS:** Only localhost origins allowed (`127.0.0.1`, `::1`, `localhost`).
|
|
954
954
|
|
|
955
|
+
**Host validation:** Loopback HTTP binds validate the `Host` header (`localhost`, `127.0.0.1`, `[::1]`) to reduce DNS rebinding risk. Non-loopback binds still require `FILESYSTEM_MCP_API_KEY`.
|
|
956
|
+
|
|
955
957
|
## Security
|
|
956
958
|
|
|
957
959
|
| Control | Status | Evidence |
|
|
@@ -998,14 +1000,16 @@ When started with `--port <number>`, the server exposes a single MCP endpoint:
|
|
|
998
1000
|
|
|
999
1001
|
## Credits
|
|
1000
1002
|
|
|
1001
|
-
| Dependency
|
|
1002
|
-
|
|
|
1003
|
-
| [@modelcontextprotocol/
|
|
1004
|
-
| [
|
|
1005
|
-
| [
|
|
1006
|
-
| [
|
|
1007
|
-
| [
|
|
1008
|
-
| [
|
|
1003
|
+
| Dependency | Description |
|
|
1004
|
+
| ------------------------------------------------------------------------------------------ | --------------------------------------------- |
|
|
1005
|
+
| [@modelcontextprotocol/server](https://www.npmjs.com/package/@modelcontextprotocol/server) | MCP server SDK package |
|
|
1006
|
+
| [@modelcontextprotocol/client](https://www.npmjs.com/package/@modelcontextprotocol/client) | MCP client SDK package |
|
|
1007
|
+
| [@modelcontextprotocol/node](https://www.npmjs.com/package/@modelcontextprotocol/node) | Node transport package for MCP runtime |
|
|
1008
|
+
| [commander](https://www.npmjs.com/package/commander) | CLI argument parsing |
|
|
1009
|
+
| [diff](https://www.npmjs.com/package/diff) | Unified diff generation and patch application |
|
|
1010
|
+
| [ignore](https://www.npmjs.com/package/ignore) | `.gitignore` pattern matching |
|
|
1011
|
+
| [re2](https://www.npmjs.com/package/re2) | Safe RE2 regex engine (no ReDoS) |
|
|
1012
|
+
| [zod](https://www.npmjs.com/package/zod) | Schema validation and JSON Schema generation |
|
|
1009
1013
|
|
|
1010
1014
|
## License
|
|
1011
1015
|
|
package/dist/assets/logo.svg
CHANGED
|
@@ -1,20 +1,35 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg"
|
|
1
|
+
<svg height="200px" width="200px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg"
|
|
2
|
+
viewBox="-25.6 -25.6 563.2 563.2" xml:space="preserve" stroke-width="5.12">
|
|
2
3
|
<style>
|
|
3
|
-
path
|
|
4
|
-
|
|
4
|
+
path,
|
|
5
|
+
circle,
|
|
6
|
+
rect,
|
|
7
|
+
line,
|
|
8
|
+
polyline,
|
|
9
|
+
polygon {
|
|
10
|
+
fill: #000000;
|
|
5
11
|
stroke: #000000;
|
|
6
|
-
stroke-width: 1.3;
|
|
7
|
-
stroke-linecap: round;
|
|
8
|
-
stroke-linejoin: round
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
@media (prefers-color-scheme: dark) {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
|
|
16
|
+
path,
|
|
17
|
+
circle,
|
|
18
|
+
rect,
|
|
19
|
+
line,
|
|
20
|
+
polyline,
|
|
21
|
+
polygon {
|
|
22
|
+
fill: #FFFFFF;
|
|
23
|
+
stroke: #FFFFFF;
|
|
14
24
|
}
|
|
15
25
|
}
|
|
16
26
|
</style>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
<g transform="translate(1 1)">
|
|
28
|
+
<path
|
|
29
|
+
d="M476.867,135.533h-9.359c-3.86-19.681-20.878-34.133-41.841-34.133H293.4l-40.107-47.787c-1.707-2.56-4.267-3.413-6.827-3.413H58.733C39.96,50.2,24.6,65.56,24.6,84.333v52.288C9.921,140.435-1,153.837-1,169.667v256C-1,444.44,14.36,459.8,33.133,459.8h443.733c18.773,0,34.133-15.36,34.133-34.133v-256C511,150.893,495.64,135.533,476.867,135.533z M41.667,84.333c0-9.387,7.68-17.067,17.067-17.067H242.2l40.107,47.787c1.707,2.56,4.267,3.413,6.827,3.413h136.533c11.093,0,20.48,6.827,23.893,17.067H41.667V84.333z M493.933,425.667c0,9.387-7.68,17.067-17.067,17.067H33.133c-9.387,0-17.067-7.68-17.067-17.067v-256c0-9.387,7.68-17.067,17.067-17.067H459.8h17.067c9.387,0,17.067,7.68,17.067,17.067V425.667z">
|
|
30
|
+
</path>
|
|
31
|
+
<path
|
|
32
|
+
d="M383,332.625v-43.492c0-5.12-3.413-8.533-8.533-8.533h-102.4v-17.892c19.681-3.86,34.133-20.878,34.133-41.841c0-23.893-18.773-42.667-42.667-42.667c-23.893,0-42.667,18.773-42.667,42.667c0,20.963,14.452,37.981,34.133,41.841V280.6H152.6c-5.12,0-8.533,3.413-8.533,8.533v43.492c-19.681,3.86-34.133,20.878-34.133,41.841c0,23.893,18.773,42.667,42.667,42.667c23.893,0,42.667-18.773,42.667-42.667c0-20.963-14.452-37.981-34.133-41.841v-34.959H255v34.959c-19.681,3.86-34.133,20.878-34.133,41.841c0,23.893,18.773,42.667,42.667,42.667c23.893,0,42.667-18.773,42.667-42.667c0-20.963-14.452-37.981-34.133-41.841v-34.959h93.867v34.959c-19.681,3.86-34.133,20.878-34.133,41.841c0,23.893,18.773,42.667,42.667,42.667s42.667-18.773,42.667-42.667C417.133,353.504,402.681,336.485,383,332.625z M237.933,220.867c0-14.507,11.093-25.6,25.6-25.6c14.507,0,25.6,11.093,25.6,25.6c0,14.507-11.093,25.6-25.6,25.6C249.027,246.467,237.933,235.373,237.933,220.867z M178.2,374.467c0,14.507-11.093,25.6-25.6,25.6c-14.507,0-25.6-11.093-25.6-25.6c0-14.507,11.093-25.6,25.6-25.6C167.107,348.867,178.2,359.96,178.2,374.467z M289.133,374.467c0,14.507-11.093,25.6-25.6,25.6c-14.507,0-25.6-11.093-25.6-25.6c0-14.507,11.093-25.6,25.6-25.6C278.04,348.867,289.133,359.96,289.133,374.467z M374.467,400.067c-14.507,0-25.6-11.093-25.6-25.6c0-14.507,11.093-25.6,25.6-25.6c14.507,0,25.6,11.093,25.6,25.6C400.067,388.973,388.973,400.067,374.467,400.067z">
|
|
33
|
+
</path>
|
|
34
|
+
</g>
|
|
20
35
|
</svg>
|
package/dist/cli.js
CHANGED
|
@@ -123,7 +123,7 @@ function createCliProgram(output) {
|
|
|
123
123
|
.description('MCP filesystem server. Positional directories define allowed access roots.')
|
|
124
124
|
.argument('[allowedDirs...]', 'Directories the MCP server can access on disk', parseAllowedDirArgument)
|
|
125
125
|
.option('--allow_cwd, --allow-cwd', 'Allow the current working directory as an additional root')
|
|
126
|
-
.option('--port <number>', 'Enable HTTP transport on the given port (
|
|
126
|
+
.option('--port <number>', 'Enable HTTP transport on the given port (Node Streamable HTTP)')
|
|
127
127
|
.helpOption('-h, --help', 'Display command help')
|
|
128
128
|
.version(SERVER_VERSION, '-v, --version', 'Display server version')
|
|
129
129
|
.addHelpText('after', `
|
package/dist/completions.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
export declare function registerCompletions(server: McpServer, instructions?: string): void;
|
package/dist/completions.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CompleteRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
1
|
import { readdir, stat } from 'node:fs/promises';
|
|
3
2
|
import { basename, dirname, isAbsolute, join, parse, resolve, sep, } from 'node:path';
|
|
4
3
|
import { getAllowedDirectories, isPathWithinDirectories, normalizePath, toPosixPath, } from './lib/paths.js';
|
|
@@ -461,7 +460,7 @@ function handleTopicAndToolCompletions(ref, argName, argumentValue, topicValues,
|
|
|
461
460
|
export function registerCompletions(server, instructions = '') {
|
|
462
461
|
const topicValues = extractTopicCompletions(instructions);
|
|
463
462
|
const toolNameValues = extractToolNameCompletions();
|
|
464
|
-
server.server.setRequestHandler(
|
|
463
|
+
server.server.setRequestHandler('completion/complete', async (request) => {
|
|
465
464
|
const { params } = request;
|
|
466
465
|
const { argument, ref } = params;
|
|
467
466
|
const argName = argument.name.toLowerCase();
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export declare const DEFAULT_TASK_TTL_MS: number;
|
|
|
5
5
|
export declare const MAX_TASK_TTL_MS: number;
|
|
6
6
|
export declare const MAX_CONCURRENT_TASKS: number;
|
|
7
7
|
export declare const TASK_CANCEL_POLL_MS = 2000;
|
|
8
|
+
export declare const INIT_HANDSHAKE_TIMEOUT_MS: number;
|
|
9
|
+
export declare const INIT_TIMEOUT_CLOSE: boolean;
|
|
8
10
|
export declare const TASK_POLL_INTERVAL_MS = 100;
|
|
9
11
|
export declare const PARALLEL_CONCURRENCY: number;
|
|
10
12
|
export declare const MAX_SEARCHABLE_FILE_SIZE: number;
|
package/dist/lib/constants.js
CHANGED
|
@@ -75,10 +75,9 @@ export const DEFAULT_LOG_LEVEL = parseEnvLogLevel('FILESYSTEM_MCP_LOG_LEVEL', 'i
|
|
|
75
75
|
export const DEFAULT_TASK_TTL_MS = 5 * 60 * 1000;
|
|
76
76
|
export const MAX_TASK_TTL_MS = parseEnvInt('FILESYSTEM_MCP_MAX_TASK_TTL_MS', 60 * 60 * 1000, 1_000, 24 * 60 * 60 * 1000);
|
|
77
77
|
export const MAX_CONCURRENT_TASKS = parseEnvInt('FILESYSTEM_MCP_MAX_CONCURRENT_TASKS', 100, 1, 10_000);
|
|
78
|
-
// How often (ms) a background task checks the store for client cancellation.
|
|
79
78
|
export const TASK_CANCEL_POLL_MS = 2_000;
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
export const INIT_HANDSHAKE_TIMEOUT_MS = parseEnvInt('FS_INIT_HANDSHAKE_TIMEOUT_MS', 30_000, 1_000, 300_000);
|
|
80
|
+
export const INIT_TIMEOUT_CLOSE = parseTrueEnvFlag(process.env['FS_INIT_TIMEOUT_CLOSE']);
|
|
82
81
|
export const TASK_POLL_INTERVAL_MS = 100;
|
|
83
82
|
// Auto-tuned parallelism based on CPU cores (no env override)
|
|
84
83
|
const BYTES_PER_PARALLEL_TASK = 64 * MIB;
|
package/dist/lib/fs-helpers.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Stats } from 'node:fs';
|
|
2
2
|
import { type FileHandle } from 'node:fs/promises';
|
|
3
3
|
import type { FileType } from '../config.js';
|
|
4
|
-
export { assertNotAborted, createTimedAbortSignal, withAbort, withTimedAbortSignal, } from './abort.js';
|
|
5
4
|
interface ParallelResult<R> {
|
|
6
5
|
results: R[];
|
|
7
6
|
errors: {
|
|
@@ -43,3 +42,4 @@ export declare function atomicWriteFile(filePath: string, content: string, optio
|
|
|
43
42
|
encoding?: BufferEncoding;
|
|
44
43
|
signal?: AbortSignal | undefined;
|
|
45
44
|
}): Promise<void>;
|
|
45
|
+
export {};
|
package/dist/lib/fs-helpers.js
CHANGED
|
@@ -58,7 +58,6 @@ import { assertNotAborted, withAbort } from './abort.js';
|
|
|
58
58
|
import { BINARY_CHECK_BUFFER_SIZE, KNOWN_BINARY_EXTENSIONS, MAX_TEXT_FILE_SIZE, PARALLEL_CONCURRENCY, } from './constants.js';
|
|
59
59
|
import { ErrorCode, McpError, normalizeUnknownError } from './errors.js';
|
|
60
60
|
import { assertAllowedFileAccess, validateExistingPath } from './paths.js';
|
|
61
|
-
export { assertNotAborted, createTimedAbortSignal, withAbort, withTimedAbortSignal, } from './abort.js';
|
|
62
61
|
const READ_ONLY_FILE_FLAG = 'r';
|
|
63
62
|
function assertPositiveSafeIntegerOption(name, value, message) {
|
|
64
63
|
if (value === undefined)
|
package/dist/lib/logger.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { McpServer } from '@modelcontextprotocol/
|
|
2
|
-
import type { LoggingLevel } from '@modelcontextprotocol/sdk/types.js';
|
|
1
|
+
import type { LoggingLevel, McpServer } from '@modelcontextprotocol/server';
|
|
3
2
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
4
|
-
|
|
3
|
+
interface SessionContextData {
|
|
5
4
|
sessionId?: string;
|
|
6
5
|
}
|
|
7
6
|
export declare const SessionContext: AsyncLocalStorage<SessionContextData>;
|
|
@@ -15,7 +14,6 @@ export interface LoggingState {
|
|
|
15
14
|
minimumLevel: LoggingLevel;
|
|
16
15
|
}
|
|
17
16
|
export declare function createLoggingState(minimumLevel?: LoggingLevel): LoggingState;
|
|
18
|
-
export declare function canSendMcpLogs(server: McpServer): boolean;
|
|
19
17
|
export declare function logToMcp(server: McpServer | undefined, level: LoggingLevel, data: string, minLevel?: LoggingLevel): void;
|
|
20
18
|
export declare const Logger: {
|
|
21
19
|
emit(level: LoggingLevel, message: string, data?: unknown): void;
|
|
@@ -26,3 +24,4 @@ export declare const Logger: {
|
|
|
26
24
|
error(message: string, data?: unknown): void;
|
|
27
25
|
critical(message: string, data?: unknown): void;
|
|
28
26
|
};
|
|
27
|
+
export {};
|
package/dist/lib/logger.js
CHANGED
|
@@ -16,7 +16,7 @@ const LOG_LEVEL_ORDER = {
|
|
|
16
16
|
export function createLoggingState(minimumLevel = 'debug') {
|
|
17
17
|
return { minimumLevel };
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
function canSendMcpLogs(server) {
|
|
20
20
|
const capabilities = server.server.getClientCapabilities();
|
|
21
21
|
if (!capabilities || typeof capabilities !== 'object')
|
|
22
22
|
return false;
|
package/dist/lib/paths.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Root } from '@modelcontextprotocol/
|
|
1
|
+
import type { Root } from '@modelcontextprotocol/server';
|
|
2
2
|
export declare function toPosixPath(value: string): string;
|
|
3
3
|
export declare function isSensitivePath(requestedPath: string, resolvedPath?: string): boolean;
|
|
4
4
|
export declare function assertAllowedFileAccess(requestedPath: string, resolvedPath?: string): void;
|
package/dist/prompts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import { type IconInfo } from './tools/shared.js';
|
|
3
3
|
export declare function registerGetHelpPrompt(server: McpServer, instructions: string, iconInfo?: IconInfo): void;
|
|
4
4
|
export declare function registerCompareFilesPrompt(server: McpServer, iconInfo?: IconInfo): void;
|
package/dist/prompts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProtocolError, ProtocolErrorCode, } from '@modelcontextprotocol/server';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { buildToolInfo, getSortedToolContracts, } from './resources/tool-info.js';
|
|
4
4
|
import { withDefaultIcons } from './tools/shared.js';
|
|
@@ -39,12 +39,12 @@ export function registerGetHelpPrompt(server, instructions, iconInfo) {
|
|
|
39
39
|
const baseConfig = withDefaultIcons({ title: HELP_PROMPT_TITLE, description: HELP_PROMPT_DESCRIPTION }, iconInfo);
|
|
40
40
|
server.registerPrompt(HELP_PROMPT_NAME, {
|
|
41
41
|
...baseConfig,
|
|
42
|
-
argsSchema: {
|
|
42
|
+
argsSchema: z.object({
|
|
43
43
|
topic: z
|
|
44
44
|
.string()
|
|
45
45
|
.optional()
|
|
46
46
|
.describe('Optional section heading prefix (example: "error handling"). Omit to return full instructions.'),
|
|
47
|
-
},
|
|
47
|
+
}),
|
|
48
48
|
}, ({ topic }) => {
|
|
49
49
|
const text = topic
|
|
50
50
|
? filterInstructionsByTopic(instructions, topic)
|
|
@@ -69,10 +69,10 @@ export function registerCompareFilesPrompt(server, iconInfo) {
|
|
|
69
69
|
title: COMPARE_FILES_PROMPT_TITLE,
|
|
70
70
|
description: COMPARE_FILES_PROMPT_DESCRIPTION,
|
|
71
71
|
}, iconInfo),
|
|
72
|
-
argsSchema: {
|
|
72
|
+
argsSchema: z.object({
|
|
73
73
|
original: z.string().describe('Path to the original file.'),
|
|
74
74
|
modified: z.string().describe('Path to the modified file.'),
|
|
75
|
-
},
|
|
75
|
+
}),
|
|
76
76
|
}, ({ original, modified }) => ({
|
|
77
77
|
description: COMPARE_FILES_PROMPT_DESCRIPTION,
|
|
78
78
|
messages: [
|
|
@@ -92,9 +92,9 @@ export function registerAnalyzePathPrompt(server, iconInfo) {
|
|
|
92
92
|
title: ANALYZE_PATH_PROMPT_TITLE,
|
|
93
93
|
description: ANALYZE_PATH_PROMPT_DESCRIPTION,
|
|
94
94
|
}, iconInfo),
|
|
95
|
-
argsSchema: {
|
|
95
|
+
argsSchema: z.object({
|
|
96
96
|
path: z.string().describe('Absolute path to analyze.'),
|
|
97
|
-
},
|
|
97
|
+
}),
|
|
98
98
|
}, ({ path: targetPath }) => ({
|
|
99
99
|
description: ANALYZE_PATH_PROMPT_DESCRIPTION,
|
|
100
100
|
messages: [
|
|
@@ -114,20 +114,20 @@ export function registerGetToolHelpPrompt(server, iconInfo) {
|
|
|
114
114
|
title: GET_TOOL_HELP_PROMPT_TITLE,
|
|
115
115
|
description: GET_TOOL_HELP_PROMPT_DESCRIPTION,
|
|
116
116
|
}, iconInfo),
|
|
117
|
-
argsSchema: {
|
|
117
|
+
argsSchema: z.object({
|
|
118
118
|
name: z
|
|
119
119
|
.string()
|
|
120
120
|
.min(1)
|
|
121
121
|
.describe('Tool name from tools/list or internal://tool-info/{name}.'),
|
|
122
|
-
},
|
|
122
|
+
}),
|
|
123
123
|
}, ({ name }) => {
|
|
124
124
|
const toolName = findKnownToolName(name);
|
|
125
125
|
if (!toolName) {
|
|
126
|
-
throw new
|
|
126
|
+
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Unknown tool: ${name}`);
|
|
127
127
|
}
|
|
128
128
|
const toolInfo = buildToolInfo(toolName);
|
|
129
129
|
if (!toolInfo) {
|
|
130
|
-
throw new
|
|
130
|
+
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Unknown tool: ${toolName}`);
|
|
131
131
|
}
|
|
132
132
|
return {
|
|
133
133
|
description: GET_TOOL_HELP_PROMPT_DESCRIPTION,
|
|
@@ -56,5 +56,17 @@ export function buildWorkflowGuide() {
|
|
|
56
56
|
3. Apply: \`apply_patch(patch)\`.
|
|
57
57
|
|
|
58
58
|
> Multi-file patches: set \`path\` to the base directory. Results are reported per file.
|
|
59
|
+
|
|
60
|
+
### E: Task Mode — Deferred execution with polling
|
|
61
|
+
|
|
62
|
+
Use task mode for long-running operations when durable polling or cancellation is needed.
|
|
63
|
+
Only tools with \`execution.taskSupport: "optional"\` or \`"required"\` support this.
|
|
64
|
+
|
|
65
|
+
1. Send \`tools/call\` with \`task: {}\` in the request to create a task.
|
|
66
|
+
2. Poll \`tasks/get({ taskId })\` until status reaches \`completed\`, \`failed\`, or \`cancelled\`.
|
|
67
|
+
3. Retrieve the final result via \`tasks/result({ taskId })\`.
|
|
68
|
+
4. Cancel with \`tasks/cancel({ taskId })\` if no longer needed.
|
|
69
|
+
|
|
70
|
+
> Do not send \`task\` metadata to tools with \`taskSupport: "forbidden"\` (the default).
|
|
59
71
|
`;
|
|
60
72
|
}
|
package/dist/resources.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import { type McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import type { ResourceStore } from './lib/resource-store.js';
|
|
3
3
|
import { type IconInfo } from './tools/shared.js';
|
|
4
4
|
export declare function registerInstructionResource(server: McpServer, instructions: string, iconInfo?: IconInfo): void;
|
package/dist/resources.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResourceTemplate, } from '@modelcontextprotocol/
|
|
1
|
+
import { ResourceTemplate, } from '@modelcontextprotocol/server';
|
|
2
2
|
import { ErrorCode, McpError } from './lib/errors.js';
|
|
3
3
|
import { globalMetrics } from './lib/observability.js';
|
|
4
4
|
import { buildToolCatalog } from './resources/tool-catalog.js';
|
package/dist/schemas.d.ts
CHANGED
|
@@ -22,9 +22,9 @@ export declare const ListDirectoryInputSchema: z.ZodObject<{
|
|
|
22
22
|
maxDepth: z.ZodOptional<z.ZodInt>;
|
|
23
23
|
maxEntries: z.ZodDefault<z.ZodOptional<z.ZodInt>>;
|
|
24
24
|
sortBy: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
25
|
-
type: "type";
|
|
26
|
-
size: "size";
|
|
27
25
|
name: "name";
|
|
26
|
+
size: "size";
|
|
27
|
+
type: "type";
|
|
28
28
|
modified: "modified";
|
|
29
29
|
}>>>;
|
|
30
30
|
pattern: z.ZodOptional<z.ZodString>;
|
|
@@ -39,9 +39,9 @@ export declare const SearchFilesInputSchema: z.ZodObject<{
|
|
|
39
39
|
includeIgnored: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
40
|
includeHidden: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
41
41
|
sortBy: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
42
|
-
size: "size";
|
|
43
|
-
name: "name";
|
|
44
42
|
path: "path";
|
|
43
|
+
name: "name";
|
|
44
|
+
size: "size";
|
|
45
45
|
modified: "modified";
|
|
46
46
|
}>>>;
|
|
47
47
|
maxDepth: z.ZodOptional<z.ZodInt>;
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import { McpServer } from '@modelcontextprotocol/
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/server';
|
|
2
2
|
import { type Server } from 'node:http';
|
|
3
|
-
import { type LoggingState } from '../lib/logger.js';
|
|
4
3
|
import { type ServerOptions } from './roots-manager.js';
|
|
5
|
-
export declare const activeServers: Map<string, {
|
|
6
|
-
server: McpServer;
|
|
7
|
-
loggingState: LoggingState;
|
|
8
|
-
}>;
|
|
9
|
-
export declare let stdioServer: {
|
|
10
|
-
server: McpServer;
|
|
11
|
-
loggingState: LoggingState;
|
|
12
|
-
} | undefined;
|
|
13
4
|
export declare function createServer(options?: ServerOptions): Promise<McpServer>;
|
|
14
5
|
export declare function startServer(server: McpServer): Promise<void>;
|
|
15
6
|
export declare function startHttpServer(port: number, options: ServerOptions): Promise<Server>;
|