@formstr/mcp 0.3.2 → 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 CHANGED
@@ -21,9 +21,27 @@ npx -y @formstr/mcp login
21
21
  ```
22
22
 
23
23
  Subcommands: `formstr-mcp login` · `formstr-mcp whoami` · `formstr-mcp accounts` ·
24
- `formstr-mcp switch <npub>` · `formstr-mcp logout` · `formstr-mcp help` ·
25
- `formstr-mcp` (run the stdio server, the default). Run `formstr-mcp help` (or `-h`) for
26
- the full usage.
24
+ `formstr-mcp switch <npub>` · `formstr-mcp logout` · `formstr-mcp version` ·
25
+ `formstr-mcp help` · `formstr-mcp` (run the stdio server, the default). Run
26
+ `formstr-mcp help` (or `-h`) for the full usage.
27
+
28
+ ## Version & updates
29
+
30
+ `formstr-mcp version` (or `-v` / `--version`) prints the installed version and checks the
31
+ npm registry for a newer release:
32
+
33
+ ```text
34
+ $ formstr-mcp version
35
+ @formstr/mcp 0.5.0
36
+ Update available: 0.6.0 (you have 0.5.0).
37
+ Upgrade: npm install -g @formstr/mcp@latest
38
+ Or just re-run via: npx -y @formstr/mcp@latest
39
+ ```
40
+
41
+ The update check is best-effort — if you're offline or the registry is unreachable it
42
+ prints the installed version and a note, never an error. If you run the server via
43
+ `npx -y @formstr/mcp` you already get the latest published version on each launch; pin a
44
+ version (`@formstr/mcp@0.5.0`) in your host config if you'd rather control upgrades.
27
45
 
28
46
  ## Sign-in
29
47
 
@@ -71,6 +89,88 @@ After `login`, no key belongs in the config:
71
89
  Add `"--allow-writes"` to `args` to enable the gated (destructive/outward) tools, and
72
90
  `"--relays", "wss://a,wss://b"` to override relays.
73
91
 
92
+ > **Note:** the default (no `--allow-writes`) is _not_ read-only. Create/import tools
93
+ > (`create_form`, `create_calendar_event`, `create_calendar`, `create_poll`, `create_page`,
94
+ > `import_form_from_naddr`) are always enabled and publish events on your identity. The
95
+ > flag gates the tools that modify or delete existing data or act toward other people
96
+ > (update / delete / share / submit / RSVP).
97
+
98
+ ### Passing the ncryptsec passphrase
99
+
100
+ If your active account is an `ncryptsec` key (Create / Import login), the server needs its
101
+ passphrase to unlock at boot. An MCP host spawns the server with stdin wired to the
102
+ JSON-RPC channel, so it **can't prompt** — supply the passphrase through an `"env"` block in
103
+ the server entry of your MCP config (`mcp_config.json`, `claude_desktop_config.json`, Cursor's
104
+ `~/.cursor/mcp.json`, etc.):
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "formstr": {
110
+ "command": "npx",
111
+ "args": ["-y", "@formstr/mcp"],
112
+ "env": {
113
+ "FORMSTR_MCP_NCRYPTSEC_PASSPHRASE": "your-passphrase-here"
114
+ }
115
+ }
116
+ }
117
+ }
118
+ ```
119
+
120
+ The host hands that value to the server as an environment variable at startup — it never
121
+ enters the chat transcript. Each account has its own passphrase, so this unlocks whichever
122
+ one is **active** (set it with `formstr-mcp switch <npub>`).
123
+
124
+ > **Tip:** prefer not to keep a passphrase in a config file? Use a **NIP-46 (bunker)**
125
+ > account instead — it reconnects from its stored session and needs **no** passphrase, so
126
+ > the config can stay secret-free. Run `formstr-mcp switch <npub>` to a bunker account.
127
+
128
+ ## Using with Ollama (local models)
129
+
130
+ Ollama isn't an MCP client — it just runs the model. To drive this server with a **local**
131
+ model you need an MCP **host** that uses Ollama as its backend. A good, actively-maintained
132
+ option is [**Goose**](https://block.github.io/goose/) (open-source agent by Block; CLI +
133
+ desktop), which has both first-class Ollama support and native stdio MCP extensions.
134
+
135
+ **1. Pull a tool-calling-capable model and start Ollama:**
136
+
137
+ ```bash
138
+ ollama pull qwen2.5 # llama3.1 / 3.2, mistral, … also work — the model MUST support tools
139
+ ollama serve # serves the API on http://localhost:11434
140
+ ```
141
+
142
+ A model **without** tool/function-calling support can chat but can't invoke this server's
143
+ tools (`list_forms`, `create_form`, …), so don't pick one of those.
144
+
145
+ **2. Sign in to formstr once** (stores your key in the keystore):
146
+
147
+ ```bash
148
+ npx -y @formstr/mcp login
149
+ ```
150
+
151
+ **3. Point Goose at Ollama** — `goose configure` → _Configure Providers_ → **Ollama**, then
152
+ enter the host (`http://localhost:11434`) and pick your model.
153
+
154
+ **4. Add this server as an extension** — `goose configure` → _Add Extension_ → **Command-line
155
+ Extension**, then answer the prompts:
156
+
157
+ | Prompt | Value |
158
+ | --------------------- | ------------------------------------------------------------- |
159
+ | Name | `formstr` |
160
+ | Command | `npx -y @formstr/mcp` (add `--allow-writes` to enable writes) |
161
+ | Timeout (secs) | `300` |
162
+ | Environment variables | `FORMSTR_MCP_NCRYPTSEC_PASSPHRASE` = _your passphrase_ |
163
+
164
+ Goose passes that env var to the server when it spawns it (so it unlocks headlessly), and
165
+ saves the extension to `~/.config/goose/config.yaml`. Then just run `goose` (or `goose
166
+ session`) and ask it to work with your forms.
167
+
168
+ > **Bunker accounts need no passphrase** — skip the env-variable step and `formstr-mcp switch
169
+ <npub>` to a NIP-46 account (see the tip above); the extension then stores no secret.
170
+
171
+ The same approach works with any other Ollama-backed MCP host: point it at
172
+ `npx -y @formstr/mcp` and supply the passphrase through that host's env mechanism.
173
+
74
174
  ## Headless / unattended
75
175
 
76
176
  Run `formstr-mcp login` once interactively to populate the keystore, then run the server
@@ -130,9 +230,16 @@ actions; see the source under `src/tools/`.
130
230
  Destructive / outward tools are **not registered** unless `--allow-writes` (or
131
231
  `FORMSTR_ALLOW_WRITES=true`) is set, AND each such call additionally requires
132
232
  `"confirm": true`. Without `confirm`, the tool returns a structured "confirmation
133
- required" message naming the irreversible effect instead of executing. `share_form`
134
- distributes only the view key (read access) — never the signing key. Logging goes to
135
- stderr (stdout is the MCP transport).
233
+ required" message naming the irreversible effect instead of executing.
234
+
235
+ **Create tools are always on.** `--allow-writes` gates updates, deletions, shares,
236
+ submissions, and RSVPs — not creation. Creating a new form/event/calendar/poll/page
237
+ (and importing a form) publishes to relays on your identity even without the flag,
238
+ because a fresh entity can't clobber existing data. If you need a strictly read-only
239
+ server, don't connect an identity that matters.
240
+
241
+ `share_form` distributes only the view key (read access) — never the signing key.
242
+ Logging goes to stderr (stdout is the MCP transport).
136
243
 
137
244
  ## Tests
138
245