suppa-mcp-2 1.27.0 → 1.28.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/dist/server.js +39 -37
- package/package.json +2 -1
package/dist/server.js
CHANGED
|
@@ -255,43 +255,45 @@ const EntityQuery = z
|
|
|
255
255
|
// ---------------------------------------------------------------------------
|
|
256
256
|
/** Read once, from the one file that states the rules (see houseRulesDigest). */
|
|
257
257
|
const HOUSE_RULES_DIGEST = houseRulesDigest();
|
|
258
|
-
const INSTRUCTIONS = `Suppa Platform MCP Server — Tasks, Docs/Pages, Entities, Forms, Automations and file attachments on Suppa tenants.
|
|
259
|
-
|
|
260
|
-
AUTHENTICATION — RESOLVE THIS BEFORE ANY OTHER SUPPA WORK
|
|
261
|
-
- Sign-in is an interactive Google flow in the browser. There is NO API key for a user to find or paste — NEVER ask for a token, key or password; call suppa_login instead.
|
|
262
|
-
- Unsure whether the user is signed in? Call suppa_list_tenants (cheap, read-only): the ACTIVE tenant shows "authenticated": false or "needs_login": true when not.
|
|
263
|
-
- When not signed in — or any tool answers "No credentials" / HTTP 401 / "session could not be refreshed" / ReloginRequired — DO NOT STOP and DO NOT ask for a key:
|
|
264
|
-
1. Call suppa_login (suppa_login(tenant="<alias|host|url>") targets another instance; default is the active tenant). It OPENS A GOOGLE SIGN-IN PAGE in the default browser, served locally at http://localhost:${config.LOGIN_PORT}.
|
|
265
|
-
2. Tell the user: "I've opened a Google sign-in page in your browser — pick your account to finish signing in." If the browser did not open, the result carries the URL for them to open by hand.
|
|
266
|
-
3. It blocks until they finish and returns {"status":"ok"} — THEN retry the original action. Tokens go to the OS keychain and auto-refresh: one login per tenant, not per session.
|
|
267
|
-
- A static SUPPA_API_KEY in the client env (CI / single tenant) means no login is needed; it is optional and most users have none.
|
|
268
|
-
- suppa_diagnostics validates the whole setup and reports the login_origin to whitelist. ONE-TIME ORG SETUP: http://localhost:${config.LOGIN_PORT} must be in the Google OAuth client's "Authorized JavaScript origins" — a sign-in page that opens but never completes is almost always this; tell the user so an admin can add it.
|
|
269
|
-
- suppa_use_tenant switches the active instance for ALL later calls; suppa_list_tenants shows what is known and authenticated.
|
|
270
|
-
|
|
271
|
-
DATA BASICS
|
|
272
|
-
- IDs are integers, not UUIDs. Dates are ISO-8601; a naive datetime (no offset) is read as UTC, so pass an explicit offset (+03:00) or convert local times yourself. Task deadlines also accept 'today', 'tomorrow', '+3d', '+2h', '+30m', '+1w'.
|
|
273
|
-
- Each write tool's description states the shapes it demands — relations and enums as {"id": N}, list fields REPLACED unless merge_json says otherwise — and validates against the live schema before writing. Read it before calling: a bare number where a reference belongs returns 201 and stores null.
|
|
274
|
-
- DELETE IS A SOFT DELETE — every delete tool sets deletedAt and leaves the row in place, reversible with suppa_restore_record(entity_name, record_id); never tell the user their data was destroyed. It still needs confirm=true because the row leaves all normal reads; find it again with deleted_scope='deleted'.
|
|
275
|
-
- PERMANENT DELETE IS UNAVAILABLE HERE, BY DESIGN — this server performs REVERSIBLE deletes only. The platform's PERMANENT delete (POST /core/data/:entityName/delete — rows leave the table and cannot be restored) is BLOCKED in the HTTP client itself: no tool, flag, confirm=true or direct call reaches it, and an attempt is refused before any request is sent. Do not look for a tool, a parameter or a workaround — there is none. Asked to erase data for good, say so plainly and offer the soft delete (suppa_delete_record → /remove, undone by suppa_restore_record); permanent removal is an admin action in the platform's own UI.
|
|
276
|
-
- Reads are compact: relation objects omit deletedAt when null (a live row); schema reads omit nulls, false flags and default options and carry a _legend (full=true returns the raw form).
|
|
277
|
-
|
|
278
|
-
SEARCH & FILTERS — suppa_search_records' description carries the comparators, nested AND/OR groups, dotted field paths, "$current-user", paging and the auto-diagnosis of an empty result. Read it before your first search.
|
|
279
|
-
- PROJECT ONLY THE FIELDS YOU NEED: fields_json is on suppa_search_records AND on every task/doc read (suppa_get_task, suppa_search_tasks — which also takes task_ids, so several tasks are ONE call, never one suppa_get_task each — suppa_get_doc, suppa_list_pages, …). A 600-character answer instead of a 50 000-character one, re-sent on every later turn.
|
|
280
|
-
- Unsure of the schema: suppa_list_entities → suppa_describe_entity → suppa_search_records. One record by id needs no filters: suppa_get_record / suppa_get_task / suppa_get_doc.
|
|
281
|
-
|
|
282
|
-
APPROVAL GATES (human-in-the-loop)
|
|
283
|
-
- Every update/move/close/delete tool called without confirm=true returns {"status": "confirmation_required"} and performs NOTHING. Show the user what will change, get explicit approval, then re-call the same tool with confirm=true — never set it on the first call without their go-ahead. Create/read tools and comments need no confirmation.
|
|
284
|
-
- A value shown as <N chars — …> is NOT the stored text: the marker stands in for a long string you supplied in this same call, and the reason after the dash says which. Quote it to the user from your own arguments; never report the marker as the record's content.
|
|
285
|
-
|
|
286
|
-
ENTITY BUILDER (create + edit fields; core-field removal is UI-only) — suppa_add_field's description carries the real field types, the sub_type matrix and the field options; suppa_update_field's carries what may still be changed on a field that exists. Two things those cannot decide for you:
|
|
287
|
-
- OWNED CHILD COLLECTIONS ARE TABULAR PARTS: repeating rows that belong to ONE parent record (a part's BOM items) go through suppa_create_tabular_part(parent_entity, name), which creates the child's 'owner' relation and the parent link. Never model it by hand — suppa_add_field REFUSES field_type='one-to-many'; 'many-to-many' is for a shared lookup referenced by many records.
|
|
288
|
-
- An enum value on a RECORD is a reference, {"id": <Enums row id>} (an array of those for multi-enum), never a bare code like "red" — that is refused. Read the ids with suppa_search_records on 'Enums' filtered by name.
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
258
|
+
const INSTRUCTIONS = `Suppa Platform MCP Server — Tasks, Docs/Pages, Entities, Forms, Automations and file attachments on Suppa tenants.
|
|
259
|
+
|
|
260
|
+
AUTHENTICATION — RESOLVE THIS BEFORE ANY OTHER SUPPA WORK
|
|
261
|
+
- Sign-in is an interactive Google flow in the browser. There is NO API key for a user to find or paste — NEVER ask for a token, key or password; call suppa_login instead.
|
|
262
|
+
- Unsure whether the user is signed in? Call suppa_list_tenants (cheap, read-only): the ACTIVE tenant shows "authenticated": false or "needs_login": true when not.
|
|
263
|
+
- When not signed in — or any tool answers "No credentials" / HTTP 401 / "session could not be refreshed" / ReloginRequired — DO NOT STOP and DO NOT ask for a key:
|
|
264
|
+
1. Call suppa_login (suppa_login(tenant="<alias|host|url>") targets another instance; default is the active tenant). It OPENS A GOOGLE SIGN-IN PAGE in the default browser, served locally at http://localhost:${config.LOGIN_PORT}.
|
|
265
|
+
2. Tell the user: "I've opened a Google sign-in page in your browser — pick your account to finish signing in." If the browser did not open, the result carries the URL for them to open by hand.
|
|
266
|
+
3. It blocks until they finish and returns {"status":"ok"} — THEN retry the original action. Tokens go to the OS keychain and auto-refresh: one login per tenant, not per session.
|
|
267
|
+
- A static SUPPA_API_KEY in the client env (CI / single tenant) means no login is needed; it is optional and most users have none.
|
|
268
|
+
- suppa_diagnostics validates the whole setup and reports the login_origin to whitelist. ONE-TIME ORG SETUP: http://localhost:${config.LOGIN_PORT} must be in the Google OAuth client's "Authorized JavaScript origins" — a sign-in page that opens but never completes is almost always this; tell the user so an admin can add it.
|
|
269
|
+
- suppa_use_tenant switches the active instance for ALL later calls; suppa_list_tenants shows what is known and authenticated.
|
|
270
|
+
|
|
271
|
+
DATA BASICS
|
|
272
|
+
- IDs are integers, not UUIDs. Dates are ISO-8601; a naive datetime (no offset) is read as UTC, so pass an explicit offset (+03:00) or convert local times yourself. Task deadlines also accept 'today', 'tomorrow', '+3d', '+2h', '+30m', '+1w'.
|
|
273
|
+
- Each write tool's description states the shapes it demands — relations and enums as {"id": N}, list fields REPLACED unless merge_json says otherwise — and validates against the live schema before writing. Read it before calling: a bare number where a reference belongs returns 201 and stores null.
|
|
274
|
+
- DELETE IS A SOFT DELETE — every delete tool sets deletedAt and leaves the row in place, reversible with suppa_restore_record(entity_name, record_id); never tell the user their data was destroyed. It still needs confirm=true because the row leaves all normal reads; find it again with deleted_scope='deleted'.
|
|
275
|
+
- PERMANENT DELETE IS UNAVAILABLE HERE, BY DESIGN — this server performs REVERSIBLE deletes only. The platform's PERMANENT delete (POST /core/data/:entityName/delete — rows leave the table and cannot be restored) is BLOCKED in the HTTP client itself: no tool, flag, confirm=true or direct call reaches it, and an attempt is refused before any request is sent. Do not look for a tool, a parameter or a workaround — there is none. Asked to erase data for good, say so plainly and offer the soft delete (suppa_delete_record → /remove, undone by suppa_restore_record); permanent removal is an admin action in the platform's own UI.
|
|
276
|
+
- Reads are compact: relation objects omit deletedAt when null (a live row); schema reads omit nulls, false flags and default options and carry a _legend (full=true returns the raw form).
|
|
277
|
+
|
|
278
|
+
SEARCH & FILTERS — suppa_search_records' description carries the comparators, nested AND/OR groups, dotted field paths, "$current-user", paging and the auto-diagnosis of an empty result. Read it before your first search.
|
|
279
|
+
- PROJECT ONLY THE FIELDS YOU NEED: fields_json is on suppa_search_records AND on every task/doc read (suppa_get_task, suppa_search_tasks — which also takes task_ids, so several tasks are ONE call, never one suppa_get_task each — suppa_get_doc, suppa_list_pages, …). A 600-character answer instead of a 50 000-character one, re-sent on every later turn.
|
|
280
|
+
- Unsure of the schema: suppa_list_entities → suppa_describe_entity → suppa_search_records. One record by id needs no filters: suppa_get_record / suppa_get_task / suppa_get_doc.
|
|
281
|
+
|
|
282
|
+
APPROVAL GATES (human-in-the-loop)
|
|
283
|
+
- Every update/move/close/delete tool called without confirm=true returns {"status": "confirmation_required"} and performs NOTHING. Show the user what will change, get explicit approval, then re-call the same tool with confirm=true — never set it on the first call without their go-ahead. Create/read tools and comments need no confirmation.
|
|
284
|
+
- A value shown as <N chars — …> is NOT the stored text: the marker stands in for a long string you supplied in this same call, and the reason after the dash says which. Quote it to the user from your own arguments; never report the marker as the record's content.
|
|
285
|
+
|
|
286
|
+
ENTITY BUILDER (create + edit fields; core-field removal is UI-only) — suppa_add_field's description carries the real field types, the sub_type matrix and the field options; suppa_update_field's carries what may still be changed on a field that exists. Two things those cannot decide for you:
|
|
287
|
+
- OWNED CHILD COLLECTIONS ARE TABULAR PARTS: repeating rows that belong to ONE parent record (a part's BOM items) go through suppa_create_tabular_part(parent_entity, name), which creates the child's 'owner' relation and the parent link. Never model it by hand — suppa_add_field REFUSES field_type='one-to-many'; 'many-to-many' is for a shared lookup referenced by many records.
|
|
288
|
+
- An enum value on a RECORD is a reference, {"id": <Enums row id>} (an array of those for multi-enum), never a bare code like "red" — that is refused. Read the ids with suppa_search_records on 'Enums' filtered by name.
|
|
289
|
+
|
|
290
|
+
CUSTOM FIELDS — ANY entity, not just Tasks: one whose options.customFields is on (an admin enables it; suppa_describe_entity shows it) carries extra columns that vary BY CONTEXT, so which are live differs from record to record — suppa_resolve_custom_fields answers for a given record. Their values ride on the OWNER record under the reserved key customFields, e.g. fields_json {"customFields": {"budget": 600}}.
|
|
291
|
+
|
|
292
|
+
${HOUSE_RULES_DIGEST}
|
|
293
|
+
|
|
294
|
+
ATTACHMENTS — an entity holds files only through a 'file' or 'multi-file' field (add one with suppa_add_field). suppa_attach_file_to_record uploads from local disk and returns the file_ids that are the only handle to the bytes; suppa_list_record_files lists what a record carries; suppa_download_file and suppa_download_files_zip fetch them. Those descriptions carry the rest.
|
|
295
|
+
|
|
296
|
+
MIGRATION (Suppa 1.0 → 2.0) — always dry-run first: suppa_migrate_entities_from_v1(dry_run=true, output_file="plan.json"), review/edit the plan, then execute with plan_file="plan.json", dry_run=false.
|
|
295
297
|
`;
|
|
296
298
|
// ---------------------------------------------------------------------------
|
|
297
299
|
// Registered tool + prompt names (tests assert the counts).
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "suppa-mcp-2",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "MCP server for the Suppa platform (modern.suppa.me) — Tasks, Docs/Pages, Entities & Schema, Forms, Automations, and file attachments, with multi-tenant Google auth. Node port of PyPI suppa-mcp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
+
"suppa-mcp-2": "dist/bin.js",
|
|
7
8
|
"suppa-mcp": "dist/bin.js",
|
|
8
9
|
"suppa-entity-guards": "skills/suppa-entity-code/scripts/install-entity-code-guards.mjs"
|
|
9
10
|
},
|