mcp-multitool 0.1.4 → 0.1.6
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 +21 -115
- package/dist/index.js +1 -13
- package/dist/tools/wait.js +11 -10
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -4,23 +4,19 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/mcp-multitool)
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
|
|
7
|
-
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server with **file operations
|
|
7
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server with basic **file operations** and **timing utilities**.
|
|
8
8
|
|
|
9
9
|
## Tools
|
|
10
10
|
|
|
11
|
-
| Tool
|
|
12
|
-
|
|
|
13
|
-
| `deleteFile`
|
|
14
|
-
| `moveFile`
|
|
15
|
-
| `
|
|
16
|
-
| `compressText` | Compress multi-line log text |
|
|
17
|
-
| `analyzePatterns` | Quick pattern extraction from logs |
|
|
18
|
-
| `estimateCompression` | Estimate compression ratio before processing |
|
|
19
|
-
| `wait` | Pause execution for rate limits or timing |
|
|
11
|
+
| Tool | Description |
|
|
12
|
+
| ------------ | --------------------------------------------- |
|
|
13
|
+
| `deleteFile` | Delete files or directories (single or batch) |
|
|
14
|
+
| `moveFile` | Move/rename files or directories |
|
|
15
|
+
| `wait` | Pause execution for rate limits or timing |
|
|
20
16
|
|
|
21
17
|
## Why
|
|
22
18
|
|
|
23
|
-
Some tasks need simple utilities that don't warrant a larger server — cleaning up temp files,
|
|
19
|
+
Some tasks need simple utilities that don't warrant a larger server — cleaning up temp files, pausing for rate limits. `mcp-multitool` gives any MCP-compatible client a small set of reliable tools.
|
|
24
20
|
|
|
25
21
|
## Quick Start
|
|
26
22
|
|
|
@@ -62,72 +58,6 @@ npx mcp-multitool
|
|
|
62
58
|
|
|
63
59
|
## Tool Reference
|
|
64
60
|
|
|
65
|
-
### `analyzePatterns`
|
|
66
|
-
|
|
67
|
-
Quick pattern analysis without full compression. Returns top N patterns found in logs, useful for rapid log triage.
|
|
68
|
-
|
|
69
|
-
| Parameter | Type | Required | Default | Description |
|
|
70
|
-
| ------------- | ---------- | -------- | ------- | --------------------------- |
|
|
71
|
-
| `lines` | `string[]` | ✅ | — | Log lines to analyze. |
|
|
72
|
-
| `maxPatterns` | `integer` | — | `20` | Maximum patterns to return. |
|
|
73
|
-
|
|
74
|
-
**Response:** JSON object with `patterns` array and `total` line count.
|
|
75
|
-
|
|
76
|
-
**Examples:**
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
analyzePatterns lines=["INFO Starting server", "INFO Starting server", "ERROR Failed"]
|
|
80
|
-
analyzePatterns lines=[...logs] maxPatterns=10
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
### `compressLogs`
|
|
86
|
-
|
|
87
|
-
Compress an array of log lines using semantic pattern extraction. Achieves 60-90% token reduction while preserving diagnostic context.
|
|
88
|
-
|
|
89
|
-
| Parameter | Type | Required | Default | Description |
|
|
90
|
-
| -------------- | ---------- | -------- | --------- | ----------------------------------------------------------------------- |
|
|
91
|
-
| `lines` | `string[]` | ✅ | — | Log lines to compress. |
|
|
92
|
-
| `format` | `string` | — | `summary` | Output format: `summary` (compact), `detailed` (full metadata), `json`. |
|
|
93
|
-
| `depth` | `integer` | — | `4` | Parse tree depth for pattern matching (2-8). |
|
|
94
|
-
| `simThreshold` | `number` | — | `0.4` | Similarity threshold for template matching (0.0-1.0). |
|
|
95
|
-
| `maxTemplates` | `integer` | — | `50` | Maximum templates to include in output. |
|
|
96
|
-
|
|
97
|
-
**Response:** Compressed log summary showing unique templates and occurrence counts.
|
|
98
|
-
|
|
99
|
-
**Examples:**
|
|
100
|
-
|
|
101
|
-
```
|
|
102
|
-
compressLogs lines=["2026-04-07 INFO Starting on port 3000", "2026-04-07 INFO Starting on port 3001"]
|
|
103
|
-
compressLogs lines=[...logs] format="json" maxTemplates=20
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
---
|
|
107
|
-
|
|
108
|
-
### `compressText`
|
|
109
|
-
|
|
110
|
-
Compress a multi-line log text string. Automatically splits on newlines and processes as individual log lines.
|
|
111
|
-
|
|
112
|
-
| Parameter | Type | Required | Default | Description |
|
|
113
|
-
| -------------- | --------- | -------- | --------- | ----------------------------------------------------------------------- |
|
|
114
|
-
| `text` | `string` | ✅ | — | Multi-line log text to compress. |
|
|
115
|
-
| `format` | `string` | — | `summary` | Output format: `summary` (compact), `detailed` (full metadata), `json`. |
|
|
116
|
-
| `depth` | `integer` | — | `4` | Parse tree depth for pattern matching (2-8). |
|
|
117
|
-
| `simThreshold` | `number` | — | `0.4` | Similarity threshold for template matching (0.0-1.0). |
|
|
118
|
-
| `maxTemplates` | `integer` | — | `50` | Maximum templates to include in output. |
|
|
119
|
-
|
|
120
|
-
**Response:** Compressed log summary showing unique templates and occurrence counts.
|
|
121
|
-
|
|
122
|
-
**Examples:**
|
|
123
|
-
|
|
124
|
-
```
|
|
125
|
-
compressText text="INFO Starting server\nINFO Starting server\nERROR Failed"
|
|
126
|
-
compressText text="<paste logs here>" format="detailed"
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
61
|
### `deleteFile`
|
|
132
62
|
|
|
133
63
|
Delete one or more files or directories.
|
|
@@ -149,26 +79,6 @@ deleteFile paths="build/" recursive=true
|
|
|
149
79
|
|
|
150
80
|
---
|
|
151
81
|
|
|
152
|
-
### `estimateCompression`
|
|
153
|
-
|
|
154
|
-
Estimate compression ratio without full processing. Samples a subset of logs to predict compression effectiveness.
|
|
155
|
-
|
|
156
|
-
| Parameter | Type | Required | Default | Description |
|
|
157
|
-
| ------------ | ---------- | -------- | ------- | ----------------------------------------- |
|
|
158
|
-
| `lines` | `string[]` | ✅ | — | Log lines to sample. |
|
|
159
|
-
| `sampleSize` | `integer` | — | `1000` | Number of lines to sample for estimation. |
|
|
160
|
-
|
|
161
|
-
**Response:** JSON object with estimated compression ratio, token reduction, and recommendation.
|
|
162
|
-
|
|
163
|
-
**Examples:**
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
estimateCompression lines=[...largeLogs]
|
|
167
|
-
estimateCompression lines=[...logs] sampleSize=500
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
82
|
### `moveFile`
|
|
173
83
|
|
|
174
84
|
Move one or more files or directories to a destination directory.
|
|
@@ -195,33 +105,29 @@ moveFile from="config.json" to="dest/" overwrite=true
|
|
|
195
105
|
|
|
196
106
|
Wait for a specified duration before continuing.
|
|
197
107
|
|
|
198
|
-
| Parameter
|
|
199
|
-
|
|
|
200
|
-
| `
|
|
201
|
-
| `reason`
|
|
108
|
+
| Parameter | Type | Required | Description |
|
|
109
|
+
| ----------------- | --------- | -------- | ----------------------------------------------------------------------------------------- |
|
|
110
|
+
| `durationSeconds` | `integer` | ✅ | How long to wait in seconds. Must be ≥ 1 and ≤ the configured max (default: 300 / 5 min). |
|
|
111
|
+
| `reason` | `string` | ✅ | Why the wait is needed. Max 64 characters. |
|
|
202
112
|
|
|
203
|
-
**Response:** `"
|
|
113
|
+
**Response:** `"Ns have passed."`
|
|
204
114
|
|
|
205
115
|
**Examples:**
|
|
206
116
|
|
|
207
117
|
```
|
|
208
|
-
wait
|
|
209
|
-
wait
|
|
210
|
-
wait
|
|
118
|
+
wait durationSeconds=2 reason="settling after write"
|
|
119
|
+
wait durationSeconds=5 reason="rate limit cooldown"
|
|
120
|
+
wait durationSeconds=1 reason="animation to complete"
|
|
211
121
|
```
|
|
212
122
|
|
|
213
123
|
## Environment Variables
|
|
214
124
|
|
|
215
|
-
| Variable
|
|
216
|
-
|
|
|
217
|
-
| `
|
|
218
|
-
| `
|
|
219
|
-
| `
|
|
220
|
-
| `
|
|
221
|
-
| `deleteFile` | _(on)_ | Set to `"false"` to disable the `deleteFile` tool at startup. |
|
|
222
|
-
| `estimateCompression` | _(on)_ | Set to `"false"` to disable the `estimateCompression` tool at startup. |
|
|
223
|
-
| `moveFile` | _(on)_ | Set to `"false"` to disable the `moveFile` tool at startup. |
|
|
224
|
-
| `wait` | _(on)_ | Set to `"false"` to disable the `wait` tool at startup. |
|
|
125
|
+
| Variable | Default | Description |
|
|
126
|
+
| ------------------------ | ------- | -------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| `waitMaxDurationSeconds` | `300` | Override the maximum allowed `durationSeconds`. Must be a positive number. Server refuses to start if invalid. |
|
|
128
|
+
| `deleteFile` | _(on)_ | Set to `"false"` to disable the `deleteFile` tool at startup. |
|
|
129
|
+
| `moveFile` | _(on)_ | Set to `"false"` to disable the `moveFile` tool at startup. |
|
|
130
|
+
| `wait` | _(on)_ | Set to `"false"` to disable the `wait` tool at startup. |
|
|
225
131
|
|
|
226
132
|
### Disabling Individual Tools
|
|
227
133
|
|
package/dist/index.js
CHANGED
|
@@ -2,27 +2,15 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
-
import { register as registerAnalyzePatterns } from "./tools/analyzePatterns.js";
|
|
6
|
-
import { register as registerCompressLogs } from "./tools/compressLogs.js";
|
|
7
|
-
import { register as registerCompressText } from "./tools/compressText.js";
|
|
8
5
|
import { register as registerDeleteFile } from "./tools/deleteFile.js";
|
|
9
|
-
import { register as registerEstimateCompression } from "./tools/estimateCompression.js";
|
|
10
6
|
import { register as registerMoveFile } from "./tools/moveFile.js";
|
|
11
7
|
import { register as registerWait } from "./tools/wait.js";
|
|
12
8
|
const require = createRequire(import.meta.url);
|
|
13
|
-
const { version } = require("
|
|
9
|
+
const { version } = require("../package.json");
|
|
14
10
|
const isEnabled = (name) => process.env[name] !== "false";
|
|
15
11
|
const server = new McpServer({ name: "mcp-multitool", version });
|
|
16
|
-
if (isEnabled("analyzePatterns"))
|
|
17
|
-
registerAnalyzePatterns(server);
|
|
18
|
-
if (isEnabled("compressLogs"))
|
|
19
|
-
registerCompressLogs(server);
|
|
20
|
-
if (isEnabled("compressText"))
|
|
21
|
-
registerCompressText(server);
|
|
22
12
|
if (isEnabled("deleteFile"))
|
|
23
13
|
registerDeleteFile(server);
|
|
24
|
-
if (isEnabled("estimateCompression"))
|
|
25
|
-
registerEstimateCompression(server);
|
|
26
14
|
if (isEnabled("moveFile"))
|
|
27
15
|
registerMoveFile(server);
|
|
28
16
|
if (isEnabled("wait"))
|
package/dist/tools/wait.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
const
|
|
3
|
-
const
|
|
2
|
+
const DEFAULT_MAX_SECONDS = 300;
|
|
3
|
+
const maxSeconds = parseMaxDuration();
|
|
4
4
|
function parseMaxDuration() {
|
|
5
|
-
const env = process.env.
|
|
5
|
+
const env = process.env.waitMaxDurationSeconds;
|
|
6
6
|
if (!env)
|
|
7
|
-
return
|
|
7
|
+
return DEFAULT_MAX_SECONDS;
|
|
8
8
|
const parsed = Number(env);
|
|
9
9
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
10
|
-
process.stderr.write(`Invalid
|
|
10
|
+
process.stderr.write(`Invalid waitMaxDurationSeconds: "${env}". Must be a positive number.\n`);
|
|
11
11
|
process.exit(1);
|
|
12
12
|
}
|
|
13
13
|
return parsed;
|
|
14
14
|
}
|
|
15
15
|
const schema = z.object({
|
|
16
|
-
|
|
16
|
+
durationSeconds: z
|
|
17
17
|
.number()
|
|
18
18
|
.int()
|
|
19
19
|
.min(1)
|
|
20
|
-
.max(
|
|
21
|
-
.describe(`
|
|
20
|
+
.max(maxSeconds)
|
|
21
|
+
.describe(`Seconds to wait. Min: 1, max: ${maxSeconds}.`),
|
|
22
22
|
reason: z
|
|
23
23
|
.string()
|
|
24
24
|
.min(1)
|
|
@@ -31,10 +31,11 @@ export function register(server) {
|
|
|
31
31
|
inputSchema: schema,
|
|
32
32
|
}, async (input) => {
|
|
33
33
|
try {
|
|
34
|
-
|
|
34
|
+
const ms = Math.round(input.durationSeconds * 1000);
|
|
35
|
+
await new Promise((r) => setTimeout(r, ms));
|
|
35
36
|
return {
|
|
36
37
|
content: [
|
|
37
|
-
{ type: "text", text: `${input.
|
|
38
|
+
{ type: "text", text: `${input.durationSeconds}s have passed.` },
|
|
38
39
|
],
|
|
39
40
|
};
|
|
40
41
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-multitool",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "MCP server with file operations (delete, move)
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "MCP server with file operations (delete, move) and timing utilities.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
"keywords": [
|
|
15
15
|
"mcp",
|
|
16
16
|
"model-context-protocol",
|
|
17
|
-
"log-compression",
|
|
18
17
|
"file-operations",
|
|
19
18
|
"delete-file",
|
|
20
19
|
"move-file",
|
|
21
20
|
"wait",
|
|
22
|
-
"logpare",
|
|
23
21
|
"tool"
|
|
24
22
|
],
|
|
25
23
|
"scripts": {
|
|
@@ -32,7 +30,6 @@
|
|
|
32
30
|
},
|
|
33
31
|
"dependencies": {
|
|
34
32
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
35
|
-
"logpare": "^0.1.0",
|
|
36
33
|
"zod": "^3.24.0"
|
|
37
34
|
},
|
|
38
35
|
"devDependencies": {
|