@safekb/mcp 0.4.0 → 0.5.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/README.md +99 -9
- package/dist/safekb-mcp.js +3809 -3063
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,8 +21,10 @@ npx -y @safekb/mcp --setup
|
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
This opens the same page, then registers the server with Claude Code for all your projects
|
|
24
|
-
(`claude mcp add --scope user safekb`). What is already done is left as it
|
|
25
|
-
|
|
24
|
+
(`claude mcp add --scope user safekb -- npx -y @safekb/mcp --mcp`). What is already done is left as it
|
|
25
|
+
is, so it can be run again. A registration that `--setup` of a version before 0.5.0 wrote no longer
|
|
26
|
+
starts the server and is written again with `--mcp` and the arguments it had (see
|
|
27
|
+
[Upgrading to 0.5.0](#upgrading-to-050)). Needs Node 20 or newer.
|
|
26
28
|
|
|
27
29
|
Over SSH, or anywhere without a browser, the command prints a link instead. Open it on any device, sign
|
|
28
30
|
in and approve; the terminal then shows the account and a code, and you answer `y` when they match what
|
|
@@ -31,13 +33,30 @@ your browser shows.
|
|
|
31
33
|
### Other MCP clients (Cursor, …)
|
|
32
34
|
|
|
33
35
|
```json
|
|
34
|
-
{ "mcpServers": { "safekb": { "command": "npx", "args": ["-y", "@safekb/mcp"] } } }
|
|
36
|
+
{ "mcpServers": { "safekb": { "command": "npx", "args": ["-y", "@safekb/mcp", "--mcp"] } } }
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
`--mcp` is what starts the MCP server. Without any argument the command prints its usage text and exits.
|
|
40
|
+
|
|
41
|
+
Started with `--mcp` but without a token, the client serves one tool, `connect_safekb`, which opens the page and puts
|
|
38
42
|
the SafeKB tools in its place once you have confirmed. `SAFEKB_MCP_NO_BROWSER=1` makes it show the link
|
|
39
43
|
instead of opening a browser.
|
|
40
44
|
|
|
45
|
+
### Upgrading to 0.5.0
|
|
46
|
+
|
|
47
|
+
Until 0.4.0 the bare command started the MCP server. From 0.5.0 it prints the usage text, and the
|
|
48
|
+
server is started by `--mcp`. A client configured with `"args": ["-y", "@safekb/mcp"]` therefore gets
|
|
49
|
+
no tools after the upgrade:
|
|
50
|
+
|
|
51
|
+
- Claude Code: run `npx -y @safekb/mcp --setup` again. What an older `--setup` registered (user scope,
|
|
52
|
+
`npx -y @safekb/mcp`, with or without `--config`) is registered again with `--mcp`. A registration
|
|
53
|
+
you made or changed yourself (other arguments, environment entries, local or project scope, a
|
|
54
|
+
pinned version, the `safekb-mcp` program) is not touched: the command stops and prints the two
|
|
55
|
+
`claude mcp` commands that add `--mcp` to it. A registration pinned to an exact version below 0.5.0
|
|
56
|
+
(`@safekb/mcp@0.4.0`) keeps working without `--mcp` and is left as it is.
|
|
57
|
+
- Claude Desktop: install the current `safekb.mcpb`.
|
|
58
|
+
- Other clients: add `"--mcp"` to the `args` in their MCP config.
|
|
59
|
+
|
|
41
60
|
### A self-hosted SafeKB
|
|
42
61
|
|
|
43
62
|
The default server is `https://api.safekb.com`. For another one run
|
|
@@ -70,6 +89,7 @@ every tool that keeps a key this way; see [Where secrets are kept](#where-secret
|
|
|
70
89
|
|
|
71
90
|
| Flag | Environment | Meaning |
|
|
72
91
|
| --- | --- | --- |
|
|
92
|
+
| `--mcp` | | Start the MCP server on stdio. Modified by `--url`, `--keyring`, `--sealed-only` and `--sidecar-socket`. |
|
|
73
93
|
| `--setup` | | Authorize, choose the key store and register with Claude Code, in one step. Safe to repeat. |
|
|
74
94
|
| `--url <api url>` | `KB_API_URL` | API base URL. Otherwise the URL in the token file, or `https://api.safekb.com` when authorizing. When serving, it must have the origin the token was issued for: the token is never sent anywhere else. |
|
|
75
95
|
| `--config <path>` | `SAFEKB_MCP_CONFIG` | Token file. Default `~/.config/safekb/mcp.json`. Use one per project for per-project access. |
|
|
@@ -81,10 +101,21 @@ every tool that keeps a key this way; see [Where secrets are kept](#where-secret
|
|
|
81
101
|
| `--sidecar-socket <path>` | `SAFEKB_SIDECAR_SOCKET` | The sidecar's socket. Default `sidecar.sock` next to the token file. |
|
|
82
102
|
| `--export-keys <file>` | | Write every sealed key this machine keeps to a new passphrase-protected file. See [Moving keys to another machine](#moving-keys-to-another-machine). |
|
|
83
103
|
| `--import-keys <file>` | | Read such a file and keep its keys on this machine. |
|
|
104
|
+
| `--list-keys` | | Print the sealed keys this machine keeps and how each stands with the server. See [Managing keys](#managing-keys). |
|
|
105
|
+
| `--create-key <name>` | | Create a sealed folder as a new seal root with a generated key. Needs `--space <space id>`; takes `--store`. |
|
|
106
|
+
| `--rename-key <ref>` | | Rename a seal root to `--name <new name>`. |
|
|
107
|
+
| `--rotate-key <ref>` | | Replace a seal root's secret with a new generated key; takes `--store`. |
|
|
108
|
+
| `--move-key <ref>` | | Move a seal root's current key to `--store system\|file`. |
|
|
109
|
+
| `--delete-key <ref>` | | Remove a seal root's keys from this machine, after a typed confirmation. |
|
|
84
110
|
| | `SAFEKB_SEALED_IDLE_TTL` | Seconds an unlocked seal root may stay idle. Default 900. `unlock_sealed` can set it per root with `idle_ttl_seconds` (60 to 3600). |
|
|
85
111
|
| | `SAFEKB_HOSTED_TIMEOUT` | Seconds a hosted tool call may take. Default 300. |
|
|
86
112
|
| | `SAFEKB_MCP_NO_BROWSER` | Set to anything: never start a browser, only show the authorize link. |
|
|
87
113
|
|
|
114
|
+
Exactly one mode is given: `--mcp`, `--setup`, `--authorize`, `--configure`, `--sidecar`, or one of the
|
|
115
|
+
key modes. A flag that only modifies a mode (`--sealed-only`, `--keyring`, …) without one is an error;
|
|
116
|
+
it never starts the server by itself. A flag the given mode does not take is an error too, as is a
|
|
117
|
+
mode without the value or the modifier it needs, and any flag given an empty value.
|
|
118
|
+
|
|
88
119
|
With a token file, the client refuses to start when that file or a keyring file is readable by group or others,
|
|
89
120
|
when `--url` names another origin than the token's, when the hosted endpoint cannot be reached, or
|
|
90
121
|
when a hosted tool has the name of a sealed tool.
|
|
@@ -106,6 +137,14 @@ Its secret is a generated key or a passphrase.
|
|
|
106
137
|
`update_sealed_document`, `replace_in_sealed_document`, and the move, archive, delete, export,
|
|
107
138
|
attachment and deposit tools.
|
|
108
139
|
- `lock_sealed`, the idle timeout, or the end of the process forget the keys.
|
|
140
|
+
- `change_seal_password` replaces the root's secret. Once the server has taken the new one, the
|
|
141
|
+
superseded key is removed from the store that kept it (the system keyring, or any key file in the
|
|
142
|
+
key file directory). A superseded passphrase, or a key file you had written elsewhere with
|
|
143
|
+
`key_out_path`, is yours to remove.
|
|
144
|
+
- Deleting a seal root (`delete_sealed_document`, or `export_sealed_document` of a standalone sealed
|
|
145
|
+
document) also removes its keys and its name from this machine.
|
|
146
|
+
- A tool parameter that names a seal root (`root_id`, `new_root_id`) takes its id or its
|
|
147
|
+
[name](#names-of-seal-roots). Documents and folders inside a root are named by id.
|
|
109
148
|
|
|
110
149
|
## Where secrets are kept
|
|
111
150
|
|
|
@@ -155,14 +194,65 @@ ask it for a held secret, which is what `--confirm` is for.
|
|
|
155
194
|
|
|
156
195
|
The server cannot read the name of a sealed folder, and an id like `6acdb031893533e0ae1f5456` is no
|
|
157
196
|
name to type. So the client remembers the name of every seal root it creates or unlocks, in
|
|
158
|
-
`roots.json` next to the token file (mode 0600), and follows a rename or a delete. The sidecar
|
|
159
|
-
the key
|
|
197
|
+
`roots.json` next to the token file (mode 0600), and follows a rename or a delete. The sidecar, the
|
|
198
|
+
key export and the key modes show a root as `"Tax papers" (6acd…)`, and the name is taken wherever a
|
|
199
|
+
seal root's id is: at the sidecar, in the key modes, and in the `root_id` of the MCP tools.
|
|
160
200
|
|
|
161
201
|
- The names are in plaintext in that file: readable on this machine by programs running as you,
|
|
162
202
|
never by the server. Delete the file to forget them; they come back as roots are unlocked.
|
|
163
|
-
-
|
|
164
|
-
|
|
165
|
-
-
|
|
203
|
+
- The client never puts a name into a tool result, so unlocking a root does not tell the model what
|
|
204
|
+
it is called. An error repeats only the name the caller passed.
|
|
205
|
+
- A name stays a usable handle: creating or renaming a seal root is refused when the name has the
|
|
206
|
+
shape of an id (24 hex characters), or when another root known on this machine already has it.
|
|
207
|
+
- Text with the shape of an id always means the root with that id. A root that got such a title
|
|
208
|
+
elsewhere is not given a name here when it is unlocked or its key is imported: use its id.
|
|
209
|
+
- Two roots can still share a name when both were named elsewhere and then unlocked or imported
|
|
210
|
+
here. Such a name stands for neither and is refused as ambiguous: use the id. Such a root can
|
|
211
|
+
still be changed while its name stays the same.
|
|
212
|
+
|
|
213
|
+
### Managing keys
|
|
214
|
+
|
|
215
|
+
```sh
|
|
216
|
+
npx -y @safekb/mcp --list-keys
|
|
217
|
+
npx -y @safekb/mcp --create-key "Banking" --space <space id> [--store system|file]
|
|
218
|
+
npx -y @safekb/mcp --rename-key "Banking" --name "Bank"
|
|
219
|
+
npx -y @safekb/mcp --rotate-key "Bank" [--store system|file]
|
|
220
|
+
npx -y @safekb/mcp --move-key "Bank" --store file
|
|
221
|
+
npx -y @safekb/mcp --delete-key "Bank"
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
A seal root is given by its [name](#names-of-seal-roots) or its id.
|
|
225
|
+
|
|
226
|
+
- `--list-keys` prints one line per key in the system keyring and the key file directory: the store,
|
|
227
|
+
the seal root, the key id, and its status. `current`: the root's seal expects this key.
|
|
228
|
+
`superseded`: the root exists but has a newer key. `root not found or not accessible with this
|
|
229
|
+
token`: the server knows no such root for this token (404 or 403), which may be limited to some
|
|
230
|
+
spaces. `its root id is not a seal root on the server`: the id is that of something else.
|
|
231
|
+
A key of another tenant is shown as such and is not asked about. When the server cannot be asked
|
|
232
|
+
(rejected token, server error, no network) the listing fails; a status is never guessed. It never
|
|
233
|
+
prints a key, and needs no terminal. Secrets held by the sidecar are in memory only and are not
|
|
234
|
+
listed.
|
|
235
|
+
- `--create-key` makes a sealed folder at the top of the space as a new seal root and keeps its
|
|
236
|
+
generated key in the default store, or the one named by `--store`.
|
|
237
|
+
- `--rename-key` changes the root's sealed title on the server and the name on this machine. The
|
|
238
|
+
root's key must be in a local store.
|
|
239
|
+
- `--rotate-key` gives the root a newly generated key, in the store that kept the old one or the one
|
|
240
|
+
named by `--store`, and removes the superseded key once the server has taken the new one. Like
|
|
241
|
+
`change_seal_password`, it does not revoke what a holder of the old key already read.
|
|
242
|
+
- `--move-key` puts the root's current key into the other store, reads it back from there, and only
|
|
243
|
+
then removes it from where it was. Nothing is written to the server. A move that was interrupted
|
|
244
|
+
with the key in both stores is finished by running it again, towards either store.
|
|
245
|
+
- `--delete-key` removes every key of the root from this machine's key stores and forgets its name.
|
|
246
|
+
The root on the server is not touched. It shows the keys with their status and asks you to type
|
|
247
|
+
the root's name or id. It warns when a current key is among them (without another copy the root's
|
|
248
|
+
content can never be opened again), and when a key's status could not be verified with this token
|
|
249
|
+
(root not found or not accessible, another tenant, not a seal root): such a key may still be the
|
|
250
|
+
only one that opens existing content. Only keys the server says are superseded come without a
|
|
251
|
+
warning. A name left behind without any key is removed the same way. It needs a terminal, and no
|
|
252
|
+
flag skips the question.
|
|
253
|
+
|
|
254
|
+
When a step after the point of no return fails (the superseded key cannot be removed after a rotation,
|
|
255
|
+
the old copy cannot be removed after a move), the command fails and says where the key now is.
|
|
166
256
|
|
|
167
257
|
### Moving keys to another machine
|
|
168
258
|
|