mcp-multitool 0.1.0 → 0.1.1
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 +47 -2
- package/dist/index.js +6 -0
- package/dist/tools/deleteFile.d.ts +2 -0
- package/dist/tools/deleteFile.js +31 -0
- package/dist/tools/moveFile.d.ts +2 -0
- package/dist/tools/moveFile.js +48 -0
- package/dist/tools/wait.js +4 -1
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/mcp-multitool)
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
|
|
7
|
-
A minimal [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server
|
|
7
|
+
A minimal [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server with utility tools.
|
|
8
8
|
|
|
9
9
|
## Why
|
|
10
10
|
|
|
11
|
-
Some tasks
|
|
11
|
+
Some tasks need simple utilities that don't warrant a larger server — pausing for rate limits, deleting temp files, etc. `mcp-multitool` gives any MCP-compatible client a small set of reliable tools.
|
|
12
12
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
@@ -50,6 +50,49 @@ npx mcp-multitool
|
|
|
50
50
|
|
|
51
51
|
## Tool Reference
|
|
52
52
|
|
|
53
|
+
### `deleteFile`
|
|
54
|
+
|
|
55
|
+
Delete one or more files or directories.
|
|
56
|
+
|
|
57
|
+
| Parameter | Type | Required | Default | Description |
|
|
58
|
+
| ----------- | -------------------- | -------- | ------- | ----------------------------------------------------- |
|
|
59
|
+
| `paths` | `string \| string[]` | ✅ | — | File or directory path(s) to delete. |
|
|
60
|
+
| `recursive` | `boolean` | — | `false` | If true, delete directories and contents recursively. |
|
|
61
|
+
|
|
62
|
+
**Response:** `"Deleted N path(s)."`
|
|
63
|
+
|
|
64
|
+
**Examples:**
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
deleteFile paths="temp.txt"
|
|
68
|
+
deleteFile paths=["a.txt", "b.txt"]
|
|
69
|
+
deleteFile paths="build/" recursive=true
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### `moveFile`
|
|
75
|
+
|
|
76
|
+
Move one or more files or directories to a destination directory.
|
|
77
|
+
|
|
78
|
+
| Parameter | Type | Required | Default | Description |
|
|
79
|
+
| ----------- | -------------------- | -------- | ------- | ---------------------------------- |
|
|
80
|
+
| `from` | `string \| string[]` | ✅ | — | Source path(s) to move. |
|
|
81
|
+
| `to` | `string` | ✅ | — | Destination directory. |
|
|
82
|
+
| `overwrite` | `boolean` | — | `false` | If true, overwrite existing files. |
|
|
83
|
+
|
|
84
|
+
**Response:** `"Moved N path(s)."`
|
|
85
|
+
|
|
86
|
+
**Examples:**
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
moveFile from="old.txt" to="archive/"
|
|
90
|
+
moveFile from=["a.txt", "b.txt"] to="backup/"
|
|
91
|
+
moveFile from="config.json" to="dest/" overwrite=true
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
53
96
|
### `wait`
|
|
54
97
|
|
|
55
98
|
Wait for a specified duration before continuing.
|
|
@@ -74,6 +117,8 @@ wait durationMs=500 reason="animation to complete"
|
|
|
74
117
|
| Variable | Default | Description |
|
|
75
118
|
| ------------------- | -------- | --------------------------------------------------------------------------------------------------------- |
|
|
76
119
|
| `waitMaxDurationMs` | `300000` | Override the maximum allowed `durationMs`. Must be a positive number. Server refuses to start if invalid. |
|
|
120
|
+
| `deleteFile` | _(on)_ | Set to `"false"` to disable the `deleteFile` tool at startup. |
|
|
121
|
+
| `moveFile` | _(on)_ | Set to `"false"` to disable the `moveFile` tool at startup. |
|
|
77
122
|
| `wait` | _(on)_ | Set to `"false"` to disable the `wait` tool at startup. |
|
|
78
123
|
|
|
79
124
|
### Disabling Individual Tools
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { register as registerDeleteFile } from "./tools/deleteFile.js";
|
|
5
|
+
import { register as registerMoveFile } from "./tools/moveFile.js";
|
|
4
6
|
import { register as registerWait } from "./tools/wait.js";
|
|
5
7
|
const isEnabled = (name) => process.env[name] !== "false";
|
|
6
8
|
const server = new McpServer({ name: "mcp-multitool", version: "0.1.0" });
|
|
9
|
+
if (isEnabled("deleteFile"))
|
|
10
|
+
registerDeleteFile(server);
|
|
11
|
+
if (isEnabled("moveFile"))
|
|
12
|
+
registerMoveFile(server);
|
|
7
13
|
if (isEnabled("wait"))
|
|
8
14
|
registerWait(server);
|
|
9
15
|
await server.connect(new StdioServerTransport());
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { rm } from "node:fs/promises";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
paths: z
|
|
5
|
+
.union([z.string(), z.array(z.string())])
|
|
6
|
+
.describe("File or directory path(s) to delete."),
|
|
7
|
+
recursive: z
|
|
8
|
+
.boolean()
|
|
9
|
+
.default(false)
|
|
10
|
+
.describe("If true, delete directories and contents recursively."),
|
|
11
|
+
});
|
|
12
|
+
export function register(server) {
|
|
13
|
+
server.registerTool("deleteFile", {
|
|
14
|
+
description: "Delete one or more files or directories.",
|
|
15
|
+
inputSchema: schema,
|
|
16
|
+
}, async (input) => {
|
|
17
|
+
try {
|
|
18
|
+
const paths = Array.isArray(input.paths) ? input.paths : [input.paths];
|
|
19
|
+
await Promise.all(paths.map((p) => rm(p, { recursive: input.recursive })));
|
|
20
|
+
return {
|
|
21
|
+
content: [{ type: "text", text: `Deleted ${paths.length} path(s).` }],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
return {
|
|
26
|
+
isError: true,
|
|
27
|
+
content: [{ type: "text", text: String(err) }],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { access, rename } from "node:fs/promises";
|
|
2
|
+
import { basename, join } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
const schema = z.object({
|
|
5
|
+
from: z
|
|
6
|
+
.union([z.string(), z.array(z.string())])
|
|
7
|
+
.describe("Source path(s) to move."),
|
|
8
|
+
to: z.string().describe("Destination directory."),
|
|
9
|
+
overwrite: z
|
|
10
|
+
.boolean()
|
|
11
|
+
.default(false)
|
|
12
|
+
.describe("If true, overwrite existing files."),
|
|
13
|
+
});
|
|
14
|
+
async function exists(path) {
|
|
15
|
+
try {
|
|
16
|
+
await access(path);
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function register(server) {
|
|
24
|
+
server.registerTool("moveFile", {
|
|
25
|
+
description: "Move one or more files or directories to a destination directory.",
|
|
26
|
+
inputSchema: schema,
|
|
27
|
+
}, async (input) => {
|
|
28
|
+
try {
|
|
29
|
+
const sources = Array.isArray(input.from) ? input.from : [input.from];
|
|
30
|
+
for (const src of sources) {
|
|
31
|
+
const dest = join(input.to, basename(src));
|
|
32
|
+
if (!input.overwrite && (await exists(dest))) {
|
|
33
|
+
throw new Error(`Destination exists: ${dest}. Set overwrite=true to replace.`);
|
|
34
|
+
}
|
|
35
|
+
await rename(src, dest);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: `Moved ${sources.length} path(s).` }],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return {
|
|
43
|
+
isError: true,
|
|
44
|
+
content: [{ type: "text", text: String(err) }],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
package/dist/tools/wait.js
CHANGED
|
@@ -26,7 +26,10 @@ const schema = z.object({
|
|
|
26
26
|
.describe("Why the wait is needed. Max 64 characters."),
|
|
27
27
|
});
|
|
28
28
|
export function register(server) {
|
|
29
|
-
server.
|
|
29
|
+
server.registerTool("wait", {
|
|
30
|
+
description: "Wait for a specified duration before continuing.",
|
|
31
|
+
inputSchema: schema,
|
|
32
|
+
}, async (input) => {
|
|
30
33
|
try {
|
|
31
34
|
await new Promise((r) => setTimeout(r, input.durationMs));
|
|
32
35
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-multitool",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Minimal MCP server — wait tool and more.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc",
|
|
22
|
-
"
|
|
22
|
+
"lint": "eslint index.ts tsserver.ts tools/",
|
|
23
|
+
"start": "node dist/index.js",
|
|
24
|
+
"prepublishOnly": "tsc",
|
|
25
|
+
"publish": "npm publish --access public",
|
|
26
|
+
"patch": "npm version patch"
|
|
23
27
|
},
|
|
24
28
|
"dependencies": {
|
|
25
29
|
"@modelcontextprotocol/sdk": "1.29.0",
|