@enfyra/mcp-server 0.0.14 → 0.0.15
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 +1 -1
- package/src/lib/mcp-instructions.js +10 -1
package/package.json
CHANGED
|
@@ -106,7 +106,16 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
106
106
|
'- 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).',
|
|
107
107
|
'- **Gateway** (`websocket_definition`): `path` = namespace (e.g. `/chat`), `requireAuth` (JWT in `auth.token`), `connectionHandlerScript` (runs on connect), `connectionHandlerTimeout`, `isEnabled`.',
|
|
108
108
|
'- **Event** (`websocket_event_definition`): `gateway` → gateway id, `eventName` (client emits), `handlerScript`, `timeout`, `isEnabled`.',
|
|
109
|
-
'- **@SOCKET
|
|
109
|
+
'- **@SOCKET in scripts (prefer template `@SOCKET.method()` over `$ctx.$socket.method()`):**',
|
|
110
|
+
'- `@SOCKET.reply(event, data)` — send to this client only (WS context only).',
|
|
111
|
+
'- `@SOCKET.join(room)` — join a room (WS context only).',
|
|
112
|
+
'- `@SOCKET.leave(room)` — leave a room (WS context only).',
|
|
113
|
+
'- `@SOCKET.emitToUser(userId, event, data)` — send to a specific user (across all gateways).',
|
|
114
|
+
'- `@SOCKET.emitToRoom(room, event, data)` — send to a named room (across all gateways).',
|
|
115
|
+
'- `@SOCKET.emitToGateway(path, event, data)` — broadcast to all connections on a gateway/namespace.',
|
|
116
|
+
'- `@SOCKET.broadcast(event, data)` — broadcast to all connections on all gateways.',
|
|
117
|
+
'- `@SOCKET.disconnect()` — force-disconnect the current socket from the gateway (WS context only). Use in connection handler to reject, or in event handler to kick user.',
|
|
118
|
+
'- In **HTTP** handler/hook context: `reply`, `join`, `leave`, `disconnect` are not available (no socket). Use `emitToUser`, `emitToRoom`, `emitToGateway`, `broadcast`.',
|
|
110
119
|
'- **Context**: Connection — `@BODY` = {id, ip, headers}, `@USER` if auth. Event — `@BODY` = payload, `@USER` if auth. Both have `@SOCKET`.',
|
|
111
120
|
'- **ACK + results (recommended UX):** client can emit an event with Socket.IO ack callback. Server immediately acks `{ queued: true, requestId, eventName }` (or `{ queued: false, error }`). The handler result is returned asynchronously via `ws:result` or `ws:error` with the same `requestId`.',
|
|
112
121
|
'- **Client**: `io("<HTTP_ORIGIN>/namespace", {auth: {token: JWT}})`. Use the **origin where Socket.IO is served** (usually the **Nest** HTTP origin, e.g. `http://localhost:1105/chat` in local server-only setups). If Socket.IO is exposed only through the Nuxt app, use that host and your deployment’s WS path—**do not** assume port 3000 without checking `API_URL` / proxy config. Gateway `path` in metadata = Socket.IO **namespace**.',
|