@enfyra/mcp-server 0.0.10 → 0.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/mcp-server",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "MCP server for Enfyra - manage your Enfyra instance via Claude Code",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -69,7 +69,7 @@ export function buildMcpServerInstructions(apiBaseUrl) {
69
69
  '- **Not all system tables have a REST route.** `query_table`, `find_one_record`, `create_record`, etc. all go through the dynamic REST API and will return **404** if the table has no registered route.',
70
70
  '- **`column_definition` has NO route** — do NOT call `query_table("column_definition", …)`. It will always 404.',
71
71
  '- To check which tables are accessible via MCP tools, call `get_all_routes` and look for the route whose `mainTable.id` matches the table you need, or `get_all_metadata` to see all table names.',
72
- '- **Tables confirmed to have REST routes (system):** `table_definition`, `route_definition`, `user_definition`, `setting_definition`, `ai_config_definition`, `role_definition`, `menu_definition`, `extension_definition`, `folder_definition`, `file_definition`, `file_permission_definition`, `package_definition`, `bootstrap_script_definition`, `storage_config_definition`, `ai_conversation_definition`, `ai_message_definition`, `websocket_definition`, `websocket_event_definition`, `oauth_config_definition`, `oauth_account_definition`, `method_definition`, `pre_hook_definition`, `post_hook_definition`, `route_handler_definition`, `route_permission_definition`.',
72
+ '- **Tables confirmed to have REST routes (system):** `table_definition`, `route_definition`, `user_definition`, `setting_definition`, `ai_config_definition`, `role_definition`, `menu_definition`, `extension_definition`, `folder_definition`, `file_definition`, `file_permission_definition`, `package_definition`, `bootstrap_script_definition`, `storage_config_definition`, `ai_conversation_definition`, `ai_message_definition`, `websocket_definition`, `websocket_event_definition`, `oauth_config_definition`, `oauth_account_definition`, `method_definition`, `pre_hook_definition`, `post_hook_definition`, `route_handler_definition`, `route_permission_definition`, `flow_definition`, `flow_step_definition`, `flow_execution_definition`.',
73
73
  '- **Tables without REST routes (internal/system only):** `column_definition`, `relation_definition` — these are managed indirectly via cascade on `table_definition` (PATCH /table_definition/{id} with columns/relations array). The `create_column` MCP tool handles this automatically.',
74
74
  '',
75
75
  '### Schema / table migration (sequential only)',
@@ -100,6 +100,17 @@ export function buildMcpServerInstructions(apiBaseUrl) {
100
100
  '- **Client**: `io("ORIGIN/namespace", {auth: {token: JWT}})` — e.g. `io("http://localhost:3000/chat", {auth: {token: "…"}})`. WebSocket origin usually matches HTTP host (drop `/api` for WS path). `path` in gateway = namespace.',
101
101
  '- **Workflow**: Create gateway → `create_record` on `websocket_definition`. Create event → `create_record` on `websocket_event_definition` with `gateway: {id}`. Changes auto-reload; test handlers before saving.',
102
102
  '',
103
+ '### Flows (Automated Workflows)',
104
+ '- Enfyra supports automated workflows via **`flow_definition`**, **`flow_step_definition`**, and **`flow_execution_definition`** tables.',
105
+ '- **Flow** (`flow_definition`): `name`, `triggerType` (`schedule`, `event`, `webhook`, `manual`), `triggerConfig` (JSON), `timeout`, `isEnabled`.',
106
+ '- **Step** (`flow_step_definition`): `flow` → flow id, `key` (unique identifier for data chain), `stepOrder`, `type` (`script`, `condition`, `query`, `create`, `update`, `delete`, `http`, `trigger_flow`, `sleep`, `log`), `config` (JSON), `timeout`, `onError` (`stop`, `skip`, `retry`), `retryAttempts`.',
107
+ '- **Execution history** (`flow_execution_definition`): `flow` → flow id, `status`, `triggerPayload`, `context` (full data chain), `completedSteps`, `error`, `startedAt`, `completedAt`, `duration`.',
108
+ '- **triggerConfig examples**: schedule: `{"cron":"0 2 * * *","timezone":"UTC"}`, event: `{"table":"order_definition","action":"create"}`, webhook: `{"path":"/hooks/payment"}`, manual: `{}`.',
109
+ '- **Step config examples**: script: `{"code":"return $ctx.$repos.user_definition.find({limit:10})"}`, condition: `{"code":"return $ctx.$flow.$last?.data?.length > 0"}`, query: `{"table":"user_definition","filter":{"status":{"_eq":"active"}},"limit":10}`, http: `{"url":"https://api.example.com","method":"POST","body":{}}`, sleep: `{"ms":5000}`, trigger_flow: `{"flowId":2}`.',
110
+ '- **Data chain**: Steps access previous results via `$ctx.$flow.<stepKey>` and `$ctx.$flow.$last`. Trigger payload via `$ctx.$flow.$trigger`.',
111
+ '- **Workflow**: Create flow → `create_record` on `flow_definition`. Add steps → `create_record` on `flow_step_definition` with `flow: {id}`. Trigger manually or via schedule/event/webhook.',
112
+ '- **In handlers/hooks**: Trigger flows via `$ctx.$flows.trigger("flow-name", {payload})` or `$ctx.$flows.trigger(flowId, {payload})`.',
113
+ '',
103
114
  '### Extension (Vue SFC only — NOT React)',
104
115
  '- **CRITICAL:** MUST call `create_record` or `update_record` on `extension_definition` — outputting Vue code in chat does NOT save it. User will NOT see it.',
105
116
  '- **Code format:** Vue SFC only. Structure: `<template>...</template>` + `<script setup>...</script>`. Server auto-compiles; if compile fails, fix and retry.',
@@ -183,6 +194,7 @@ export function buildMcpServerInstructions(apiBaseUrl) {
183
194
  `- \`update_record\` → PATCH \`${base}/<tableName>/<id>\``,
184
195
  `- \`delete_record\` → DELETE \`${base}/<tableName>/<id>\``,
185
196
  `- \`create_extension\` → POST \`${base}/extension_definition\` (Vue SFC only; for page pass menuId). \`update_record\` on extension_definition to change code.`,
197
+ `- Flow tables: \`${base}/flow_definition\`, \`${base}/flow_step_definition\`, \`${base}/flow_execution_definition\` — use standard CRUD tools.`,
186
198
  `- Other: \`${base}/menu_definition\`, \`${base}/websocket_definition\`, \`${base}/admin/reload\`, etc.`,
187
199
  '',
188
200
  'When asked which endpoint the API calls, respond with **HTTP method + full URL** using this base. Call `get_enfyra_api_context` to confirm the resolved base if needed.',