@enfyra/mcp-server 0.0.2 → 0.0.3

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.2",
3
+ "version": "0.0.3",
4
4
  "description": "MCP server for Enfyra - manage your Enfyra instance via Claude Code",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -58,6 +58,15 @@ export function buildMcpServerInstructions(apiBaseUrl) {
58
58
  '- **Auth:** `publishedMethods` may include `GQL_QUERY` and/or `GQL_MUTATION` **separately** — each controls anonymous access for queries vs mutations. Otherwise Bearer JWT + `routePermissions` must list the same method key (`GQL_QUERY` / `GQL_MUTATION`).',
59
59
  '- MCP does not wrap GraphQL; use REST tools or tell users the URLs above.',
60
60
  '',
61
+ '### WebSocket (Socket.IO)',
62
+ '- Enfyra uses **Socket.IO**. Gateways and events are stored in **`websocket_definition`** and **`websocket_event_definition`**; manage via REST (MCP `create_record`, `update_record`, `query_table` on those tables).',
63
+ '- **Gateway** (`websocket_definition`): `path` = namespace (e.g. `/chat`), `requireAuth` (JWT in `auth.token`), `connectionHandlerScript` (runs on connect), `connectionHandlerTimeout`, `isEnabled`.',
64
+ '- **Event** (`websocket_event_definition`): `gateway` → gateway id, `eventName` (client emits), `handlerScript`, `timeout`, `isEnabled`.',
65
+ '- **@SOCKET** in scripts: Connection handler — `@SOCKET.emit(event, data)` → this client; `@SOCKET.to(room).emit(event, data)` → room. Event handler — `@SOCKET.emit` → broadcast namespace; `@SOCKET.send` → this client; `@SOCKET.to(room).emit` → room.',
66
+ '- **Context**: Connection — `@BODY` = {id, ip, headers}, `@USER` if auth. Event — `@BODY` = payload, `@USER` if auth. Both have `@SOCKET`.',
67
+ '- **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.',
68
+ '- **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.',
69
+ '',
61
70
  '### MCP tool → HTTP',
62
71
  `- \`get_all_metadata\` → GET \`${base}/metadata\``,
63
72
  `- \`get_table_metadata\` → GET \`${base}/metadata/<tableName>\``,
@@ -66,7 +75,7 @@ export function buildMcpServerInstructions(apiBaseUrl) {
66
75
  `- \`create_record\` → POST \`${base}/<tableName>\``,
67
76
  `- \`update_record\` → PATCH \`${base}/<tableName>/<id>\``,
68
77
  `- \`delete_record\` → DELETE \`${base}/<tableName>/<id>\``,
69
- `- Other admin paths include \`${base}/route_definition\`, \`${base}/admin/reload\`, etc.`,
78
+ `- Tables \`websocket_definition\`, \`websocket_event_definition\` → same REST pattern. Other admin: \`${base}/route_definition\`, \`${base}/admin/reload\`, etc.`,
70
79
  '',
71
80
  '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.',
72
81
  ].join('\n');