suppa-mcp-2 1.2.3 → 1.3.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
@@ -1,391 +1,419 @@
1
- # suppa-mcp-2
2
-
3
- MCP (Model Context Protocol) server for the **Suppa 2.0** platform ([modern.suppa.me](https://modern.suppa.me)).
4
- Allows LLMs (Claude, GPT, Copilot, Cursor, etc.) to manage Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments through standardised MCP tools — with multi-tenant Google authentication.
5
-
6
- This is the Node.js/TypeScript port of the Python [`suppa-mcp`](https://pypi.org/project/suppa-mcp/) package, published to npm as **`suppa-mcp-2`**.
7
-
8
- [![npm version](https://img.shields.io/npm/v/suppa-mcp-2)](https://www.npmjs.com/package/suppa-mcp-2)
9
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
-
11
- ---
12
-
13
- ## Quick start
14
-
15
- ### Run directly with npx
16
-
17
- ```bash
18
- npx suppa-mcp-2
19
- ```
20
-
21
- ### Or install from npm
22
-
23
- ```bash
24
- npm install -g suppa-mcp-2
25
- ```
26
-
27
- No API key needed to start — the server authenticates interactively via the `suppa_login` tool (see [Authentication](#authentication)).
28
-
29
- ---
30
-
31
- ## Authentication
32
-
33
- There is **no API key to paste**. Run the **`suppa_login`** tool from your MCP client — it opens a browser for Google sign-in, then stores the resulting tokens in the OS keychain (Windows Credential Manager / macOS Keychain / libsecret). The server is **multi-tenant**: log in to more than one Suppa tenant and switch with `suppa_use_tenant`.
34
-
35
- Credentials stay on your machine, are sent only in the `Authorization` header to your configured `SUPPA_BASE_URL`, and are **never** exposed to the AI agent. A `SUPPA_API_KEY` env var is an optional CI-only alternative.
36
-
37
- ---
38
-
39
- ## Configuration
40
-
41
- All variables are optional — the server works out of the box and authenticates via `suppa_login`.
42
-
43
- | Variable | Default | Description |
44
- |---|---|---|
45
- | `SUPPA_BASE_URL` | `https://modern.suppa.me` | Platform base URL (the active tenant) |
46
- | `SUPPA_API_KEY` | (none) | JWT / API key; skips interactive login when set (CI) |
47
- | `SUPPA_REFRESH_TOKEN` | (none) | Refresh token; paired with `SUPPA_API_KEY` for long-lived CI sessions |
48
- | `SUPPA_LANG` | `en` | Language (`en` / `uk`) |
49
- | `SUPPA_LANGS` | (auto) | Languages a multi-language title/Name is written into. When unset, resolved from the platform (the languages already used by existing entity titles), falling back to `en,uk`. Set e.g. `en,uk` to force it. |
50
- | `SUPPA_TZ` | `Europe/Kyiv` | Timezone |
51
- | `SUPPA_MCP_LOGIN_PORT` | `8080` | Local loopback port for the browser login callback |
52
- | `SUPPA_MCP_HOME` | `~/.suppa-mcp` | Directory for the tenant registry |
53
- | `SUPPA_HTTP_TIMEOUT` | `60` | Per-request timeout, seconds |
54
- | `SUPPA_MCP_DEBUG` | (off) | `1` logs each request line to stderr |
55
-
56
- ---
57
-
58
- ## Use with Claude Desktop
59
-
60
- Add to your `claude_desktop_config.json`:
61
-
62
- ```json
63
- {
64
- "mcpServers": {
65
- "suppa-2.0": {
66
- "command": "npx",
67
- "args": ["-y", "suppa-mcp-2"]
68
- }
69
- }
70
- }
71
- ```
72
-
73
- ## Use with Cursor
74
-
75
- Add to `.cursor/mcp.json` in your project:
76
-
77
- ```json
78
- {
79
- "mcpServers": {
80
- "suppa-2.0": {
81
- "command": "npx",
82
- "args": ["-y", "suppa-mcp-2"]
83
- }
84
- }
85
- }
86
- ```
87
-
88
- ## Use with VS Code (Copilot)
89
-
90
- Add to `.vscode/mcp.json`:
91
-
92
- ```json
93
- {
94
- "servers": {
95
- "suppa-2.0": {
96
- "command": "npx",
97
- "args": ["-y", "suppa-mcp-2"]
98
- }
99
- }
100
- }
101
- ```
102
-
103
- Then run **`suppa_login`** once per tenant to authenticate.
104
-
105
- ---
106
-
107
- ## Agent workflow
108
-
109
- When an AI agent connects, the server provides built-in instructions describing the correct workflow. Auth first, then discover schema before reading or writing data:
110
-
111
- ```
112
- ┌─────────────────────────────────────────────────────────┐
113
- │ 0. AUTHENTICATE (once per tenant) │
114
- │ suppa_login — Google browser sign-in │
115
- │ suppa_use_tenant — switch active tenant │
116
- ├─────────────────────────────────────────────────────────┤
117
- │ 1. DISCOVER ENTITIES │
118
- │ suppa_list_entities(search?: "task") │
119
- │ suppa_search_entities — fuzzy-find + record count │
120
- ├─────────────────────────────────────────────────────────┤
121
- │ 2. DISCOVER FIELDS │
122
- │ suppa_describe_entity(entity_name) │
123
- │ suppa_list_field_types / suppa_list_tabular_parts │
124
- ├─────────────────────────────────────────────────────────┤
125
- │ 3. READ DATA │
126
- │ suppa_search_records / suppa_get_record │
127
- │ suppa_search_tasks / suppa_get_task / … │
128
- │ suppa_list_docs / suppa_read_page / suppa_get_blocks │
129
- │ suppa_list_automations / suppa_get_automation │
130
- ├─────────────────────────────────────────────────────────┤
131
- │ 4. WRITE DATA (destructive/edit tools are confirm-gated)│
132
- │ suppa_create_record / suppa_update_record │
133
- │ suppa_create_entity / suppa_add_field │
134
- │ suppa_create_automation / suppa_publish_automation │
135
- └─────────────────────────────────────────────────────────┘
136
- ```
137
-
138
- > **Important:** discover with `suppa_list_entities` → `suppa_describe_entity` before reading or writing — field names, types, and filters vary between entities. Edit/delete tools return a **confirmation preview** first and only apply when re-called with `confirm=true`.
139
-
140
- ---
141
-
142
- ## Available tools
143
-
144
- 79 tools across the areas below.
145
-
146
- ### Session & identity
147
-
148
- | Tool | Description |
149
- |---|---|
150
- | `suppa_get_me` | Current authenticated user's profile |
151
- | `suppa_login` | Google browser sign-in for a tenant (stores tokens in OS keychain) |
152
- | `suppa_use_tenant` | Switch the active tenant (alias / host / URL) |
153
- | `suppa_list_tenants` | List known tenants + which is active / authenticated |
154
- | `suppa_logout` | Remove stored credentials for a tenant |
155
- | `suppa_diagnostics` | Validate the whole multi-tenant setup |
156
- | `suppa_health_check` | Config + upstream connectivity check |
157
-
158
- ### Tasks
159
-
160
- | Tool | Description |
161
- |---|---|
162
- | `suppa_search_tasks` | Search tasks (my / active / overdue / due-today filters, paginated) |
163
- | `suppa_count_tasks` | Count tasks matching filters |
164
- | `suppa_get_task` | Get a single task |
165
- | `suppa_create_task` | Create a task |
166
- | `suppa_update_task` | Update a task (confirm-gated) |
167
- | `suppa_delete_task` | Delete a task (confirm-gated) |
168
- | `suppa_move_task` | Move a task to another stage (confirm-gated) |
169
- | `suppa_close_task` | Close a task (confirm-gated) |
170
- | `suppa_add_comment` | Add a comment (supports @mentions) |
171
- | `suppa_get_comments` | Get comments on a task |
172
- | `suppa_attach_file` | Attach a local file to a task |
173
- | `suppa_list_workflows` | List Task workflows |
174
- | `suppa_list_stages` | List stages of a workflow |
175
- | `suppa_list_task_types` | List task types |
176
- | `suppa_search_users` | Search users (feeds assignee / mentions) |
177
-
178
- ### Docs & pages
179
-
180
- | Tool | Description |
181
- |---|---|
182
- | `suppa_list_docs` | List docs |
183
- | `suppa_get_doc` | Get a doc |
184
- | `suppa_create_doc` | Create a doc |
185
- | `suppa_update_doc` | Update a doc (confirm-gated) |
186
- | `suppa_delete_doc` | Delete a doc (confirm-gated) |
187
- | `suppa_list_pages` | List pages of a doc |
188
- | `suppa_get_page` | Get a page |
189
- | `suppa_create_page` | Create a page |
190
- | `suppa_update_page` | Update a page (confirm-gated) |
191
- | `suppa_delete_page` | Delete a page (confirm-gated) |
192
- | `suppa_get_blocks` | Get raw blocks of a page |
193
- | `suppa_read_page` | Read a page rendered to text |
194
- | `suppa_create_blocks` | Create blocks from a JSON array (11 block types) |
195
- | `suppa_insert_block` | Insert a block at a position |
196
- | `suppa_update_block` | Update a block (confirm-gated) |
197
- | `suppa_delete_block` | Delete a block (confirm-gated) |
198
- | `suppa_reorder_blocks` | Reorder blocks on a page |
199
-
200
- ### Entities & records
201
-
202
- | Tool | Description |
203
- |---|---|
204
- | `suppa_list_entities` | List entities (tables) |
205
- | `suppa_describe_entity` | Field definitions + types for an entity |
206
- | `suppa_list_tabular_parts` | List tabular parts (ТЧ) of an entity |
207
- | `suppa_search_records` | Search / filter records in any entity |
208
- | `suppa_get_record` | Get a single record |
209
- | `suppa_create_entity` | Create a new entity |
210
- | `suppa_create_tabular_part` | Create a tabular part (owned rows) of a parent |
211
- | `suppa_add_field` | Add a field to an entity |
212
- | `suppa_add_enum_values` | Add values to an enum field |
213
- | `suppa_set_title_field` | Set the representative/title field |
214
- | `suppa_list_field_types` | List supported field types |
215
- | `suppa_create_record` | Create a record |
216
- | `suppa_update_record` | Update a record (confirm-gated) |
217
- | `suppa_delete_record` | Delete a record (confirm-gated) |
218
- | `suppa_attach_file_to_record` | Attach a local file to any record |
219
-
220
- ### Automations
221
-
222
- | Tool | Description |
223
- |---|---|
224
- | `suppa_list_automations` | List automation workflows |
225
- | `suppa_get_automation` | Get one automation as a normalized graph (nodes + edges) |
226
- | `suppa_list_automation_runs` | List runs (executions) of an automation |
227
- | `suppa_get_automation_run` | Get one run with per-node steps + trigger payload |
228
- | `suppa_list_automation_node_types` | Node-type catalog (authoritative + fallback) |
229
- | `suppa_get_automation_node_schema` | Parameter schema for one node type |
230
- | `suppa_search_entities` | Fuzzy-find an entity by name/title (+ record count) |
231
- | `suppa_create_automation` | Create an automation (pre-flight validated; draft) |
232
- | `suppa_update_automation` | Update an automation (read-modify-write; confirm-gated) |
233
- | `suppa_delete_automation` | Delete an automation (confirm-gated) |
234
- | `suppa_publish_automation` | Publish the draft snapshot (confirm-gated) |
235
- | `suppa_unpublish_automation` | Deactivate an automation (confirm-gated) |
236
-
237
- ### Forms
238
-
239
- | Tool | Description |
240
- |---|---|
241
- | `suppa_list_forms` | List forms |
242
- | `suppa_get_form` | Get a form |
243
- | `suppa_create_form` | Create a form (optionally generated from an entity) |
244
- | `suppa_update_form` | Update a form (confirm-gated) |
245
- | `suppa_generate_form_schema` | Generate a grid form schema from an entity |
246
- | `suppa_add_field_to_form` | Add a field element to a form (confirm-gated) |
247
- | `suppa_list_form_field_types` | List form element types |
248
-
249
- ### Migration (Suppa 1.0 → 2.0) & workspace
250
-
251
- | Tool | Description |
252
- |---|---|
253
- | `suppa_migrate_entities_from_v1` | Migrate 1.0 entities → 2.0 (dry-run / create / gap-fill / reconcile) |
254
- | `suppa_read_v1_entities` | Read entity list from a Suppa 1.0 tenant |
255
- | `suppa_read_v1_entity_props` | Read 1.0 entity field definitions |
256
- | `suppa_read_v1_enum` | Read 1.0 enum values |
257
- | `suppa_create_workspace` | Create a workspace + nav item |
258
- | `suppa_add_menu_item` | Add a navigation-menu item |
259
-
260
- ---
261
-
262
- ## Prompts
263
-
264
- Guided workflows clients can expose as slash commands:
265
-
266
- | Prompt | Arguments | Description |
267
- |---|---|---|
268
- | `plan_my_day` | — | Triage my Suppa tasks into a prioritized day plan |
269
- | `build_entity` | `entity_purpose` | Guided design + creation of a new entity, fields, enums, and a form |
270
- | `migrate_from_v1` | `entity_names?` | Guided Suppa 1.0 → 2.0 schema migration (dry-run, review, execute) |
271
- | `write_entity_code` | `entity_purpose` | Guided: write v2 application schema code (entities, seeds, registration) instead of API calls |
272
-
273
- ---
274
-
275
- ## Bundled agent skill: suppa-entity-code
276
-
277
- The package ships an agent skill at `skills/suppa-entity-code/` (also installed
278
- via npm) that writes **Suppa v2 application schema code** — `*.entity.ts`
279
- classes, `*.seed.ts` seeds, and the `EntityModule.forFeature()` registration —
280
- following the platform's declarative-migration rules, where the entity class
281
- *is* the migration.
282
-
283
- Two flows:
284
-
285
- - **Flow A** — design a new entity/seed in an application repo.
286
- - **Flow B** — port a Suppa 1.0 entity to v2 code, using the same
287
- type-mapping authority as `suppa_migrate_entities_from_v1`.
288
-
289
- It includes a static validator that catches everything `tsc` cannot:
290
-
291
- ```bash
292
- node <this-skill-dir>/scripts/validate-suppa-schema.mjs <app-root>
293
- # (installed via npm: node_modules/suppa-mcp-2/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs)
294
- ```
295
-
296
- Checks: SQL-string defaults, decorator misuse, thunk-less relations, an
297
- `inverse` selector wrongly passed to `@ManyToOne`/`@ManyToMany` (W609) or
298
- pointing at a non-relation property such as `id` on any of the four relation
299
- decorators (E111), seed idempotency (importKeyFields / `$key`), forbidden
300
- seed keys, numeric relation ids, reverse `@OneToMany` references, `forFeature`
301
- membership, seed dependency order, `dist/` autoload paths, tsconfig decorator
302
- flags, unknown `@Entity()`/`@Column()` options or field types, and tabular-part rules —
303
- the `type: 'tabular-part'` + `relationEntityName` + `owner` triad, `owner`
304
- resolving to the right parent, and `owner` first in `importKeyFields`
305
- (E108/E109/E110/W607) — validated against the installed `@suppa/sdk` typings
306
- when resolvable, falling back to the doc tables otherwise
307
- (E101/E102/E107/E501/E502). Options/records/registration arrays delivered via
308
- spread or by reference can't be statically checked and fire a W606 warning
309
- instead. An entity or seed left out of `EntityModule.forFeature()` fires
310
- E301/E302, naming the module file to edit so the fix is a find-and-add, not a
311
- search. Exit code 1 on any error. Use the `write_entity_code` MCP prompt to
312
- drive it from any client.
313
-
314
- Tabular parts (owned child sub-tables like checklist items or order lines)
315
- and the remove-and-re-add-a-field semantics — a re-added field restores its
316
- old data because the key defaults to `<EntityName>.<fieldName>` — are both
317
- covered; see `references/tabular-parts.md` and `references/registration.md`.
318
-
319
- ---
320
-
321
- ## Development
322
-
323
- ```bash
324
- # Install dependencies
325
- npm install
326
-
327
- # Build
328
- npm run build
329
-
330
- # Run locally (stdio)
331
- node dist/bin.js
332
-
333
- # Test with MCP Inspector
334
- npm run inspect
335
-
336
- # Tests
337
- npm test
338
-
339
- # Watch mode
340
- npm run dev
341
- ```
342
-
343
- ---
344
-
345
- ## Publish to npm
346
-
347
- ```bash
348
- # 1. Make sure you're logged in
349
- npm login
350
-
351
- # 2. Build & publish
352
- npm publish
353
- ```
354
-
355
- The `prepublishOnly` script automatically runs `tsc` + the full test suite before publishing.
356
-
357
- ---
358
-
359
- ## Project structure
360
-
361
- ```
362
- suppa-mcp-node/
363
- ├── src/
364
- │ ├── bin.ts # Entry point — stdio transport
365
- │ ├── server.ts # McpServer + all 79 tool + 4 prompt registrations
366
- │ ├── config.ts # Env / .env config surface
367
- │ ├── store.ts # Credentials in the OS keychain (@napi-rs/keyring)
368
- │ ├── registry.ts # Non-secret tenant registry (~/.suppa-mcp/tenants.json)
369
- │ ├── tenants.ts # Tenant context, active tenant, resolve, diagnostics
370
- │ ├── auth.ts # JWT refresh (single-flight) + browser Google login
371
- │ ├── httpClient.ts # fetch client: retry, envelope unwrap, 401→refresh→retry
372
- │ ├── utils.ts # filters, dates, JSON params, multipart, confirm gate
373
- │ └── tools/
374
- │ ├── tasks.ts docs.ts entity.ts forms.ts
375
- │ ├── automation.ts # read + write automation tools
376
- │ ├── migrate.ts nameMap.ts v1Fields.ts
377
- │ └── workspace.ts
378
- ├── skills/suppa-entity-code/ # bundled agent skill: write v2 schema code + validator
379
- ├── test/ # vitest suite (ports the Python test suite)
380
- ├── scripts/ # live read-only / write verify scripts
381
- ├── package.json
382
- ├── tsconfig.json
383
- ├── vitest.config.ts
384
- └── README.md
385
- ```
386
-
387
- ---
388
-
389
- ## License
390
-
391
- MIT — see [LICENSE](LICENSE).
1
+ # suppa-mcp-2
2
+
3
+ MCP (Model Context Protocol) server for the **Suppa 2.0** platform ([modern.suppa.me](https://modern.suppa.me)).
4
+ Allows LLMs (Claude, GPT, Copilot, Cursor, etc.) to manage Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments through standardised MCP tools — with multi-tenant Google authentication.
5
+
6
+ This is the Node.js/TypeScript port of the Python [`suppa-mcp`](https://pypi.org/project/suppa-mcp/) package, published to npm as **`suppa-mcp-2`**.
7
+
8
+ [![npm version](https://img.shields.io/npm/v/suppa-mcp-2)](https://www.npmjs.com/package/suppa-mcp-2)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
10
+
11
+ ---
12
+
13
+ ## Quick start
14
+
15
+ ### Run directly with npx
16
+
17
+ ```bash
18
+ npx suppa-mcp-2
19
+ ```
20
+
21
+ ### Or install from npm
22
+
23
+ ```bash
24
+ npm install -g suppa-mcp-2
25
+ ```
26
+
27
+ No API key needed to start — the server authenticates interactively via the `suppa_login` tool (see [Authentication](#authentication)).
28
+
29
+ ---
30
+
31
+ ## Authentication
32
+
33
+ There is **no API key to paste**. Run the **`suppa_login`** tool from your MCP client — it opens a browser for Google sign-in, then stores the resulting tokens in the OS keychain (Windows Credential Manager / macOS Keychain / libsecret). The server is **multi-tenant**: log in to more than one Suppa tenant and switch with `suppa_use_tenant`.
34
+
35
+ Credentials stay on your machine, are sent only in the `Authorization` header to your configured `SUPPA_BASE_URL`, and are **never** exposed to the AI agent. A `SUPPA_API_KEY` env var is an optional CI-only alternative.
36
+
37
+ ---
38
+
39
+ ## Configuration
40
+
41
+ All variables are optional — the server works out of the box and authenticates via `suppa_login`.
42
+
43
+ | Variable | Default | Description |
44
+ |---|---|---|
45
+ | `SUPPA_BASE_URL` | `https://modern.suppa.me` | Platform base URL (the active tenant) |
46
+ | `SUPPA_API_KEY` | (none) | JWT / API key; skips interactive login when set (CI) |
47
+ | `SUPPA_REFRESH_TOKEN` | (none) | Refresh token; paired with `SUPPA_API_KEY` for long-lived CI sessions |
48
+ | `SUPPA_LANG` | `en` | Language (`en` / `uk`) |
49
+ | `SUPPA_LANGS` | (auto) | Languages a multi-language title/Name is written into. When unset, resolved from the platform (the languages already used by existing entity titles), falling back to `en,uk`. Set e.g. `en,uk` to force it. |
50
+ | `SUPPA_TZ` | `Europe/Kyiv` | Timezone |
51
+ | `SUPPA_MCP_LOGIN_PORT` | `8080` | Local loopback port for the browser login callback |
52
+ | `SUPPA_MCP_HOME` | `~/.suppa-mcp` | Directory for the tenant registry |
53
+ | `SUPPA_HTTP_TIMEOUT` | `60` | Per-request timeout, seconds |
54
+ | `SUPPA_MCP_DEBUG` | (off) | `1` logs each request line to stderr |
55
+
56
+ ---
57
+
58
+ ## Use with Claude Desktop
59
+
60
+ Add to your `claude_desktop_config.json`:
61
+
62
+ ```json
63
+ {
64
+ "mcpServers": {
65
+ "suppa-2.0": {
66
+ "command": "npx",
67
+ "args": ["-y", "suppa-mcp-2"]
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Use with Cursor
74
+
75
+ Add to `.cursor/mcp.json` in your project:
76
+
77
+ ```json
78
+ {
79
+ "mcpServers": {
80
+ "suppa-2.0": {
81
+ "command": "npx",
82
+ "args": ["-y", "suppa-mcp-2"]
83
+ }
84
+ }
85
+ }
86
+ ```
87
+
88
+ ## Use with VS Code (Copilot)
89
+
90
+ Add to `.vscode/mcp.json`:
91
+
92
+ ```json
93
+ {
94
+ "servers": {
95
+ "suppa-2.0": {
96
+ "command": "npx",
97
+ "args": ["-y", "suppa-mcp-2"]
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ Then run **`suppa_login`** once per tenant to authenticate.
104
+
105
+ ---
106
+
107
+ ## Agent workflow
108
+
109
+ When an AI agent connects, the server provides built-in instructions describing the correct workflow. Auth first, then discover schema before reading or writing data:
110
+
111
+ ```
112
+ ┌─────────────────────────────────────────────────────────┐
113
+ │ 0. AUTHENTICATE (once per tenant) │
114
+ │ suppa_login — Google browser sign-in │
115
+ │ suppa_use_tenant — switch active tenant │
116
+ ├─────────────────────────────────────────────────────────┤
117
+ │ 1. DISCOVER ENTITIES │
118
+ │ suppa_list_entities(search?: "task") │
119
+ │ suppa_search_entities — fuzzy-find + record count │
120
+ ├─────────────────────────────────────────────────────────┤
121
+ │ 2. DISCOVER FIELDS │
122
+ │ suppa_describe_entity(entity_name) │
123
+ │ suppa_list_field_types / suppa_list_tabular_parts │
124
+ ├─────────────────────────────────────────────────────────┤
125
+ │ 3. READ DATA │
126
+ │ suppa_search_records / suppa_get_record │
127
+ │ suppa_search_tasks / suppa_get_task / … │
128
+ │ suppa_list_docs / suppa_read_page / suppa_get_blocks │
129
+ │ suppa_list_automations / suppa_get_automation │
130
+ ├─────────────────────────────────────────────────────────┤
131
+ │ 4. WRITE DATA (destructive/edit tools are confirm-gated)│
132
+ │ suppa_create_record / suppa_update_record │
133
+ │ suppa_copy_record / suppa_restore_record │
134
+ │ suppa_create_entity / suppa_add_field │
135
+ │ suppa_create_automation / suppa_publish_automation │
136
+ └─────────────────────────────────────────────────────────┘
137
+ ```
138
+
139
+ > **Important:** discover with `suppa_list_entities` → `suppa_describe_entity` before reading or writing — field names, types, and filters vary between entities. Edit/delete tools return a **confirmation preview** first and only apply when re-called with `confirm=true`.
140
+
141
+ ### Deletes are reversible — permanent delete is blocked
142
+
143
+ This server performs **reversible deletes only**. Every delete tool calls the platform's
144
+ soft delete, `POST /core/data/:entity/remove`, which sets `deletedAt` and leaves the row in
145
+ the table; `suppa_restore_record` clears it again.
146
+
147
+ The platform's permanent delete — `POST /core/data/:entity/delete`, where *"the rows leave
148
+ the table and cannot be restored"* — is **deliberately unavailable here**, and the block is
149
+ not a tool-level check that a future tool could miss: `src/httpClient.ts` refuses that route
150
+ shape at the single choke point every request to a 2.0 tenant passes through — `makeRequest`
151
+ and `makeRequestRawBytes` — before any `fetch`. No tool, parameter, `confirm=true` or direct
152
+ `makeRequest` call can reach it, and an attempt raises
153
+
154
+ ```
155
+ REFUSED BY POLICY — permanent delete is not available through this server. …
156
+ Use the reversible pair instead: /remove … undone with suppa_restore_record.
157
+ ```
158
+
159
+ Neighbouring routes are untouched: `/remove`, `/restore`, `/copy/:id`,
160
+ `/core/builder/:entity/remove-fields` and an entity legitimately named `DeleteRequests` all
161
+ work normally. Erasing data for good is an admin action in the platform's own UI.
162
+
163
+ ---
164
+
165
+ ## Available tools
166
+
167
+ 84 tools across the areas below.
168
+
169
+ ### Session & identity
170
+
171
+ | Tool | Description |
172
+ |---|---|
173
+ | `suppa_get_me` | Current authenticated user's profile |
174
+ | `suppa_login` | Google browser sign-in for a tenant (stores tokens in OS keychain) |
175
+ | `suppa_use_tenant` | Switch the active tenant (alias / host / URL) |
176
+ | `suppa_list_tenants` | List known tenants + which is active / authenticated |
177
+ | `suppa_logout` | Remove stored credentials for a tenant |
178
+ | `suppa_diagnostics` | Validate the whole multi-tenant setup |
179
+ | `suppa_health_check` | Config + upstream connectivity check |
180
+
181
+ ### Tasks
182
+
183
+ | Tool | Description |
184
+ |---|---|
185
+ | `suppa_search_tasks` | Search tasks (my / active / overdue / due-today filters, paginated) |
186
+ | `suppa_count_tasks` | Count tasks matching filters |
187
+ | `suppa_get_task` | Get a single task |
188
+ | `suppa_create_task` | Create a task |
189
+ | `suppa_update_task` | Update a task (confirm-gated) |
190
+ | `suppa_delete_task` | Delete a task (confirm-gated) |
191
+ | `suppa_move_task` | Move a task to another stage (confirm-gated) |
192
+ | `suppa_close_task` | Close a task (confirm-gated) |
193
+ | `suppa_add_comment` | Add a comment (supports @mentions) |
194
+ | `suppa_get_comments` | Get comments on a task |
195
+ | `suppa_attach_file` | Attach a local file to a task |
196
+ | `suppa_list_workflows` | List Task workflows |
197
+ | `suppa_list_stages` | List stages of a workflow |
198
+ | `suppa_list_task_types` | List task types |
199
+ | `suppa_search_users` | Search users (feeds assignee / mentions) |
200
+
201
+ ### Docs & pages
202
+
203
+ | Tool | Description |
204
+ |---|---|
205
+ | `suppa_list_docs` | List docs |
206
+ | `suppa_get_doc` | Get a doc |
207
+ | `suppa_create_doc` | Create a doc |
208
+ | `suppa_update_doc` | Update a doc (confirm-gated) |
209
+ | `suppa_delete_doc` | Delete a doc (confirm-gated) |
210
+ | `suppa_list_pages` | List pages of a doc |
211
+ | `suppa_get_page` | Get a page |
212
+ | `suppa_create_page` | Create a page |
213
+ | `suppa_update_page` | Update a page (confirm-gated) |
214
+ | `suppa_delete_page` | Delete a page (confirm-gated) |
215
+ | `suppa_get_blocks` | Get raw blocks of a page |
216
+ | `suppa_read_page` | Read a page rendered to text |
217
+ | `suppa_create_blocks` | Create blocks from a JSON array (11 block types) |
218
+ | `suppa_insert_block` | Insert a block at a position |
219
+ | `suppa_update_block` | Update a block (confirm-gated) |
220
+ | `suppa_delete_block` | Delete a block (confirm-gated) |
221
+ | `suppa_reorder_blocks` | Reorder blocks on a page |
222
+
223
+ ### Entities & records
224
+
225
+ | Tool | Description |
226
+ |---|---|
227
+ | `suppa_list_entities` | List entities (tables) |
228
+ | `suppa_describe_entity` | Field definitions + types for an entity |
229
+ | `suppa_list_tabular_parts` | List tabular parts (ТЧ) of an entity |
230
+ | `suppa_search_records` | Search / filter records in any entity — nested AND/OR groups, auto-diagnoses an empty result (`deleted_scope` finds soft-deleted rows) |
231
+ | `suppa_validate_select` | Check a select/filter payload against the entity without running it — names the field that does not resolve |
232
+ | `suppa_get_record` | Get a single record (`deleted_scope` reads a soft-deleted one) |
233
+ | `suppa_create_entity` | Create a new entity (`options_json`: comments / globalSearch / hierarchy …) |
234
+ | `suppa_create_tabular_part` | Create a tabular part (owned rows) of a parent |
235
+ | `suppa_add_field` | Add a field to an entity (`options_json`: searchable / showInTable / canFilter …) |
236
+ | `suppa_update_field` | Edit an existing field — name, title, flags, options, encryption (confirm-gated) |
237
+ | `suppa_update_entity_options` | Toggle the 15 per-entity features — comments, hierarchy, approvals … (confirm-gated) |
238
+ | `suppa_add_enum_values` | Add values to an enum field |
239
+ | `suppa_set_title_field` | Set the representative/title field |
240
+ | `suppa_list_field_types` | List supported field types |
241
+ | `suppa_create_record` | Create a record — or a batch, by passing an array of records (one request) |
242
+ | `suppa_update_record` | Update a record (confirm-gated) |
243
+ | `suppa_delete_record` | Soft-delete a record — reversible (confirm-gated); permanent delete is blocked server-wide |
244
+ | `suppa_restore_record` | Undo a soft delete: clear `deletedAt` on a record (confirm-gated) |
245
+ | `suppa_copy_record` | Duplicate a record, optionally with its files / related records |
246
+ | `suppa_attach_file_to_record` | Attach a local file to any record |
247
+
248
+ ### Automations
249
+
250
+ | Tool | Description |
251
+ |---|---|
252
+ | `suppa_list_automations` | List automation workflows |
253
+ | `suppa_get_automation` | Get one automation as a normalized graph (nodes + edges) |
254
+ | `suppa_list_automation_runs` | List runs (executions) of an automation |
255
+ | `suppa_get_automation_run` | Get one run with per-node steps + trigger payload |
256
+ | `suppa_list_automation_node_types` | Node-type catalog (authoritative + fallback) |
257
+ | `suppa_get_automation_node_schema` | Parameter schema for one node type |
258
+ | `suppa_search_entities` | Fuzzy-find an entity by name/title (+ record count) |
259
+ | `suppa_create_automation` | Create an automation (pre-flight validated; draft) |
260
+ | `suppa_update_automation` | Update an automation (read-modify-write; confirm-gated) |
261
+ | `suppa_delete_automation` | Delete an automation (confirm-gated) |
262
+ | `suppa_publish_automation` | Publish the draft snapshot (confirm-gated) |
263
+ | `suppa_unpublish_automation` | Deactivate an automation (confirm-gated) |
264
+
265
+ ### Forms
266
+
267
+ | Tool | Description |
268
+ |---|---|
269
+ | `suppa_list_forms` | List forms |
270
+ | `suppa_get_form` | Get a form |
271
+ | `suppa_create_form` | Create a form (optionally generated from an entity) |
272
+ | `suppa_update_form` | Update a form (confirm-gated) |
273
+ | `suppa_generate_form_schema` | Generate a grid form schema from an entity |
274
+ | `suppa_add_field_to_form` | Add a field element to a form (confirm-gated) |
275
+ | `suppa_list_form_field_types` | List form element types |
276
+
277
+ ### Migration (Suppa 1.0 → 2.0) & workspace
278
+
279
+ | Tool | Description |
280
+ |---|---|
281
+ | `suppa_migrate_entities_from_v1` | Migrate 1.0 entities → 2.0 (dry-run / create / gap-fill / reconcile) |
282
+ | `suppa_read_v1_entities` | Read entity list from a Suppa 1.0 tenant |
283
+ | `suppa_read_v1_entity_props` | Read 1.0 entity field definitions |
284
+ | `suppa_read_v1_enum` | Read 1.0 enum values |
285
+ | `suppa_create_workspace` | Create a workspace + nav item |
286
+ | `suppa_add_menu_item` | Add a navigation-menu item |
287
+
288
+ ---
289
+
290
+ ## Prompts
291
+
292
+ Guided workflows clients can expose as slash commands:
293
+
294
+ | Prompt | Arguments | Description |
295
+ |---|---|---|
296
+ | `plan_my_day` | — | Triage my Suppa tasks into a prioritized day plan |
297
+ | `build_entity` | `entity_purpose` | Guided design + creation of a new entity, fields, enums, and a form |
298
+ | `migrate_from_v1` | `entity_names?` | Guided Suppa 1.0 → 2.0 schema migration (dry-run, review, execute) |
299
+ | `write_entity_code` | `entity_purpose` | Guided: write v2 application schema code (entities, seeds, registration) instead of API calls |
300
+
301
+ ---
302
+
303
+ ## Bundled agent skill: suppa-entity-code
304
+
305
+ The package ships an agent skill at `skills/suppa-entity-code/` (also installed
306
+ via npm) that writes **Suppa v2 application schema code** — `*.entity.ts`
307
+ classes, `*.seed.ts` seeds, and the `EntityModule.forFeature()` registration —
308
+ following the platform's declarative-migration rules, where the entity class
309
+ *is* the migration.
310
+
311
+ Two flows:
312
+
313
+ - **Flow A** — design a new entity/seed in an application repo.
314
+ - **Flow B** — port a Suppa 1.0 entity to v2 code, using the same
315
+ type-mapping authority as `suppa_migrate_entities_from_v1`.
316
+
317
+ It includes a static validator that catches everything `tsc` cannot:
318
+
319
+ ```bash
320
+ node <this-skill-dir>/scripts/validate-suppa-schema.mjs <app-root>
321
+ # (installed via npm: node_modules/suppa-mcp-2/skills/suppa-entity-code/scripts/validate-suppa-schema.mjs)
322
+ ```
323
+
324
+ Checks: SQL-string defaults, decorator misuse, thunk-less relations, an
325
+ `inverse` selector wrongly passed to `@ManyToOne`/`@ManyToMany` (W609) or
326
+ pointing at a non-relation property such as `id` on any of the four relation
327
+ decorators (E111), seed idempotency (importKeyFields / `$key`), forbidden
328
+ seed keys, numeric relation ids, reverse `@OneToMany` references, `forFeature`
329
+ membership, seed dependency order, `dist/` autoload paths, tsconfig decorator
330
+ flags, unknown `@Entity()`/`@Column()` options or field types, and tabular-part rules —
331
+ the `type: 'tabular-part'` + `relationEntityName` + `owner` triad, `owner`
332
+ resolving to the right parent, and `owner` first in `importKeyFields`
333
+ (E108/E109/E110/W607) — validated against the installed `@suppa/sdk` typings
334
+ when resolvable, falling back to the doc tables otherwise
335
+ (E101/E102/E107/E501/E502). Options/records/registration arrays delivered via
336
+ spread or by reference can't be statically checked and fire a W606 warning
337
+ instead. An entity or seed left out of `EntityModule.forFeature()` fires
338
+ E301/E302, naming the module file to edit so the fix is a find-and-add, not a
339
+ search. Exit code 1 on any error. Use the `write_entity_code` MCP prompt to
340
+ drive it from any client.
341
+
342
+ Tabular parts (owned child sub-tables like checklist items or order lines)
343
+ and the remove-and-re-add-a-field semantics — a re-added field restores its
344
+ old data because the key defaults to `<EntityName>.<fieldName>` — are both
345
+ covered; see `references/tabular-parts.md` and `references/registration.md`.
346
+
347
+ ---
348
+
349
+ ## Development
350
+
351
+ ```bash
352
+ # Install dependencies
353
+ npm install
354
+
355
+ # Build
356
+ npm run build
357
+
358
+ # Run locally (stdio)
359
+ node dist/bin.js
360
+
361
+ # Test with MCP Inspector
362
+ npm run inspect
363
+
364
+ # Tests
365
+ npm test
366
+
367
+ # Watch mode
368
+ npm run dev
369
+ ```
370
+
371
+ ---
372
+
373
+ ## Publish to npm
374
+
375
+ ```bash
376
+ # 1. Make sure you're logged in
377
+ npm login
378
+
379
+ # 2. Build & publish
380
+ npm publish
381
+ ```
382
+
383
+ The `prepublishOnly` script automatically runs `tsc` + the full test suite before publishing.
384
+
385
+ ---
386
+
387
+ ## Project structure
388
+
389
+ ```
390
+ suppa-mcp-node/
391
+ ├── src/
392
+ │ ├── bin.ts # Entry point — stdio transport
393
+ │ ├── server.ts # McpServer + all 84 tool + 4 prompt registrations
394
+ │ ├── config.ts # Env / .env config surface
395
+ │ ├── store.ts # Credentials in the OS keychain (@napi-rs/keyring)
396
+ │ ├── registry.ts # Non-secret tenant registry (~/.suppa-mcp/tenants.json)
397
+ │ ├── tenants.ts # Tenant context, active tenant, resolve, diagnostics
398
+ │ ├── auth.ts # JWT refresh (single-flight) + browser Google login
399
+ │ ├── httpClient.ts # fetch client: retry, envelope unwrap, 401→refresh→retry
400
+ │ ├── utils.ts # filters, dates, JSON params, multipart, confirm gate
401
+ │ └── tools/
402
+ │ ├── tasks.ts docs.ts entity.ts forms.ts
403
+ │ ├── automation.ts # read + write automation tools
404
+ │ ├── migrate.ts nameMap.ts v1Fields.ts
405
+ │ └── workspace.ts
406
+ ├── skills/suppa-entity-code/ # bundled agent skill: write v2 schema code + validator
407
+ ├── test/ # vitest suite (ports the Python test suite)
408
+ ├── scripts/ # live read-only / write verify scripts
409
+ ├── package.json
410
+ ├── tsconfig.json
411
+ ├── vitest.config.ts
412
+ └── README.md
413
+ ```
414
+
415
+ ---
416
+
417
+ ## License
418
+
419
+ MIT — see [LICENSE](LICENSE).