neozip-mcp 0.1.0-beta

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 (113) hide show
  1. package/.cursor/mcp.json.global.example +10 -0
  2. package/CHANGELOG.md +16 -0
  3. package/DOCUMENTATION.md +40 -0
  4. package/LICENSE +16 -0
  5. package/README.md +223 -0
  6. package/SECURITY.md +37 -0
  7. package/dist/account/account-state.js +86 -0
  8. package/dist/account/format-account-status.js +37 -0
  9. package/dist/account/identity-provision.js +75 -0
  10. package/dist/account/identity-wrap.js +69 -0
  11. package/dist/account/profile-crypto.js +47 -0
  12. package/dist/account/profile-store.js +108 -0
  13. package/dist/account/require-account.js +29 -0
  14. package/dist/account/token-service-identity.js +395 -0
  15. package/dist/account/types.js +2 -0
  16. package/dist/account/wallet-evm.js +39 -0
  17. package/dist/archive/blockchain-status.js +303 -0
  18. package/dist/archive/crypto-self.js +114 -0
  19. package/dist/archive/detect-text.js +56 -0
  20. package/dist/archive/embed-metadata.js +283 -0
  21. package/dist/archive/encryption.js +166 -0
  22. package/dist/archive/extract-entry-buffer.js +18 -0
  23. package/dist/archive/find-entry.js +21 -0
  24. package/dist/archive/grep-content.js +141 -0
  25. package/dist/archive/identity-key.js +176 -0
  26. package/dist/archive/manifest.js +55 -0
  27. package/dist/archive/merkle.js +31 -0
  28. package/dist/archive/metadata-paths.js +14 -0
  29. package/dist/archive/mint-archive.js +61 -0
  30. package/dist/archive/open-archive.js +23 -0
  31. package/dist/archive/read-entry-buffer.js +11 -0
  32. package/dist/archive/read-entry-content.js +51 -0
  33. package/dist/archive/recipient-access.js +26 -0
  34. package/dist/archive/recipient-decrypt.js +21 -0
  35. package/dist/archive/recipient-lookup.js +55 -0
  36. package/dist/archive/timestamp-network.js +54 -0
  37. package/dist/config/capabilities.js +37 -0
  38. package/dist/config/index.js +74 -0
  39. package/dist/connect-cli.js +312 -0
  40. package/dist/connection/coordinator.js +74 -0
  41. package/dist/connection/credentials.js +29 -0
  42. package/dist/connection/crypto.js +56 -0
  43. package/dist/connection/dump.js +79 -0
  44. package/dist/connection/incomplete-setup.js +81 -0
  45. package/dist/connection/interactive.js +814 -0
  46. package/dist/connection/legacy-profile-reader.js +47 -0
  47. package/dist/connection/magic-link.js +138 -0
  48. package/dist/connection/migrate.js +76 -0
  49. package/dist/connection/onboarding.js +524 -0
  50. package/dist/connection/origin.js +63 -0
  51. package/dist/connection/phase.js +93 -0
  52. package/dist/connection/phone.js +20 -0
  53. package/dist/connection/promote-active.js +53 -0
  54. package/dist/connection/reset.js +20 -0
  55. package/dist/connection/setup-guidance.js +154 -0
  56. package/dist/connection/status-report.js +40 -0
  57. package/dist/connection/store.js +352 -0
  58. package/dist/connection/token-auth.js +42 -0
  59. package/dist/connection/types.js +2 -0
  60. package/dist/connection/wallet-setup.js +70 -0
  61. package/dist/constants/wallet-identity.js +11 -0
  62. package/dist/index.js +47 -0
  63. package/dist/load-env.js +16 -0
  64. package/dist/neozipkit-node.js +11 -0
  65. package/dist/register/resources.js +14 -0
  66. package/dist/register/tools.js +77 -0
  67. package/dist/resources/zip-resource.js +40 -0
  68. package/dist/resources/zip-uri.js +23 -0
  69. package/dist/security/auth.js +28 -0
  70. package/dist/security/capabilities.js +85 -0
  71. package/dist/security/rate-limiter.js +43 -0
  72. package/dist/security/resource-limiter.js +44 -0
  73. package/dist/security/sandbox.js +61 -0
  74. package/dist/server.js +32 -0
  75. package/dist/startup-account-gate.js +101 -0
  76. package/dist/startup-summary.js +40 -0
  77. package/dist/token-service/require-configured.js +23 -0
  78. package/dist/tools/account.js +504 -0
  79. package/dist/tools/compress.js +237 -0
  80. package/dist/tools/connect-status.js +143 -0
  81. package/dist/tools/extract.js +62 -0
  82. package/dist/tools/grep-entries.js +42 -0
  83. package/dist/tools/identity-status.js +157 -0
  84. package/dist/tools/info.js +147 -0
  85. package/dist/tools/list.js +118 -0
  86. package/dist/tools/lookup-recipient.js +37 -0
  87. package/dist/tools/mint.js +41 -0
  88. package/dist/tools/read-entry.js +35 -0
  89. package/dist/tools/search-entries.js +71 -0
  90. package/dist/tools/stamp.js +60 -0
  91. package/dist/tools/test.js +90 -0
  92. package/dist/tools/token-service-account.js +143 -0
  93. package/dist/tools/upgrade.js +60 -0
  94. package/dist/tools/verify.js +75 -0
  95. package/dist/tools/wallet-config-status.js +119 -0
  96. package/dist/tools/wallet-info.js +64 -0
  97. package/dist/translators/index.js +106 -0
  98. package/dist/types/index.js +7 -0
  99. package/dist/util/mask.js +30 -0
  100. package/dist/util/token-service-fetch.js +23 -0
  101. package/dist/vendor/neozipkit-pro.js +3 -0
  102. package/docs/NEOZIP_CONNECTION_STORE.md +238 -0
  103. package/docs/NEOZIP_CONNECT_CLI.md +185 -0
  104. package/docs/OPERATIONS.md +992 -0
  105. package/docs/examples/CLAUDE.md.example +22 -0
  106. package/docs/examples/claude/skills/neozip-mcp/SKILL.md +54 -0
  107. package/docs/examples/claude/skills/neozip-notarization/SKILL.md +75 -0
  108. package/docs/examples/mcp.json.claude.example +11 -0
  109. package/docs/examples/neozip-mcp-cursor-rule.mdc +31 -0
  110. package/docs/installation-guides/INSTALL_CLAUDE_CODE.md +286 -0
  111. package/docs/installation-guides/INSTALL_CLAUDE_WORKSPACE.md +301 -0
  112. package/docs/installation-guides/README.md +76 -0
  113. package/package.json +99 -0
