inistate-mcp 1.2.0 → 1.3.1
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 +4 -2
- package/build/backend.d.ts +16 -0
- package/build/backend.js +22 -0
- package/build/server.js +1 -1
- package/build/tools.js +99 -38
- package/package.json +2 -1
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ Then point your MCP client at `node /absolute/path/to/inistate-mcp/build/index.j
|
|
|
80
80
|
|
|
81
81
|
## Tools
|
|
82
82
|
|
|
83
|
-
Tools marked **(configure)** are only exposed in configure mode — see [Modes](#modes). Tools
|
|
83
|
+
Tools marked **(configure)** are only exposed in configure mode — see [Modes](#modes). Tools that depend on a local-runtime capability, such as `scaffold_module`, are not exposed by the hosted Platform.
|
|
84
84
|
|
|
85
85
|
| Tool | Description |
|
|
86
86
|
|------|-------------|
|
|
@@ -90,6 +90,7 @@ Tools marked **(configure)** are only exposed in configure mode — see [Modes](
|
|
|
90
90
|
| `get_module_schema` | Get the canvas schema (basic or extended tier) — available in every mode |
|
|
91
91
|
| `get_module_canvas` | Get full module definition with stable IDs (round-trippable) **(configure)** |
|
|
92
92
|
| `list_entries` | Query entries with filters, sorting, and pagination |
|
|
93
|
+
| `aggregate_entries` | Count, sum, average, min or max over matching entries, optionally grouped — the platform does the arithmetic |
|
|
93
94
|
| `get_entry` | Read a single entry by ID |
|
|
94
95
|
| `get_form` | Get form fields and defaults for an activity |
|
|
95
96
|
| `submit_activity` | Create, edit, delete, or run custom activities |
|
|
@@ -103,7 +104,7 @@ Tools marked **(configure)** are only exposed in configure mode — see [Modes](
|
|
|
103
104
|
| `validate_design` | Validate a module schema before creating or updating **(configure)** |
|
|
104
105
|
| `create_module` | Create a new module with schema **(configure)** |
|
|
105
106
|
| `update_module` | Update an existing module's schema **(configure)** |
|
|
106
|
-
| `scaffold_module` | Draft a module schema from existing
|
|
107
|
+
| `scaffold_module` | Draft a module schema from existing SQLite, Notion, or Airtable data **(configure)** — local runtime (inistate-core) only; it never creates a module |
|
|
107
108
|
| `switch_mode` | Switch the active mode (runtime / configure / frontend) |
|
|
108
109
|
|
|
109
110
|
## Resources
|
|
@@ -181,6 +182,7 @@ publishes to npm and the MCP registry.
|
|
|
181
182
|
```bash
|
|
182
183
|
npm run release # full release
|
|
183
184
|
npm run release -- --no-push # do everything locally, push nothing
|
|
185
|
+
npm run package:chatgpt # create the ChatGPT plugin ZIP in artifacts/
|
|
184
186
|
```
|
|
185
187
|
|
|
186
188
|
This does:
|
package/build/backend.d.ts
CHANGED
|
@@ -60,6 +60,20 @@ export interface ListEntriesParams {
|
|
|
60
60
|
pageSize?: number;
|
|
61
61
|
fields?: string[];
|
|
62
62
|
}
|
|
63
|
+
/** aggregate_entries: one metric over the entries a listing and filters match, optionally grouped. */
|
|
64
|
+
export interface AggregateEntriesParams {
|
|
65
|
+
module: string;
|
|
66
|
+
listing?: string;
|
|
67
|
+
state?: string;
|
|
68
|
+
search?: string;
|
|
69
|
+
filters?: Record<string, unknown>;
|
|
70
|
+
op: "count" | "sum" | "ave" | "min" | "max";
|
|
71
|
+
field?: string;
|
|
72
|
+
groupBy?: string;
|
|
73
|
+
interval?: "day" | "week" | "month";
|
|
74
|
+
breakdown?: string;
|
|
75
|
+
top?: number;
|
|
76
|
+
}
|
|
63
77
|
export interface GetEntryParams {
|
|
64
78
|
module: string;
|
|
65
79
|
entryId: string | number;
|
|
@@ -132,6 +146,7 @@ export interface Backend {
|
|
|
132
146
|
createModule(payload: Record<string, unknown>): Promise<unknown>;
|
|
133
147
|
updateModule(payload: Record<string, unknown>): Promise<unknown>;
|
|
134
148
|
listEntries(params: ListEntriesParams): Promise<unknown>;
|
|
149
|
+
aggregateEntries(params: AggregateEntriesParams): Promise<unknown>;
|
|
135
150
|
getEntry(params: GetEntryParams): Promise<unknown>;
|
|
136
151
|
getForm(params: GetFormParams): Promise<unknown>;
|
|
137
152
|
submitActivity(payload: Record<string, unknown>): Promise<unknown>;
|
|
@@ -164,6 +179,7 @@ export declare class CloudBackend implements Backend {
|
|
|
164
179
|
createModule(payload: Record<string, unknown>): Promise<unknown>;
|
|
165
180
|
updateModule(payload: Record<string, unknown>): Promise<unknown>;
|
|
166
181
|
listEntries(p: ListEntriesParams): Promise<unknown>;
|
|
182
|
+
aggregateEntries(p: AggregateEntriesParams): Promise<unknown>;
|
|
167
183
|
getEntry(p: GetEntryParams): Promise<unknown>;
|
|
168
184
|
getForm(p: GetFormParams): Promise<unknown>;
|
|
169
185
|
submitActivity(payload: Record<string, unknown>): Promise<unknown>;
|
package/build/backend.js
CHANGED
|
@@ -85,6 +85,28 @@ export class CloudBackend {
|
|
|
85
85
|
body.fields = p.fields;
|
|
86
86
|
return api.post("/api/mcp/list", body);
|
|
87
87
|
}
|
|
88
|
+
aggregateEntries(p) {
|
|
89
|
+
const body = { module: p.module, op: p.op };
|
|
90
|
+
if (p.listing)
|
|
91
|
+
body.listing = p.listing;
|
|
92
|
+
if (p.state)
|
|
93
|
+
body.state = p.state;
|
|
94
|
+
if (p.search)
|
|
95
|
+
body.search = p.search;
|
|
96
|
+
if (p.filters)
|
|
97
|
+
body.filters = p.filters;
|
|
98
|
+
if (p.field)
|
|
99
|
+
body.field = p.field;
|
|
100
|
+
if (p.groupBy)
|
|
101
|
+
body.groupBy = p.groupBy;
|
|
102
|
+
if (p.interval)
|
|
103
|
+
body.interval = p.interval;
|
|
104
|
+
if (p.breakdown)
|
|
105
|
+
body.breakdown = p.breakdown;
|
|
106
|
+
if (p.top !== undefined)
|
|
107
|
+
body.top = p.top;
|
|
108
|
+
return api.post("/api/mcp/aggregate", body);
|
|
109
|
+
}
|
|
88
110
|
getEntry(p) {
|
|
89
111
|
return api.post("/api/mcp/entry", { module: p.module, entryId: p.entryId });
|
|
90
112
|
}
|
package/build/server.js
CHANGED
|
@@ -17,7 +17,7 @@ export function createServer(options = {}) {
|
|
|
17
17
|
// agents don't spend turns rediscovering them.
|
|
18
18
|
const instructions = `Inistate MCP — canonical flows (minimize tool calls):
|
|
19
19
|
- Orient: list_workspaces (auto-selects if exactly one match) -> set_workspace. Both return the workspace's module list; list_modules is only for refreshing it.
|
|
20
|
-
- Read: list_entries with the fields parameter (keeps payloads small) and filters; get_entry for one record.
|
|
20
|
+
- Read: list_entries with the fields parameter (keeps payloads small) and filters; get_entry for one record; aggregate_entries for counts and totals (never add up list_entries pages).
|
|
21
21
|
- Write: get_form once per (module, activity), then submit_activity; reuse the form schema for more entries of the same kind. Use submit_activities for bulk writes (max 100 per call).
|
|
22
22
|
- Design: design_workflow -> create_module (validates internally; validate_design is an optional dry-run). Modify: get_module_canvas -> edit -> update_module (full-canvas payloads validate internally).
|
|
23
23
|
- Files: request_upload_url -> PUT bytes -> confirm_upload (default); upload_file only if that flow fails.
|
package/build/tools.js
CHANGED
|
@@ -316,6 +316,19 @@ function normalizeModuleSections(body) {
|
|
|
316
316
|
resolveDesignRefs(body);
|
|
317
317
|
}
|
|
318
318
|
// ---------- Tool registration ----------
|
|
319
|
+
// The query half of list_entries — which entries it reads — shared verbatim by aggregate_entries, so the
|
|
320
|
+
// two tools take one set of query parameters and the platform runs one query for both (FETIAS
|
|
321
|
+
// McpReadQuery). list_entries adds its page (sort, paging, fields); aggregate_entries its metric.
|
|
322
|
+
const listQueryParams = {
|
|
323
|
+
module: z.string().describe("Module name from list_modules"),
|
|
324
|
+
listing: z
|
|
325
|
+
.string()
|
|
326
|
+
.optional()
|
|
327
|
+
.describe("Listing (saved view) name to query, case-insensitive; 'archive' targets archived entries. Defaults to the unfiltered 'Everything' view, which is admin-only on modules with listings — non-admins must name an accessible listing (an access-denied response lists them)."),
|
|
328
|
+
state: z.string().optional(),
|
|
329
|
+
search: z.string().optional().describe("Free-text search across document ID, state, and text-like fields; supports * and ? wildcards"),
|
|
330
|
+
filters: z.record(z.unknown()).optional(),
|
|
331
|
+
};
|
|
319
332
|
export function registerTools(server, backend) {
|
|
320
333
|
const configureTools = [];
|
|
321
334
|
// Capability gating (MCP spec §1.6). Read once. Platform-only tools below
|
|
@@ -507,11 +520,11 @@ export function registerTools(server, backend) {
|
|
|
507
520
|
.describe("Optimistic concurrency: the `version` from get_entry. The write fails with CONFLICT if the stored version differs."),
|
|
508
521
|
};
|
|
509
522
|
const submitActivityDescription = gov
|
|
510
|
-
? "
|
|
511
|
-
: "
|
|
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.";
|
|
512
525
|
const submitActivitiesDescription = gov
|
|
513
|
-
? "
|
|
514
|
-
: "
|
|
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.";
|
|
515
528
|
/**
|
|
516
529
|
* A module's states as an agent needs them on arrival: each name plus what
|
|
517
530
|
* the designer wrote for an AI about it (ai_hint, ai_instruction) — that a
|
|
@@ -647,7 +660,7 @@ Workflow sequences after workspace is set:
|
|
|
647
660
|
- Design: design_workflow → create_module (validates internally)
|
|
648
661
|
- Execute: list_entries → get_form → submit_activity
|
|
649
662
|
- Modify: get_module_canvas → validate_design → update_module
|
|
650
|
-
- Query: list_entries → get_entry / get_entry_history`),
|
|
663
|
+
- Query: list_entries → get_entry / get_entry_history; aggregate_entries for totals`),
|
|
651
664
|
inputSchema: {
|
|
652
665
|
workspaceId: z
|
|
653
666
|
.union([z.string(), z.number()])
|
|
@@ -724,7 +737,7 @@ Workflow sequences after workspace is set:
|
|
|
724
737
|
// ═══════════════════════════════════════════
|
|
725
738
|
server.registerTool("get_module_schema", {
|
|
726
739
|
title: "Get Module Schema",
|
|
727
|
-
description: "
|
|
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`.",
|
|
728
741
|
inputSchema: {
|
|
729
742
|
module: z.string().describe("Module name from list_modules"),
|
|
730
743
|
tier: z
|
|
@@ -778,14 +791,7 @@ Load resource inistate://schema before modifying to know valid field types, colo
|
|
|
778
791
|
title: "List Entries",
|
|
779
792
|
description: "Query entries with filters, sorting, pagination. Filter keys are field display names; values are equality (simple) or operator objects (contains/startsWith/endsWith/min/max/above/below/between/after/before/empty/exists/yes/no/is/not/excludes). Use {or:[…]} for OR; multiple keys are AND-ed. Use 'me' for User-field self-match. See FilterOperators in inistate://schema/runtime for the full set.\n\nAccess: non-admin users cannot query the unfiltered default 'Everything' view on modules that have listings — pass `listing` with one of their accessible listings (an access-denied response names them).\n\nToken control: use `fields` to restrict the returned `data` to just the columns you need. For modules with many fields this can shrink the response by an order of magnitude. Every item carries entryId, documentId and state whatever `fields` holds; the other system fields (date, createdBy, createdDate, updatedBy, updatedDate, assignees, due) come with the full row, but when `fields` is given only if it names them.\n\nCheck each item's `state` before totalling, counting or ranking entries: a Cancelled or Draft entry usually must not count. get_module_schema's stateDetails says what each state means.",
|
|
780
793
|
inputSchema: {
|
|
781
|
-
|
|
782
|
-
listing: z
|
|
783
|
-
.string()
|
|
784
|
-
.optional()
|
|
785
|
-
.describe("Listing (saved view) name to query, case-insensitive; 'archive' targets archived entries. Defaults to the unfiltered 'Everything' view, which is admin-only on modules with listings — non-admins must name an accessible listing (an access-denied response lists them)."),
|
|
786
|
-
state: z.string().optional(),
|
|
787
|
-
search: z.string().optional().describe("Free-text search across document ID, state, and text-like fields; supports * and ? wildcards"),
|
|
788
|
-
filters: z.record(z.unknown()).optional(),
|
|
794
|
+
...listQueryParams,
|
|
789
795
|
sortBy: z.string().optional(),
|
|
790
796
|
sortDirection: z.enum(["asc", "desc"]).default("asc").optional(),
|
|
791
797
|
currentPage: z.number().int().default(0).optional(),
|
|
@@ -867,11 +873,65 @@ Load resource inistate://schema before modifying to know valid field types, colo
|
|
|
867
873
|
}
|
|
868
874
|
});
|
|
869
875
|
// ═══════════════════════════════════════════
|
|
876
|
+
// 6b. aggregate_entries
|
|
877
|
+
// ═══════════════════════════════════════════
|
|
878
|
+
server.registerTool("aggregate_entries", {
|
|
879
|
+
title: "Aggregate Entries",
|
|
880
|
+
description: "Totals without paging rows: count, sum, average (ave), min or max of a field over the entries list_entries would list, optionally grouped by a field (a date by day, week or month) and broken down by a second field. Use it for 'how many / how much / total / average / top N / per month' questions instead of adding up list_entries pages.\n\nThe query parameters (module, listing, state, search, filters) ARE list_entries' — same names, same meaning, same access — so pass exactly what you would pass list_entries to read those entries.\n\nThe answer: `groups` [{key, count, value}] (with a breakdown, `values` [{key, value}] per group), `total` {count, value} over EVERY matching entry, `complete` (false: the module's engine read only its first 501 entries, so the figures are partial — narrow the filters, or say they are partial) and `groupsTruncated` (only the largest `top` groups, or the latest periods, are listed; `total` is still whole).\n\nFilter or group by state when Cancelled or Draft entries must not count. What a figure means — signs, which entries belong in it — comes from the module's description and get_module_schema.",
|
|
881
|
+
inputSchema: {
|
|
882
|
+
...listQueryParams,
|
|
883
|
+
op: z.enum(["count", "sum", "ave", "min", "max"]).describe("The metric"),
|
|
884
|
+
field: z.string().optional().describe("Field the metric reads (a number for sum/ave; a number or date for min/max). Not needed for count."),
|
|
885
|
+
groupBy: z.string().optional().describe("Field to group by: a display name, or state, date, createdBy, assignees …"),
|
|
886
|
+
interval: z.enum(["day", "week", "month"]).optional().describe("Only when groupBy is a date field. Default day."),
|
|
887
|
+
breakdown: z.string().optional().describe("Second field, splitting each group"),
|
|
888
|
+
top: z.number().int().min(1).max(500).optional().describe("Most groups returned, 1–500. Default 100."),
|
|
889
|
+
workspaceId: wsParam,
|
|
890
|
+
},
|
|
891
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false, idempotentHint: true },
|
|
892
|
+
}, async ({ module: moduleName, listing, state, search, filters, op, field, groupBy, interval, breakdown, top, workspaceId }) => {
|
|
893
|
+
try {
|
|
894
|
+
applyWorkspace(workspaceId);
|
|
895
|
+
const data = await backend.aggregateEntries({
|
|
896
|
+
module: moduleName,
|
|
897
|
+
listing,
|
|
898
|
+
state,
|
|
899
|
+
search,
|
|
900
|
+
filters,
|
|
901
|
+
op,
|
|
902
|
+
field,
|
|
903
|
+
groupBy,
|
|
904
|
+
interval,
|
|
905
|
+
breakdown,
|
|
906
|
+
top,
|
|
907
|
+
});
|
|
908
|
+
return ok(data);
|
|
909
|
+
}
|
|
910
|
+
catch (e) {
|
|
911
|
+
// A platform build without the route answers with no `error` of its own: 405 where the
|
|
912
|
+
// GET-only api/mcp/{moduleName} route catches the path (what 132 and production answered
|
|
913
|
+
// before FETIAS r33760), or a bare 404. A missing module says "Not found" and stays as is.
|
|
914
|
+
const structured = e && typeof e === "object" && "structured" in e
|
|
915
|
+
? e.structured
|
|
916
|
+
: null;
|
|
917
|
+
if (structured && (structured.error === "HTTP 405" || structured.error === "HTTP 404")) {
|
|
918
|
+
return err({
|
|
919
|
+
structured: {
|
|
920
|
+
error: "not_supported",
|
|
921
|
+
message: "This Inistate server does not offer aggregate_entries yet.",
|
|
922
|
+
agent_action: "Use list_entries instead, and tell the user any total you give was added up from the rows you read.",
|
|
923
|
+
},
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
return err(e);
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
// ═══════════════════════════════════════════
|
|
870
930
|
// 7. get_entry
|
|
871
931
|
// ═══════════════════════════════════════════
|
|
872
932
|
server.registerTool("get_entry", {
|
|
873
933
|
title: "Get Entry",
|
|
874
|
-
description: "Read a single entry by its ID. Returns current field values, state, audit metadata, and available
|
|
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).",
|
|
875
935
|
inputSchema: {
|
|
876
936
|
module: z.string().describe("Module name from list_modules"),
|
|
877
937
|
entryId: z
|
|
@@ -895,7 +955,7 @@ Load resource inistate://schema before modifying to know valid field types, colo
|
|
|
895
955
|
// ═══════════════════════════════════════════
|
|
896
956
|
server.registerTool("get_form", {
|
|
897
957
|
title: "Get Activity Form",
|
|
898
|
-
description: "
|
|
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.",
|
|
899
959
|
inputSchema: {
|
|
900
960
|
module: z.string().describe("Module name from list_modules"),
|
|
901
961
|
activity: z
|
|
@@ -1853,12 +1913,12 @@ Load resources inistate://schema and inistate://design-guide before designing fo
|
|
|
1853
1913
|
// ═══════════════════════════════════════════
|
|
1854
1914
|
// The inverse on-ramp: the user already has data in a Notion database, an
|
|
1855
1915
|
// Airtable table, or a local SQLite table. Capability-gated — only a backend
|
|
1856
|
-
// that declares `scaffold` (the local runtime) serves it
|
|
1857
|
-
//
|
|
1858
|
-
//
|
|
1859
|
-
//
|
|
1860
|
-
//
|
|
1861
|
-
//
|
|
1916
|
+
// that declares `scaffold` (the local runtime) serves it. It is not
|
|
1917
|
+
// advertised by the hosted Platform: an unavailable tool is not a useful
|
|
1918
|
+
// model-callable operation. The introspection itself lives behind the Backend
|
|
1919
|
+
// so the closed-source engine owns it.
|
|
1920
|
+
// Only a capable local runtime registers the tool, so its detailed input
|
|
1921
|
+
// descriptions are never exposed as an unusable hosted operation.
|
|
1862
1922
|
const scaffoldInput = caps.scaffold
|
|
1863
1923
|
? {
|
|
1864
1924
|
source: z
|
|
@@ -1880,21 +1940,22 @@ Load resources inistate://schema and inistate://design-guide before designing fo
|
|
|
1880
1940
|
name: z.string().optional(),
|
|
1881
1941
|
state: z.string().optional(),
|
|
1882
1942
|
};
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1943
|
+
if (caps.scaffold)
|
|
1944
|
+
configureTools.push(server.registerTool("scaffold_module", {
|
|
1945
|
+
title: "Scaffold Module from Existing Data",
|
|
1946
|
+
description: gatedDesc(caps.scaffold, "Design a module schema together with the user from data they ALREADY have — a Notion database, an Airtable table, or a local SQLite table. This is the inverse on-ramp: instead of designing from scratch, read the existing shape and refine it with the user. One container (a SQLite database, an Airtable base, a Notion workspace) can yield several modules — discover the tables, then model the chosen ones.\n\nFlow (use it conversationally):\n1. DISCOVER — call with just `source` pointed at the container: a SQLite database path, an `airtable://<baseId>` (no table), or a bare `notion://`. Returns { discovery: true, tables: [{ name, id?, columns, rows?, hasState, scaffold_source }] }. Show these to the user and ask which one(s) to model; each becomes its own module.\n2. DRAFT — call again with a chosen table's `scaffold_source` as `source` (or a SQLite `table`). Returns { schema, validation, suggestions } — columns become typed fields, a detected status/state/stage/phase column becomes states.\n3. REFINE together — confirm the inferred field types with the user, then define activities + flows (the governed transitions; design_workflow can scaffold a pattern).\n4. CREATE — validate_design → create_module, then point the runtime at the same data.\n\nTargets: notion://<databaseId> or bare notion:// (needs INISTATE_NOTION_TOKEN), airtable://<baseId>/<tableIdOrName> or airtable://<baseId> (needs INISTATE_AIRTABLE_TOKEN; listing a base's tables needs schema.bases:read), or a local SQLite path. Credentials are read from the environment — never pass tokens as arguments.", "Local-runtime only. This inspects an existing data source and returns a module-schema draft; it never creates a module. Use design_workflow to draft a module here."),
|
|
1947
|
+
inputSchema: scaffoldInput,
|
|
1948
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false, idempotentHint: true },
|
|
1949
|
+
}, async ({ source, table, name, state }) => {
|
|
1950
|
+
if (!caps.scaffold)
|
|
1951
|
+
return ok(capabilityMessage("scaffold", backend.kind));
|
|
1952
|
+
try {
|
|
1953
|
+
const data = await backend.scaffoldModule({ source, table, name, state });
|
|
1954
|
+
return ok(data);
|
|
1955
|
+
}
|
|
1956
|
+
catch (e) {
|
|
1957
|
+
return err(e);
|
|
1958
|
+
}
|
|
1959
|
+
}));
|
|
1899
1960
|
return { configureTools };
|
|
1900
1961
|
}
|
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.
|
|
4
|
+
"version": "1.3.1",
|
|
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.
|
|
11
|
+
"version": "1.3.1",
|
|
12
12
|
"packages": [
|
|
13
13
|
{
|
|
14
14
|
"registryType": "npm",
|
|
15
15
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
16
16
|
"identifier": "inistate-mcp",
|
|
17
|
-
"version": "1.
|
|
17
|
+
"version": "1.3.1",
|
|
18
18
|
"transport": {
|
|
19
19
|
"type": "stdio"
|
|
20
20
|
},
|