@yawlabs/caddy-mcp 0.1.1 → 0.2.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/dist/index.js CHANGED
@@ -271,10 +271,13 @@ function registerConfigTools(server) {
271
271
  id: z2.string().regex(/^[\w-]+$/).describe("The @id value of the config object"),
272
272
  action: z2.enum(["get", "set", "delete"]).optional().default("get").describe("Action to perform"),
273
273
  value: z2.any().optional().describe("New value (required for 'set' action)"),
274
- subpath: z2.string().optional().default("").describe("Optional sub-path within the identified object")
274
+ subpath: z2.string().optional().default("").describe("Optional sub-path within the identified object"),
275
+ mode: z2.enum(["append", "overwrite", "insert"]).optional().default("overwrite").describe(
276
+ "For 'set' action: 'overwrite' = PATCH (replace existing, default), 'append' = POST (add to arrays, create on objects), 'insert' = PUT (insert at array index)"
277
+ )
275
278
  },
276
279
  { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
277
- async ({ id, action, value, subpath }) => {
280
+ async ({ id, action, value, subpath, mode }) => {
278
281
  if (action === "get") {
279
282
  return formatResult(await configByIdGet(id, subpath));
280
283
  }
@@ -285,7 +288,8 @@ function registerConfigTools(server) {
285
288
  content: [{ type: "text", text: "Error: value is required for 'set' action" }]
286
289
  };
287
290
  }
288
- return formatResult(await configByIdSet(id, value, "PATCH", subpath));
291
+ const method = mode === "append" ? "POST" : mode === "insert" ? "PUT" : "PATCH";
292
+ return formatResult(await configByIdSet(id, value, method, subpath));
289
293
  }
290
294
  if (action === "delete") {
291
295
  return formatResult(await configByIdDelete(id, subpath));
package/dist/server.js CHANGED
@@ -269,10 +269,13 @@ function registerConfigTools(server) {
269
269
  id: z2.string().regex(/^[\w-]+$/).describe("The @id value of the config object"),
270
270
  action: z2.enum(["get", "set", "delete"]).optional().default("get").describe("Action to perform"),
271
271
  value: z2.any().optional().describe("New value (required for 'set' action)"),
272
- subpath: z2.string().optional().default("").describe("Optional sub-path within the identified object")
272
+ subpath: z2.string().optional().default("").describe("Optional sub-path within the identified object"),
273
+ mode: z2.enum(["append", "overwrite", "insert"]).optional().default("overwrite").describe(
274
+ "For 'set' action: 'overwrite' = PATCH (replace existing, default), 'append' = POST (add to arrays, create on objects), 'insert' = PUT (insert at array index)"
275
+ )
273
276
  },
274
277
  { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
275
- async ({ id, action, value, subpath }) => {
278
+ async ({ id, action, value, subpath, mode }) => {
276
279
  if (action === "get") {
277
280
  return formatResult(await configByIdGet(id, subpath));
278
281
  }
@@ -283,7 +286,8 @@ function registerConfigTools(server) {
283
286
  content: [{ type: "text", text: "Error: value is required for 'set' action" }]
284
287
  };
285
288
  }
286
- return formatResult(await configByIdSet(id, value, "PATCH", subpath));
289
+ const method = mode === "append" ? "POST" : mode === "insert" ? "PUT" : "PATCH";
290
+ return formatResult(await configByIdSet(id, value, method, subpath));
287
291
  }
288
292
  if (action === "delete") {
289
293
  return formatResult(await configByIdDelete(id, subpath));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/caddy-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for managing Caddy web servers via the admin API",
5
5
  "license": "MIT",
6
6
  "author": "Yaw Labs <contact@yaw.sh> (https://yaw.sh)",
@@ -31,6 +31,7 @@
31
31
  "typecheck": "tsc --noEmit",
32
32
  "test:ci": "npm run build && npm test",
33
33
  "prepublishOnly": "npm run build",
34
+ "prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
34
35
  "start": "node dist/index.js"
35
36
  },
36
37
  "dependencies": {