inistate-mcp 1.3.0 → 1.3.2

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
@@ -182,6 +182,7 @@ publishes to npm and the MCP registry.
182
182
  ```bash
183
183
  npm run release # full release
184
184
  npm run release -- --no-push # do everything locally, push nothing
185
+ npm run package:chatgpt # create the ChatGPT plugin ZIP in artifacts/
185
186
  ```
186
187
 
187
188
  This does:
@@ -61,7 +61,12 @@ export class FileClientsStore {
61
61
  try {
62
62
  if (!existsSync(this.file))
63
63
  return;
64
- const parsed = JSON.parse(readFileSync(this.file, "utf8"));
64
+ const raw = readFileSync(this.file, "utf8");
65
+ // A zero-byte file (e.g. pre-created with `touch`) is an empty store, not corruption;
66
+ // treating it as corrupt would disable persistence for the whole process.
67
+ if (!raw.trim())
68
+ return;
69
+ const parsed = JSON.parse(raw);
65
70
  if (!Array.isArray(parsed)) {
66
71
  console.error(`OAuth client store at ${this.file} is not a JSON array — ignoring it`);
67
72
  return;
package/build/http.js CHANGED
@@ -20,8 +20,18 @@ const ISSUER_URL = process.env.OAUTH_ISSUER_URL || `http://localhost:${PORT}`;
20
20
  const APP_URL = process.env.INISTATE_APP_URL || "https://app.inistate.com";
21
21
  const APP_LOGIN_PATH = process.env.INISTATE_APP_LOGIN_PATH || "/#/login";
22
22
  const app = express();
23
+ // Behind nginx (+ CloudFront) every socket peer is the proxy, so without this req.ip is the
24
+ // same for every caller and the per-IP rate limiters share one bucket across all users.
25
+ // Set TRUST_PROXY to the number of proxy hops in front of this process (nginx + CloudFront = 2).
26
+ const TRUST_PROXY = process.env.TRUST_PROXY;
27
+ if (TRUST_PROXY) {
28
+ app.set("trust proxy", /^\d+$/.test(TRUST_PROXY) ? Number(TRUST_PROXY) : TRUST_PROXY);
29
+ }
30
+ // DCR is unauthenticated and Claude registers from shared Anthropic egress IPs, so the SDK's
31
+ // default of 20/hour per IP locks out new users ("Couldn't register with Inistate's sign-in service").
32
+ const REGISTRATION_RATE_LIMIT = Number(process.env.OAUTH_REGISTRATION_RATE_LIMIT) || 300;
23
33
  /* ------------------------------------------------------------------ */
24
- /* CORS (must come before routes) */
34
+ /* CORS (must come before routes) */
25
35
  /* ------------------------------------------------------------------ */
26
36
  app.use((_req, res, next) => {
27
37
  res.setHeader("Access-Control-Allow-Origin", "*");
@@ -47,6 +57,7 @@ app.use(mcpAuthRouter({
47
57
  baseUrl: new URL(ISSUER_URL),
48
58
  resourceServerUrl: new URL("/mcp", ISSUER_URL),
49
59
  scopesSupported: SUPPORTED_SCOPES,
60
+ clientRegistrationOptions: { rateLimit: { max: REGISTRATION_RATE_LIMIT } },
50
61
  }));
51
62
  /* ------------------------------------------------------------------ */
52
63
  /* OAuth authorize callback (login page POSTs here) */
package/build/schema.d.ts CHANGED
@@ -4,6 +4,9 @@ export declare const FRONTEND_GUIDE: string;
4
4
  export declare const SCHEMA_RUNTIME: Record<string, any>;
5
5
  export declare const SCHEMA_CONFIGURE: Record<string, any>;
6
6
  export declare const VALID_FIELD_TYPES: string[];
7
+ export declare const AI_BLOCKED_CREATE_TYPES: Set<string>;
8
+ /** The field types an AI may create: what design_workflow offers. */
9
+ export declare const AI_CREATABLE_FIELD_TYPES: string[];
7
10
  export declare const RESERVED_ACTIVITY_NAMES: string[];
8
11
  export declare const RESERVED_INFORMATION_NAMES: string[];
9
12
  export declare const VALID_ACTOR_TYPES: string[];
package/build/schema.js CHANGED
@@ -95,6 +95,19 @@ export const SCHEMA_RUNTIME = buildSchemaView(RUNTIME_DEFINITIONS, RUNTIME_WORKF
95
95
  export const SCHEMA_CONFIGURE = buildSchemaView(CONFIGURE_DEFINITIONS, CONFIGURE_WORKFLOW_KEYS);
96
96
  // ---------- Derived lookups ----------
97
97
  export const VALID_FIELD_TYPES = SCHEMA.definitions.FieldType.enum;
98
+ // SS06300 (ruled 2026-10-16) - the types the platform refuses on a NEW field made by AI
99
+ // (McpCanvasTransformer.AiBlockedCreateTypeKeys): Date Range is internal, and a Formula needs an
100
+ // expression no MCP schema carries, so it would never compute. Existing fields of these types (they
101
+ // carry an id) round-trip on update untouched.
102
+ export const AI_BLOCKED_CREATE_TYPES = new Set(["daterange", "formula"]);
103
+ /** The field types an AI may create: what design_workflow offers. */
104
+ export const AI_CREATABLE_FIELD_TYPES = VALID_FIELD_TYPES.filter((t) => !AI_BLOCKED_CREATE_TYPES.has(t.toLowerCase()));
105
+ /** The platform's wording (McpCanvasTransformer.AiBlockedCreateTypeHintFor). */
106
+ function aiBlockedCreateHint(baseType) {
107
+ return baseType === "formula"
108
+ ? "'Formula' is an internal field type that cannot be created by AI: a formula field needs an expression, which cannot be given here, so it would never compute. Model the value as a Number or Currency field instead, and set the formula in Studio if it should be calculated."
109
+ : "'Date Range' is an internal field type that cannot be created by AI. Model a date range as two Date fields instead (e.g. 'Start Date' and 'End Date').";
110
+ }
98
111
  // SS06168 — Studio's reserved words (webApp src/components/commons/designValidator.js
99
112
  // activityReservedKeywords / informationReservedKeywords). Studio refuses a custom activity or
100
113
  // information field with one of these names and shows the module as "Configuration incomplete";
@@ -622,6 +635,10 @@ export function validateDesign(schema, mode = "create") {
622
635
  }
623
636
  const base = baseTypeOf(ftype);
624
637
  const hasConnection = typeof f.connection === "string" && f.connection.trim() !== "";
638
+ // SS06300: mirrors the platform - new fields only, so validate_design cannot pass what create_module refuses.
639
+ if (AI_BLOCKED_CREATE_TYPES.has(base) && (mode === "create" || !f.id)) {
640
+ errors.push(`Information field '${f.name}': ${aiBlockedCreateHint(base)}`);
641
+ }
625
642
  if ((base === "selection" || base === "tag")
626
643
  && (!f.options || f.options.length === 0)
627
644
  && !ftype.includes("(")) {
@@ -651,6 +668,10 @@ export function validateDesign(schema, mode = "create") {
651
668
  if (subType && !isValidFieldType(subType)) {
652
669
  errors.push(`Table field '${f.name}' sub-field '${sf.name}' has invalid type '${sf.type}'.`);
653
670
  }
671
+ if (subType && AI_BLOCKED_CREATE_TYPES.has(baseTypeOf(subType))
672
+ && (mode === "create" || !sf.id)) {
673
+ errors.push(`Sub-field '${sf.name}' in '${f.name}': ${aiBlockedCreateHint(baseTypeOf(subType))}`);
674
+ }
654
675
  if (subType && REFERENCE_TYPES_LOWER.has(baseTypeOf(subType))) {
655
676
  errors.push(`Table field '${f.name}' sub-field '${sf.name}' has type '${sf.type}' — Module/Modules/User/Users reference types are not supported inside Table sub-fields.`);
656
677
  }
@@ -1025,7 +1046,7 @@ export function normalizeIndustry(industry) {
1025
1046
  // Returned with every design_workflow call — the design funnel's first step is
1026
1047
  // where agents form their vocabulary, so the constraints ride along.
1027
1048
  const DESIGN_CONSTRAINTS = {
1028
- field_types: VALID_FIELD_TYPES,
1049
+ field_types: AI_CREATABLE_FIELD_TYPES,
1029
1050
  state_colors: VALID_COLORS,
1030
1051
  reference_fields: "User/Users/Module/Modules fields require 'connection': the name of a module that exists in this workspace. Not supported inside Table sub-fields.",
1031
1052
  actors: VALID_ACTOR_TYPES,
package/build/tools.js CHANGED
@@ -520,11 +520,11 @@ export function registerTools(server, backend) {
520
520
  .describe("Optimistic concurrency: the `version` from get_entry. The write fails with CONFLICT if the stored version differs."),
521
521
  };
522
522
  const submitActivityDescription = gov
523
- ? "Perform an activity on a module entry: standard (create [no entryId], edit, delete, changeStatus, comment, duplicate, manage) or any custom activity from get_module_schema. Call get_form before the first submission per (module, activity); reuse its schema for further entries. The `ai` object is REQUIRED (reasoning + model + confidence). If confidence < the activity's threshold, the transition is suppressed and the entry is flagged. Server-side guard rules (human/hybrid actor, state-change confirm, confidence-inflation) may block — see inistate://guardrails. Input shapes: ActivitySubmission in inistate://schema/runtime."
524
- : "Perform an activity on a module entry: create (no entryId), edit, delete, or a custom activity that drives a state transition. Call get_form before the first submission per (module, activity); reuse its schema for further entries. A custom activity is accepted only if a flow permits it from the entry's current state — otherwise it is rejected (Illegal transition) and nothing is written. The local runtime applies no confidence/actor gating: `ai` is optional and there is no flagged outcome. Use idempotencyKey for safe retries and expectedVersion for optimistic concurrency.";
523
+ ? "Write operation: one call performs exactly one named activity on one entry of one module, and nothing else runs. The activity is the `activity` argument — a standard one (create [no entryId], edit, delete, changeStatus, comment, duplicate, manage) or a custom activity the workspace's designer defined (listed by get_module_schema tier=extended); activity names are data, not hidden tools. Call get_form before the first submission per (module, activity); reuse its schema for further entries. The `ai` object is REQUIRED (reasoning + model + confidence). If confidence < the activity's threshold, the transition is suppressed and the entry is flagged. Server-side guard rules (human/hybrid actor, state-change confirm, confidence-inflation) may block — see inistate://guardrails. Input shapes: ActivitySubmission in inistate://schema/runtime."
524
+ : "Write operation: one call performs exactly one named activity on one entry of one module, and nothing else runs. The activity is the `activity` argument — create (no entryId), edit, delete, or a custom activity defined by the workspace's designer that drives a state transition; activity names are data, not hidden tools. Call get_form before the first submission per (module, activity); reuse its schema for further entries. A custom activity is accepted only if a flow permits it from the entry's current state — otherwise it is rejected (Illegal transition) and nothing is written. The local runtime applies no confidence/actor gating: `ai` is optional and there is no flagged outcome. Use idempotencyKey for safe retries and expectedVersion for optimistic concurrency.";
525
525
  const submitActivitiesDescription = gov
526
- ? "Bulk variant of submit_activity: one module + one activity applied to many entries, each item with its own input. Use instead of N sequential submit_activity calls when creating/editing many rows — one tool turn instead of N. A per-item `ai` wholly replaces the top-level default (no partial merge). Items run sequentially fail-soft on the server: one failure does not abort the rest; per-item outcomes (success, entryId, flagged, validation details) return in `results` — use `clientRef` to correlate. Max 100 items; chunk beyond that. Guardrails match submit_activity at batch level: actor='human' rejects the whole batch; actor='hybrid', activity='changeStatus', or any state override (top-level or per-item) requires `confirmed: true`."
527
- : "Bulk variant of submit_activity: one module + one activity applied to many entries, each item with its own input. Use instead of N sequential submit_activity calls when creating/editing many rows. A per-item `ai` wholly replaces the top-level default. Items run sequentially fail-soft: one failure does not abort the rest; per-item outcomes return in `results` — use `clientRef` to correlate. Max 100 items per request. The local runtime applies no confidence/actor gating.";
526
+ ? "Write operation, the bulk variant of submit_activity: one call applies one named activity of one module to many entries (the same activity for every item; nothing else runs), each item with its own input. Use instead of N sequential submit_activity calls when creating/editing many rows — one tool turn instead of N. A per-item `ai` wholly replaces the top-level default (no partial merge). Items run sequentially fail-soft on the server: one failure does not abort the rest; per-item outcomes (success, entryId, flagged, validation details) return in `results` — use `clientRef` to correlate. Max 100 items; chunk beyond that. Guardrails match submit_activity at batch level: actor='human' rejects the whole batch; actor='hybrid', activity='changeStatus', or any state override (top-level or per-item) requires `confirmed: true`."
527
+ : "Write operation, the bulk variant of submit_activity: one call applies one named activity of one module to many entries (the same activity for every item; nothing else runs), each item with its own input. Use instead of N sequential submit_activity calls when creating/editing many rows. A per-item `ai` wholly replaces the top-level default. Items run sequentially fail-soft: one failure does not abort the rest; per-item outcomes return in `results` — use `clientRef` to correlate. Max 100 items per request. The local runtime applies no confidence/actor gating.";
528
528
  /**
529
529
  * A module's states as an agent needs them on arrival: each name plus what
530
530
  * the designer wrote for an AI about it (ai_hint, ai_instruction) — that a
@@ -737,7 +737,7 @@ Workflow sequences after workspace is set:
737
737
  // ═══════════════════════════════════════════
738
738
  server.registerTool("get_module_schema", {
739
739
  title: "Get Module Schema",
740
- description: "Get the canvas schema for a module. Use tier=basic (default) for fields and states only. Use tier=extended to also include activities and flows. Use basic for query operations. Use extended when you need to understand available activities and state transitions.\n\nWhat the module's designer wrote for an AI rides beside the name lists: `stateDetails` (both tiers) gives each state's ai_hint/ai_instruction — e.g. which states no longer count — and `activityDetails` (extended) gives each activity's `actor` (ai: you may submit it; hybrid: only after the user approves the planned submission; human: never — a person performs it), ai_hint/ai_instruction, confidence_threshold and `from` (the states it can be performed in). A top-level `ai_instruction` is the module's standing instruction — follow it.\n\nBoth tiers include your accessible `listings`: each carries its designed filter in the SAME shape as list_entries' `filters` (applied automatically when that listing is queried — pick the listing whose conditions already match the question and do NOT re-add them as `filters`), plus partialFilter (an inexpressible formula/script condition also applies), profileOnly (rows limited to the current user's own entries) and scripted markers. Pass a listing's `name` as list_entries' `listing`.",
740
+ description: "Read-only lookup of one module's schema; it changes nothing and performs no activity. Returns the canvas schema for a module. Use tier=basic (default) for fields and states only. Use tier=extended to also include activities and flows. Use basic for query operations. Use extended when you need to understand available activities and state transitions.\n\nWhat the module's designer wrote for an AI rides beside the name lists: `stateDetails` (both tiers) gives each state's ai_hint/ai_instruction — e.g. which states no longer count — and `activityDetails` (extended) gives each activity's `actor` (ai: you may submit it; hybrid: only after the user approves the planned submission; human: never — a person performs it), ai_hint/ai_instruction, confidence_threshold and `from` (the states it can be performed in). A top-level `ai_instruction` is the module's standing instruction — follow it.\n\nBoth tiers include your accessible `listings`: each carries its designed filter in the SAME shape as list_entries' `filters` (applied automatically when that listing is queried — pick the listing whose conditions already match the question and do NOT re-add them as `filters`), plus partialFilter (an inexpressible formula/script condition also applies), profileOnly (rows limited to the current user's own entries) and scripted markers. Pass a listing's `name` as list_entries' `listing`.",
741
741
  inputSchema: {
742
742
  module: z.string().describe("Module name from list_modules"),
743
743
  tier: z
@@ -931,7 +931,7 @@ Load resource inistate://schema before modifying to know valid field types, colo
931
931
  // ═══════════════════════════════════════════
932
932
  server.registerTool("get_entry", {
933
933
  title: "Get Entry",
934
- description: "Read a single entry by its ID. Returns current field values, state, audit metadata, and available activities.",
934
+ description: "Read-only lookup of a single entry by its ID; it changes nothing and performs no activity. Returns current field values, state, audit metadata, and the names of the activities available on it (to perform one, use get_form then submit_activity).",
935
935
  inputSchema: {
936
936
  module: z.string().describe("Module name from list_modules"),
937
937
  entryId: z
@@ -955,7 +955,7 @@ Load resource inistate://schema before modifying to know valid field types, colo
955
955
  // ═══════════════════════════════════════════
956
956
  server.registerTool("get_form", {
957
957
  title: "Get Activity Form",
958
- description: "Get the form fields, current values, and options for a module activity. Call this before the FIRST submit_activity on each (module, activity) pair — the form schema is stable within a session, so reuse it for subsequent entries (per-entry current values come from get_entry/list_entries). User values with no matching field: omit them and note the omission. Never fabricate form data — when a value is uncertain, submit with a lower ai.confidence and state the assumption instead of blocking to ask. A field may carry `label`: the name THIS activity's form shows for it (the designer relabelled it) — when the user names a field by that label, it means this field; key `input` by the field name (the label is accepted too). The response's `actor` says who may perform the activity: ai — submit it; hybrid — show the user what you plan to submit and get their explicit approval, then submit with confirmed: true; human — do not submit, a person performs it in Inistate. The response's ai_hint/ai_instruction are the designer's guidance for performing the activity; an `ai_hint` on a field or Table/List column says how to fill it.",
958
+ description: "Read-only lookup of the input form for one named activity of one module; it does not perform the activity (submit_activity does). Returns the form fields, current values, and options. Call this before the FIRST submit_activity on each (module, activity) pair — the form schema is stable within a session, so reuse it for subsequent entries (per-entry current values come from get_entry/list_entries). User values with no matching field: omit them and note the omission. Never fabricate form data — when a value is uncertain, submit with a lower ai.confidence and state the assumption instead of blocking to ask. A field may carry `label`: the name THIS activity's form shows for it (the designer relabelled it) — when the user names a field by that label, it means this field; key `input` by the field name (the label is accepted too). The response's `actor` says who may perform the activity: ai — submit it; hybrid — show the user what you plan to submit and get their explicit approval, then submit with confirmed: true; human — do not submit, a person performs it in Inistate. The response's ai_hint/ai_instruction are the designer's guidance for performing the activity; an `ai_hint` on a field or Table/List column says how to fill it.",
959
959
  inputSchema: {
960
960
  module: z.string().describe("Module name from list_modules"),
961
961
  activity: z
@@ -1162,6 +1162,11 @@ Load resource inistate://schema before modifying to know valid field types, colo
1162
1162
  body.due = due;
1163
1163
  if (ai)
1164
1164
  body.ai = ai;
1165
+ // SS06044: the platform checks the approval itself where it matters - the `comment`
1166
+ // standard (hybrid) and an App module's hybrid-tier email recipients (SS05963) - so
1167
+ // the guard's `confirmed` has to travel with the call, not stop at the guard.
1168
+ if (confirmed === true)
1169
+ body.confirmed = true;
1165
1170
  if (idempotencyKey)
1166
1171
  body.idempotencyKey = idempotencyKey;
1167
1172
  if (expectedVersion !== undefined)
@@ -1423,6 +1428,10 @@ Load resource inistate://schema before modifying to know valid field types, colo
1423
1428
  };
1424
1429
  if (ai)
1425
1430
  body.ai = ai;
1431
+ // SS06342: as submit_activity (SS06044) - the platform re-checks the approval itself for
1432
+ // an App send whose recipients need one, so the guard's `confirmed` travels with the call.
1433
+ if (confirmed === true)
1434
+ body.confirmed = true;
1426
1435
  log("submit_activities", `module=${moduleName} activity=${activity} count=${items.length}`);
1427
1436
  const data = (await backend.submitActivities(body));
1428
1437
  const results = Array.isArray(data.results)
@@ -186,6 +186,16 @@
186
186
  "type": "array",
187
187
  "items": { "type": "string" },
188
188
  "description": "Subset of allowed options for Selection/Tag fields in this activity. Options may include emoji prefixes. Omit to allow all options."
189
+ },
190
+ "hidden": {
191
+ "type": "boolean",
192
+ "readOnly": true,
193
+ "description": "Read back only (get_module_canvas): this activity's form never shows the field - the designer turned it off and gave it no condition. Same rule get_form reports; submit_activity refuses a value for it. Ignored on input (update_module does not set visibility)."
194
+ },
195
+ "visibleWhen": {
196
+ "type": "string",
197
+ "readOnly": true,
198
+ "description": "Read back only (get_module_canvas): the form shows the field only while this condition holds, written in display names, e.g. {{Skip Reason}}=='Other'. A required field with a condition is required only while it is shown. Ignored on input."
189
199
  }
190
200
  },
191
201
  "additionalProperties": false
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "inistate-mcp",
3
3
  "mcpName": "io.github.Inistate/inistate-mcp",
4
- "version": "1.3.0",
4
+ "version": "1.3.2",
5
5
  "description": "MCP server for the Inistate platform — no-code apps creation powered by AI",
6
6
  "type": "module",
7
7
  "author": "Inistate",
@@ -55,6 +55,7 @@
55
55
  "changeset": "changeset",
56
56
  "version": "npx changeset version && node scripts/sync-server-json.js",
57
57
  "release": "node scripts/release.mjs",
58
+ "package:chatgpt": "node scripts/package-chatgpt-submission.mjs",
58
59
  "sync:server": "node scripts/sync-server-json.js",
59
60
  "start:http": "node build/http.js",
60
61
  "inspector": "npx @modelcontextprotocol/inspector build/index.js",
package/server.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "url": "https://github.com/inistate/inistate-mcp",
9
9
  "source": "github"
10
10
  },
11
- "version": "1.3.0",
11
+ "version": "1.3.2",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "inistate-mcp",
17
- "version": "1.3.0",
17
+ "version": "1.3.2",
18
18
  "transport": {
19
19
  "type": "stdio"
20
20
  },