@enfyra/mcp-server 0.0.24 → 0.0.25
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
|
@@ -108,6 +108,14 @@ export function buildMcpServerInstructions(apiBaseUrl) {
|
|
|
108
108
|
'- Preferred: `const result = await @REPOS.main.create({ data: @BODY });`.',
|
|
109
109
|
'- Avoid: `const result = await $ctx.$repos.main.create({ data: $ctx.$body });` unless the script truly needs an unmapped `$ctx` property.',
|
|
110
110
|
'',
|
|
111
|
+
'### `$cache` / `@CACHE` user cache',
|
|
112
|
+
'- `$ctx.$cache` and the `@CACHE` macro use Enfyra-managed **user cache**, not the internal runtime metadata cache.',
|
|
113
|
+
'- Script keys are logical keys such as `user:123` or `report:daily`. Do not include `NODE_NAME`, `user_cache:`, Redis prefixes, or another app namespace in script code.',
|
|
114
|
+
'- On Redis-backed deployments, Enfyra stores user cache under the current app `NODE_NAME` namespace as `NODE_NAME:user_cache:*`. Admin Redis Key Editor uses the same storage contract, so values edited there are visible through `$cache` and `@CACHE`.',
|
|
115
|
+
'- User cache is limited by `REDIS_USER_CACHE_LIMIT_MB` (default 30 MB). `REDIS_USER_CACHE_MAX_VALUE_BYTES` optionally rejects oversized single values when greater than 0.',
|
|
116
|
+
'- When user cache exceeds its allocation, Enfyra evicts least-recently-used **user cache** keys only. System Redis keys such as runtime cache snapshots, BullMQ queues, Socket.IO, runtime telemetry, and locks are not counted or evicted by this quota.',
|
|
117
|
+
'- Prefer `set(key, value, ttlMs)` with a TTL. `setNoExpire` is allowed, but persistent user-cache entries can still be evicted by the soft allocation limit.',
|
|
118
|
+
'',
|
|
111
119
|
'### OAuth login (browser / frontend — not the MCP `login` tool)',
|
|
112
120
|
'- **MCP `login`** uses **email + password** → `POST {base}/auth/login`. It cannot complete OAuth (no browser redirect).',
|
|
113
121
|
'- **Supported providers (server):** `google`, `facebook`, `github` only.',
|
package/src/mcp-server-entry.mjs
CHANGED
|
@@ -448,7 +448,9 @@ server.tool(
|
|
|
448
448
|
},
|
|
449
449
|
cacheAndCluster: {
|
|
450
450
|
metadataMutationReloads: 'Metadata-backed mutations emit cache invalidation; admin reload endpoints exist for metadata/routes/graphql/guards/all.',
|
|
451
|
-
|
|
451
|
+
runtimeCacheContract: 'REDIS_RUNTIME_CACHE=true stores runtime definition snapshots in Redis so instances with the same NODE_NAME read the same runtime cache namespace.',
|
|
452
|
+
userCacheContract: '$cache/@CACHE uses managed user cache under NODE_NAME:user_cache:* with REDIS_USER_CACHE_LIMIT_MB default 30 MB; quota eviction only removes user cache keys, not runtime cache, BullMQ, Socket.IO, telemetry, or lock keys.',
|
|
453
|
+
multiInstanceContract: 'Backend is cluster-aware through cache invalidation, Redis runtime cache, Redis user cache, and BullMQ paths, but this MCP can only observe metadata/API state, not every node health.',
|
|
452
454
|
flowWorkerContract: 'Flow jobs require the backend flow worker to be initialized after HTTP listen and websocket gateway init; trigger_flow only confirms enqueue/result from admin endpoint.',
|
|
453
455
|
},
|
|
454
456
|
runtimeGaps: [
|
|
@@ -553,13 +555,14 @@ server.tool(
|
|
|
553
555
|
const payload = {
|
|
554
556
|
transformer: {
|
|
555
557
|
rule: 'Dynamic server scripts are transformed before sandbox execution. Macros expand to $ctx paths; comments are not transformed.',
|
|
556
|
-
preferredSyntax: 'Prefer template macros in generated Enfyra scripts. Use @BODY/@QUERY/@PARAMS/@USER/@REPOS/@HELPERS/@SOCKET/@TRIGGER/@DATA/@ERROR/@THROW* instead of raw $ctx access whenever a macro exists. Use raw $ctx only for fields without a macro.',
|
|
558
|
+
preferredSyntax: 'Prefer template macros in generated Enfyra scripts. Use @BODY/@QUERY/@PARAMS/@USER/@REPOS/@CACHE/@HELPERS/@SOCKET/@TRIGGER/@DATA/@ERROR/@THROW* instead of raw $ctx access whenever a macro exists. Use raw $ctx only for fields without a macro.',
|
|
557
559
|
coreMacros: {
|
|
558
560
|
'@BODY': '$ctx.$body',
|
|
559
561
|
'@QUERY': '$ctx.$query',
|
|
560
562
|
'@PARAMS': '$ctx.$params',
|
|
561
563
|
'@USER': '$ctx.$user',
|
|
562
564
|
'@REPOS': '$ctx.$repos',
|
|
565
|
+
'@CACHE': '$ctx.$cache',
|
|
563
566
|
'@HELPERS': '$ctx.$helpers',
|
|
564
567
|
'@SOCKET': '$ctx.$socket',
|
|
565
568
|
'@DATA': '$ctx.$data',
|
|
@@ -577,27 +580,32 @@ server.tool(
|
|
|
577
580
|
'@FLOW_META': '$ctx.$flow.$meta',
|
|
578
581
|
'#table_name': '$ctx.$repos.table_name',
|
|
579
582
|
},
|
|
583
|
+
cache: {
|
|
584
|
+
contract: '@CACHE and $ctx.$cache use managed user cache. Use logical keys only; Enfyra stores Redis-backed user cache under NODE_NAME:user_cache:* and Redis Admin Key Editor uses the same storage path.',
|
|
585
|
+
quota: 'REDIS_USER_CACHE_LIMIT_MB defaults to 30 MB. If exceeded, Enfyra evicts least-recently-used user-cache keys only; system Redis keys are not counted or evicted.',
|
|
586
|
+
keyRule: 'Do not include NODE_NAME, user_cache:, or Redis namespace prefixes in scripts. Prefer TTL-based set(key, value, ttlMs); setNoExpire may still be evicted by the user-cache soft allocation.',
|
|
587
|
+
},
|
|
580
588
|
throws: '@THROW400 through @THROW503 and @THROW map to $ctx.$throw helpers.',
|
|
581
589
|
},
|
|
582
590
|
contexts: {
|
|
583
591
|
preHook: {
|
|
584
592
|
runs: 'Before handler.',
|
|
585
|
-
data: ['@BODY', '@QUERY', '@PARAMS', '@USER', '@REPOS', '@HELPERS', '@THROW*', '@SOCKET emit helpers'],
|
|
593
|
+
data: ['@BODY', '@QUERY', '@PARAMS', '@USER', '@REPOS', '@CACHE', '@HELPERS', '@THROW*', '@SOCKET emit helpers'],
|
|
586
594
|
returnBehavior: 'Returning a non-undefined value skips handler and becomes response data.',
|
|
587
595
|
},
|
|
588
596
|
handler: {
|
|
589
597
|
runs: 'Main route logic, or canonical CRUD if no handler overrides.',
|
|
590
|
-
data: ['@BODY', '@QUERY', '@PARAMS', '@USER', '@REPOS.main', '@REPOS.secure', '@HELPERS', '@PKGS', '@SOCKET emit helpers', '@TRIGGER'],
|
|
598
|
+
data: ['@BODY', '@QUERY', '@PARAMS', '@USER', '@REPOS.main', '@REPOS.secure', '@CACHE', '@HELPERS', '@PKGS', '@SOCKET emit helpers', '@TRIGGER'],
|
|
591
599
|
returnBehavior: 'Return value becomes response body unless post-hook changes it.',
|
|
592
600
|
},
|
|
593
601
|
postHook: {
|
|
594
602
|
runs: 'After handler, including error path.',
|
|
595
|
-
data: ['@DATA', '@STATUS', '@ERROR', '@BODY', '@QUERY', '@USER', '@SHARE', '@API'],
|
|
603
|
+
data: ['@DATA', '@STATUS', '@ERROR', '@BODY', '@QUERY', '@USER', '@CACHE', '@SHARE', '@API'],
|
|
596
604
|
returnBehavior: 'Mutate @DATA/$ctx.$data or return a non-undefined replacement response.',
|
|
597
605
|
},
|
|
598
606
|
flowStep: {
|
|
599
607
|
runs: 'Inside flow execution or admin flow step test.',
|
|
600
|
-
data: ['@FLOW_PAYLOAD', '@FLOW_LAST', '@FLOW', '@FLOW_META', '#table_name', '@HELPERS', '@SOCKET', '@TRIGGER'],
|
|
608
|
+
data: ['@FLOW_PAYLOAD', '@FLOW_LAST', '@FLOW', '@FLOW_META', '#table_name', '@CACHE', '@HELPERS', '@SOCKET', '@TRIGGER'],
|
|
601
609
|
resultBehavior: 'Step return value is injected into @FLOW.<step.key> and @FLOW_LAST.',
|
|
602
610
|
branching: 'Condition steps use JavaScript truthy/falsy result; child branch is true/false.',
|
|
603
611
|
},
|