@@ -0,0 +1,185 @@
1
+ # NeoZip Connect CLI
2
+
3
+ `neozip-connect` is published with the `neozip-mcp` npm package. It registers a NeoZip account on a Token Service, provisions a Data Wallet and X25519 identity, and writes a **connection store** under `~/.neozip/connection/`.
4
+
5
+ The MCP server reads that store at startup; it does **not** shell out to the CLI during normal operation.
6
+
7
+ For field-level schema details, see [NEOZIP_CONNECTION_STORE.md](./NEOZIP_CONNECTION_STORE.md). The canonical schema is in [NEOZIP_CONNECTION_FILE.md](https://github.com/neoware/neozip-token-service/blob/main/docs/NEOZIP_CONNECTION_FILE.md) (neozip-token-service).
8
+
9
+ ---
10
+
11
+ ## Connection store
12
+
13
+ | Override | Default |
14
+ |----------|---------|
15
+ | `NEOZIP_CONNECTION_DIR` | `~/.neozip/connection/` |
16
+
17
+ Each saved account is a **connection** — one email + wallet + identity bound to one Token Service deployment. You can store multiple connections on one machine.
18
+
19
+ ```
20
+ ~/.neozip/connection/
21
+ ├── manifest.json # Index + active account
22
+ └── connections/
23
+ └── <connection-uuid>/
24
+ ├── public.json # Non-secret metadata (plain JSON)
25
+ └── secrets.enc # Encrypted credentials (AES-256-GCM)
26
+ ```
27
+
28
+ | File | Contents |
29
+ |------|----------|
30
+ | `manifest.json` | Connection IDs grouped by Token Service origin; which connection is **active** for MCP |
31
+ | `public.json` | Label, `tokenServiceOrigin`, verified email, EVM address, wallet/identity IDs, X25519 public key fingerprint, onboarding phase timestamps |
32
+ | `secrets.enc` | Encrypted Bearer access token and EVM private key |
33
+
34
+ Inspect without secrets:
35
+
36
+ ```bash
37
+ neozip-connect dump
38
+ neozip-connect status --verbose
39
+ ```
40
+
41
+ A connection reaches **`phase: ready`** when email is verified, the wallet is linked, and the X25519 identity is provisioned. MCP loads the active ready connection for timestamp, tokenize, mint, stamp, and recipient encryption.
42
+
43
+ ### Encryption
44
+
45
+ By default, `secrets.enc` is encrypted with a **machine-local key** (hostname + username). No setup step is required on a trusted machine.
46
+
47
+ Optional — set a custom passphrase when you need portable encryption across machines or users:
48
+
49
+ ```bash
50
+ export NEOZIP_UNLOCK_PASSPHRASE='your-secret-passphrase'
51
+ ```
52
+
53
+ Use the same value for both `neozip-connect` and `neozip-mcp` when you set a custom passphrase.
54
+
55
+ **Recovery phrase vs unlock passphrase:** When you create a new Data Wallet, the wizard shows your **wallet recovery phrase** once (for restoring the wallet). `NEOZIP_UNLOCK_PASSPHRASE` only encrypts files under `~/.neozip/connection/` — it is not the wallet recovery phrase.
56
+
57
+ Optional Token Service default during setup:
58
+
59
+ ```bash
60
+ export TOKEN_SERVICE_URL='https://testnet.token-service.neozip.io'
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Interactive wizard
66
+
67
+ Run **`neozip-connect`** with no subcommand (or `neozip-connect wizard`) for the interactive flow:
68
+
69
+ 1. Choose a Token Service deployment
70
+ 2. Register and verify email (6-digit OTP)
71
+ 3. Create or import a Data Wallet
72
+ 4. Link the wallet and provision the X25519 identity
73
+
74
+ The Token Service step offers:
75
+
76
+ 1. NeoZip Testnet (`https://testnet.token-service.neozip.io`) — default
77
+ 2. NeoZip Production (`https://token-service.neozip.io`)
78
+ 3. Local Development (`http://localhost:14789`)
79
+ 4. Custom URL
80
+
81
+ When you choose **Create new wallet**, the wizard shows your **recovery phrase once** and asks you to confirm you have saved it before continuing.
82
+
83
+ After a verification code is sent, enter the **6-digit code** at the prompt. Type **`r`** to resend, **`c`** to change email, or **`a`** to abort setup.
84
+
85
+ When an account is already set up, the wizard shows account status and asks whether to finish, add another account on the same or a different Token Service, delete an account, switch the active account (when multiple are saved), or **show connection JSON** (manifest + `public.json`, no secrets).
86
+
87
+ If adding an account fails (e.g. local Token Service not running), the wizard **rolls back** to your previous ready account and removes the incomplete shell. If you still have an incomplete account active, the wizard offers **continue / delete / switch to ready** instead of exiting.
88
+
89
+ ---
90
+
91
+ ## Commands
92
+
93
+ All subcommands support `--json` for machine-readable stdout. Errors go to stderr; exit code is non-zero on failure.
94
+
95
+ | Command | Purpose |
96
+ |---------|---------|
97
+ | `neozip-connect` | Interactive wizard (default) |
98
+ | `neozip-connect wizard` | Same as no subcommand |
99
+ | `neozip-connect status [--verbose]` | Phase, paths; `--verbose` lists all saved accounts |
100
+ | `neozip-connect select --connection-id ID` | Set active connection |
101
+ | `neozip-connect rename --label NAME [--connection-id ID]` | Rename a saved connection |
102
+ | `neozip-connect dump [--connection-id ID]` | Print manifest + all `public.json` files as JSON |
103
+ | `neozip-connect register --email user@example.com [--resend]` | Send email OTP (`verificationDelivery: cli`, code only) |
104
+ | `neozip-connect verify --email user@example.com --code 123456` | Verify email → store Bearer in `secrets.enc` |
105
+ | `neozip-connect verify --magic-token LINK_OR_TOKEN` | Verify via pasted magic link URL, `email=…&code=…`, or opaque token |
106
+ | `neozip-connect phone request --phone +14155551234` | Send SMS OTP (when Token Service requires phone verification) |
107
+ | `neozip-connect phone verify --phone +14155551234 --code 123456` | Verify phone → store verified phone on connection |
108
+ | `neozip-connect wallet create --ack-backup` | Generate EOA (requires backup acknowledgment) |
109
+ | `neozip-connect wallet import-mnemonic --mnemonic "…"` | Import wallet from recovery phrase |
110
+ | `neozip-connect wallet import-key --private-key 0x…` | Import wallet from private key |
111
+ | `neozip-connect finish [--create-wallet]` | Link wallet + identity init (does not auto-create wallet unless `--create-wallet`) |
112
+ | `neozip-connect setup --email … --code …` | Verify + finish when code is already known |
113
+ | `neozip-connect logout` | Clear secrets for active connection |
114
+ | `neozip-connect delete [--connection-id ID]` | Remove a saved account from disk |
115
+ | `neozip-connect migrate` | Import legacy `~/.neozip/mcp/` profiles |
116
+ | `neozip-connect reset --force` | Delete connection + legacy profile dirs (start over) |
117
+
118
+ Reset locally:
119
+
120
+ ```bash
121
+ pnpm connect:reset --force
122
+ # or: bash scripts/connect-reset.sh --force
123
+ ```
124
+
125
+ Global flags:
126
+
127
+ - `--token-service-url URL` — override Token Service base URL
128
+ - `--label NAME` — optional override for the saved connection display name (interactive wizard derives this from the deployment choice)
129
+ - `--verbose` / `-v` — on `status`, include per-account details (label, email, phase, active marker)
130
+ - `--resend` — on `register`, re-send the email verification code
131
+ - `--magic-token` — on `verify`, accept a full magic link URL, `email=…&code=…` query string, or opaque exchange token
132
+ - `--connection-id ID` — target a specific saved connection (`select`, `rename`, `delete`, `dump`)
133
+
134
+ ---
135
+
136
+ ## AI / agent flow
137
+
138
+ 1. `neozip-connect register --email user@example.com --json`
139
+ 2. User pastes OTP from email into chat (or full magic link via `verify --magic-token …`)
140
+ 3. `neozip-connect verify --email user@example.com --code 123456 --json`
141
+ 4. `neozip-connect wallet create --ack-backup --json` (or import-mnemonic / import-key)
142
+ 5. `neozip-connect finish --json`
143
+ 6. User reloads MCP in Cursor Settings
144
+
145
+ Or single step when the code is known:
146
+
147
+ ```bash
148
+ neozip-connect setup --email user@example.com --code 123456 --json
149
+ ```
150
+
151
+ ### JSON response shape
152
+
153
+ ```json
154
+ {
155
+ "success": true,
156
+ "phase": "awaiting_code",
157
+ "connectionId": "uuid",
158
+ "tokenServiceOrigin": "https://testnet.token-service.neozip.io",
159
+ "nextCommand": "neozip-connect verify --email user@example.com --code 123456",
160
+ "message": "Verification code sent."
161
+ }
162
+ ```
163
+
164
+ No Bearer tokens or private keys appear in CLI output.
165
+
166
+ ---
167
+
168
+ ## Migration from `~/.neozip/mcp/`
169
+
170
+ Legacy MCP-only profiles are imported automatically on first `neozip-connect status`, or manually:
171
+
172
+ ```bash
173
+ neozip-connect migrate --json
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Development
179
+
180
+ ```bash
181
+ pnpm connect status --json
182
+ pnpm connect register --email you@example.com --json
183
+ ```
184
+
185
+ Interactive wizard (deprecated): `pnpm init` / `bash scripts/mcp-init.sh` (delegates to the same flow as bare `neozip-connect`).