mcp-multitool 0.1.10 → 0.1.11

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 CHANGED
@@ -12,6 +12,7 @@ A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server with **
12
12
  | ----------------- | ------------------------------------------------------- |
13
13
  | `astGrepSearch` | Search code using AST patterns |
14
14
  | `checkFileOrDir` | Check if a file or directory exists and return metadata |
15
+ | `cloneFileOrDir` | Copy one or more files or directories to a destination |
15
16
  | `deleteFileOrDir` | Delete one or more files or directories |
16
17
  | `moveFileOrDir` | Move one or more files or directories to a new location |
17
18
  | `readLogFile` | Read and compress logs with 60-90% token reduction |
@@ -104,6 +105,28 @@ checkFileOrDir path="./src/index.ts"
104
105
 
105
106
  ---
106
107
 
108
+ ### `cloneFileOrDir`
109
+
110
+ Copy one or more files or directories to a destination directory.
111
+
112
+ | Parameter | Type | Required | Description |
113
+ | ----------- | -------------------- | -------- | ---------------------------------- |
114
+ | `from` | `string \| string[]` | ✅ | Source path(s) to clone. |
115
+ | `to` | `string` | ✅ | Destination directory. |
116
+ | `overwrite` | `boolean` | ✅ | If true, overwrite existing files. |
117
+
118
+ **Response:** JSON array of `{source, destination}` objects showing each cloned path.
119
+
120
+ **Examples:**
121
+
122
+ ```
123
+ cloneFileOrDir from="config.json" to="backup/" overwrite=false
124
+ cloneFileOrDir from=["a.txt", "b.txt"] to="copies/" overwrite=false
125
+ cloneFileOrDir from="src/" to="archive/" overwrite=true
126
+ ```
127
+
128
+ ---
129
+
107
130
  ### `deleteFileOrDir`
108
131
 
109
132
  Delete one or more files or directories.
@@ -240,6 +263,7 @@ wait durationSeconds=1 reason="animation to complete"
240
263
  | `readLogFileTimeoutMs` | `5000` | Override the timeout for `readLogFile` processing in milliseconds. Server refuses to start if invalid. |
241
264
  | `astGrepSearch` | _(on)_ | Set to `"false"` to disable the `astGrepSearch` tool at startup. |
242
265
  | `checkFileOrDir` | _(on)_ | Set to `"false"` to disable the `checkFileOrDir` tool at startup. |
266
+ | `cloneFileOrDir` | _(on)_ | Set to `"false"` to disable the `cloneFileOrDir` tool at startup. |
243
267
  | `deleteFileOrDir` | _(on)_ | Set to `"false"` to disable the `deleteFileOrDir` tool at startup. |
244
268
  | `moveFileOrDir` | _(on)_ | Set to `"false"` to disable the `moveFileOrDir` tool at startup. |
245
269
  | `readLogFile` | _(on)_ | Set to `"false"` to disable the `readLogFile` tool at startup. |
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { register as registerAstGrepSearch } from "./tools/astGrepSearch.js";
6
6
  import { register as registerCheckFileOrDir } from "./tools/checkFileOrDir.js";
7
+ import { register as registerCloneFileOrDir } from "./tools/cloneFileOrDir.js";
7
8
  import { register as registerDeleteFileOrDir } from "./tools/deleteFileOrDir.js";
8
9
  import { register as registerMoveFileOrDir } from "./tools/moveFileOrDir.js";
9
10
  import { register as registerReadLogFile } from "./tools/readLogFile.js";
@@ -17,6 +18,8 @@ if (isEnabled("astGrepSearch"))
17
18
  registerAstGrepSearch(server);
18
19
  if (isEnabled("checkFileOrDir"))
19
20
  registerCheckFileOrDir(server);
21
+ if (isEnabled("cloneFileOrDir"))
22
+ registerCloneFileOrDir(server);
20
23
  if (isEnabled("deleteFileOrDir"))
21
24
  registerDeleteFileOrDir(server);
22
25
  if (isEnabled("moveFileOrDir"))
@@ -0,0 +1,2 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function register(server: McpServer): void;
@@ -0,0 +1,55 @@
1
+ import { access, cp } from "node:fs/promises";
2
+ import { basename, join, resolve } 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 clone."),
8
+ to: z.string().describe("Destination directory."),
9
+ overwrite: z.boolean().describe("If true, overwrite existing files."),
10
+ });
11
+ async function exists(path) {
12
+ try {
13
+ await access(path);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ export function register(server) {
21
+ server.registerTool("cloneFileOrDir", {
22
+ description: "Copy one or more files or directories to a destination directory.",
23
+ inputSchema: schema,
24
+ annotations: {
25
+ destructiveHint: true,
26
+ openWorldHint: false,
27
+ },
28
+ }, async (input) => {
29
+ try {
30
+ const sources = Array.isArray(input.from) ? input.from : [input.from];
31
+ const results = [];
32
+ for (const src of sources) {
33
+ const srcPath = resolve(process.cwd(), src);
34
+ const destPath = join(resolve(process.cwd(), input.to), basename(src));
35
+ if (!input.overwrite && (await exists(destPath))) {
36
+ throw new Error(`Destination exists: ${destPath}. Set overwrite=true to replace.`);
37
+ }
38
+ await cp(srcPath, destPath, {
39
+ recursive: true,
40
+ force: input.overwrite,
41
+ });
42
+ results.push({ source: srcPath, destination: destPath });
43
+ }
44
+ return {
45
+ content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
46
+ };
47
+ }
48
+ catch (err) {
49
+ return {
50
+ isError: true,
51
+ content: [{ type: "text", text: String(err) }],
52
+ };
53
+ }
54
+ });
55
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-multitool",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "MCP server with file operations (delete, move) and timing utilities.",
5
5
  "license": "MIT",
6
6
  "type": "module",