naro-mcp 0.7.0 → 0.9.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 (3) hide show
  1. package/README.md +29 -16
  2. package/dist/index.js +1318 -128
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -3,8 +3,8 @@
3
3
  MCP server that lets AI agents (Claude Code, Cursor, Codex, ChatGPT, …)
4
4
  operate [Naro](https://naro.sh): deploy projects, read build/runtime logs,
5
5
  manage environment variables and domains, promote and roll back, and work
6
- with the project's database (SQL, migrations, types) — the same control
7
- plane API the `naro` CLI uses, via the shared SDK.
6
+ with the project's database (SQL, migrations, types, export and restore) —
7
+ the same control plane API the `naro` CLI uses, via the shared SDK.
8
8
 
9
9
  Deployable projects: Next.js **15 or newer** (Next 14 and below are not
10
10
  supported), Vite, Create React App and plain static sites.
@@ -52,20 +52,23 @@ Headless/CI agents can skip `naro login` and set a token instead:
52
52
 
53
53
  ## Tools
54
54
 
55
- | Tool | Purpose |
56
- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
57
- | `whoami`, `list_teams` | Account / team context |
58
- | `list_projects`, `get_project`, `link_project` | Project discovery + `.naro/project.json` linking |
59
- | `deploy` | Local Next.js build → upload → live URL (preview or `production: true`). Local .env files are never uploaded; unset keys come back as `missingEnvKeys` |
60
- | `list_deployments`, `get_deployment` | Deployment status / history |
61
- | `get_build_logs`, `get_runtime_logs` | Debugging failed builds and live workers |
62
- | `list_environment_variables`, `set_environment_variable`, `remove_environment_variable` | Env management (secret values never returned) |
63
- | `list_domains`, `add_domain`, `verify_domain`, `remove_domain` | Custom domains: every DNS record to create, plus a re-check that says which of ownership / certificate / routing is still missing. An apex is attached as an apex+www pair by default (`withWww: false` to opt out) |
64
- | `promote_deployment`, `rollback_deployment` | Production traffic control |
65
- | `cancel_deployment` | Stops a build that is still running (QUEUED–BUILDING). Does not undo a deployment that already went live — use `rollback_deployment` for that |
66
- | `enable_database`, `get_database`, `list_tables` | The project's D1 database: turn it on, status/size/limits, schema (verbose: true for columns, indexes and foreign keys) |
67
- | `execute_sql` | Run SQL (argument `query`, optional `params` for a single statement; several statements run as one transaction). Destructive; under `--read-only` it stays but accepts a single read statement only |
68
- | `apply_migration`, `list_migrations`, `generate_typescript_types` | Numbered migrations in the `d1_migrations` ledger wrangler also uses (each file all-or-nothing), and TypeScript types for the schema (text only) |
55
+ | Tool | Purpose |
56
+ | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
57
+ | `whoami`, `list_teams` | Account / team context |
58
+ | `list_projects`, `get_project`, `link_project` | Project discovery + `.naro/project.json` linking |
59
+ | `deploy` | Local Next.js build → upload → live URL (preview or `production: true`). Local .env files are never uploaded; unset keys come back as `missingEnvKeys` |
60
+ | `list_deployments`, `get_deployment` | Deployment status / history |
61
+ | `get_build_logs`, `get_runtime_logs` | Debugging failed builds and live workers |
62
+ | `list_environment_variables`, `set_environment_variable`, `remove_environment_variable` | Env management (secret values never returned) |
63
+ | `list_domains`, `add_domain`, `verify_domain`, `remove_domain` | Custom domains: every DNS record to create, plus a re-check that says which of ownership / certificate / routing is still missing. An apex is attached as an apex+www pair by default (`withWww: false` to opt out) |
64
+ | `promote_deployment`, `rollback_deployment` | Production traffic control |
65
+ | `cancel_deployment` | Stops a build that is still running (QUEUED–BUILDING). Does not undo a deployment that already went live — use `rollback_deployment` for that |
66
+ | `enable_database`, `get_database`, `list_tables` | The project's D1 database: turn it on, status/size/limits, schema (verbose: true for columns, indexes and foreign keys) |
67
+ | `execute_sql` | Run SQL (argument `query`, optional `params` for a single statement; several statements run as one transaction). Destructive; under `--read-only` it stays but accepts a single read statement only |
68
+ | `apply_migration`, `list_migrations`, `generate_typescript_types` | Numbered migrations in the `d1_migrations` ledger wrangler also uses (each file all-or-nothing), and TypeScript types for the schema (text only; its `Database` is what `createClient<Database>()` from `@naro/sdk` takes) |
69
+ | `create_table`, `alter_table`, `drop_table`, `create_index`, `drop_index` | Schema changes without SQL: naro renders checked DDL, applies it as one numbered migration (`NNNN_schema_<op>_<table>.sql`) and writes the file like `apply_migration`. `alter_table` adds, renames or drops a column or renames the table. Dropping a table or column needs `confirm`; `alter_table`, `drop_table` and `drop_index` are destructive and hidden under `--read-only`. `dryRun: true` returns the SQL only |
70
+ | `export_database` | SQL dump of the database (`schemaOnly`, `dataOnly`, `tables`): waits up to 5 minutes and returns a signed download link plus `atBookmark`, the point the dump reflects |
71
+ | `restore_database` | Time Travel restore to a `bookmark` or a `timestamp` (last 30 days). Destructive; hidden under `--read-only`. Returns `previousBookmark`, which undoes it |
69
72
 
70
73
  Destructive tools say so in their descriptions; agents should confirm with
71
74
  the user before calling them. Domain tools return server-computed
@@ -98,6 +101,16 @@ a startup error rather than "last one wins". The flag beats
98
101
  `NARO_MCP_FEATURES`, but a non-empty `NARO_MCP_FEATURES` is still checked, so
99
102
  a typo there stops the server even when the flag overrides it.
100
103
 
104
+ `export_database` stalls the database while it runs: Cloudflare holds every
105
+ other query to it until the export finishes. The `file.url` it returns is a
106
+ presigned link that works for about an hour, and anyone who has it can
107
+ download the whole dump — never paste it anywhere public. While the database
108
+ has virtual tables (FTS5), a full or schema-only export is refused
109
+ (`DATABASE_EXPORT_FAILED`); export the other tables with `tables` instead.
110
+ `restore_database` rolls back every write after the chosen point, the
111
+ `d1_migrations` ledger included, and cancels queries in flight; calling it
112
+ again with the `previousBookmark` it returned undoes it.
113
+
101
114
  `apply_migration` writes its `NNNN_name.sql` file only inside the linked
102
115
  project directory. Symlinks are resolved first: a `rootDirectory` (or a
103
116
  `migrations` folder) that is a link leading out of the project — every