@moor-sh/mcp 0.16.0 → 0.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.ts +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moor-sh/mcp",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "MCP server for moor - lets AI agents (Claude Code, Cursor, etc.) manage your moor projects via the moor HTTP API.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/index.ts CHANGED
@@ -782,6 +782,34 @@ server.registerTool(
782
782
  },
783
783
  );
784
784
 
785
+ // #90: operator-initiated DB snapshot. Uses VACUUM INTO on the server so
786
+ // hot WAL state is captured safely (cp would copy a corrupt-looking file).
787
+ // Backups land next to moor.db; retention prunes to the N most recent.
788
+ // Pair with MOOR_DB_BACKUP_INTERVAL_HOURS for scheduled snapshots — this
789
+ // tool is for taking one right before a manual update.
790
+ server.registerTool(
791
+ "moor_db_backup",
792
+ {
793
+ title: "DB Backup (snapshot)",
794
+ description:
795
+ "Take a SQLite snapshot of moor.db via VACUUM INTO. The file lands next to the main DB as moor.db.backup-<epoch-ms>. Retention is enforced after each snapshot (keeps the 7 most recent by default; older ones are pruned). After this returns, moor_update_status' db_backup.age_seconds will read close to 0. Use before a manual `docker compose pull moor && up -d` if you don't have MOOR_DB_BACKUP_INTERVAL_HOURS scheduled.",
796
+ },
797
+ async () => {
798
+ const res = await apiPost("/api/server/backup", {});
799
+ if (!res.ok) throw new Error(`db backup failed: ${res.status} ${await res.text()}`);
800
+ const r = (await res.json()) as { path: string; sizeBytes: number; durationMs: number };
801
+ const mb = (r.sizeBytes / (1024 * 1024)).toFixed(2);
802
+ return {
803
+ content: [
804
+ {
805
+ type: "text",
806
+ text: `Snapshot written: ${r.path}\nsize: ${r.sizeBytes}B (${mb} MB)\nduration: ${r.durationMs}ms`,
807
+ },
808
+ ],
809
+ };
810
+ },
811
+ );
812
+
785
813
  server.registerTool(
786
814
  "moor_cleanup_plan",
787
815
  {