@enfyra/mcp-server 0.0.104 → 0.0.105

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 CHANGED
@@ -169,6 +169,7 @@ For normal apps and demos, enter the app/admin URL such as `http://localhost:300
169
169
  Use `get_enfyra_examples` from the MCP tool list when asking an LLM to generate implementation patterns. It returns focused examples for:
170
170
 
171
171
  - SSR app auth and proxy setup
172
+ - OAuth provider setup
172
173
  - schema, columns, relations, indexes, and validation
173
174
  - query filters, sorting, fields, deep relations, and aggregates
174
175
  - handlers, hooks, permissions, and RLS
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfyra/mcp-server",
3
- "version": "0.0.104",
3
+ "version": "0.0.105",
4
4
  "description": "MCP server for Enfyra - manage Enfyra instances from MCP-compatible coding tools",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -457,6 +457,84 @@ window.location.href = url.toString()`,
457
457
  },
458
458
  ],
459
459
  },
460
+ 'oauth-setup': {
461
+ title: 'OAuth provider setup',
462
+ useWhen: 'Use when configuring Google or another OAuth provider for an Enfyra-backed app.',
463
+ examples: [
464
+ {
465
+ name: 'Google OAuth setup workflow',
466
+ code: `// 1. Ask for the public app/admin URL, not the API URL.
467
+ // Example input from the user:
468
+ const appUrl = "https://demo.enfyra.io"
469
+
470
+ // 2. Derive the Enfyra API base and provider callback.
471
+ const apiBase = appUrl.replace(/\\/$/, "") + "/api"
472
+ const googleCallbackUrl = apiBase + "/auth/google/callback"
473
+
474
+ // 3. Tell the user to paste this exact value into Google Cloud Console:
475
+ // APIs & Services -> Credentials -> OAuth 2.0 Client -> Authorized redirect URIs
476
+ // https://demo.enfyra.io/api/auth/google/callback
477
+
478
+ // 4. After the user provides Google client id/secret, save Enfyra config:
479
+ create_record({
480
+ tableName: "enfyra_oauth_config",
481
+ body: JSON.stringify({
482
+ provider: "google",
483
+ clientId: "<google-client-id>",
484
+ clientSecret: "<google-client-secret>",
485
+ redirectUri: googleCallbackUrl,
486
+ isEnabled: true
487
+ })
488
+ })`,
489
+ notes: [
490
+ 'Ask for the app/admin URL such as https://demo.enfyra.io; derive the API base by appending /api.',
491
+ 'The provider callback is {appUrl}/api/auth/{provider}/callback and must exactly match the Authorized redirect URI in Google Cloud Console.',
492
+ 'Do not ask the user to choose or type the callback URL manually once the app URL is known; compute it and show the exact value to paste.',
493
+ 'The OAuth callback is the Enfyra provider callback, not the final app page.',
494
+ 'When starting OAuth from a browser app, use the same-origin proxy route with redirect and cookieBridgePrefix as shown in ssr-app-auth examples.',
495
+ ],
496
+ },
497
+ {
498
+ name: 'Browser OAuth start URL after setup',
499
+ code: `const returnUrl = new URL("/dashboard", window.location.origin)
500
+ const oauthUrl = new URL("/enfyra/auth/google", window.location.origin)
501
+ oauthUrl.searchParams.set("redirect", returnUrl.toString())
502
+ oauthUrl.searchParams.set("cookieBridgePrefix", "/enfyra")
503
+ window.location.href = oauthUrl.toString()`,
504
+ notes: [
505
+ 'This is the browser start URL through the app proxy; it is different from the Google Authorized redirect URI.',
506
+ 'After Enfyra finishes the Google callback, it bridges cookies through /enfyra/auth/set-cookies and returns to the absolute redirect URL.',
507
+ 'After return, call /enfyra/me to load the user.',
508
+ ],
509
+ },
510
+ {
511
+ name: 'Update an existing Google OAuth config',
512
+ code: `const existing = await query_table({
513
+ tableName: "enfyra_oauth_config",
514
+ filter: JSON.stringify({ provider: { _eq: "google" } }),
515
+ fields: ["id", "provider", "redirectUri", "isEnabled"],
516
+ limit: 1
517
+ })
518
+
519
+ // If a row exists, update it instead of creating a duplicate.
520
+ update_record({
521
+ tableName: "enfyra_oauth_config",
522
+ id: "<existing-config-id>",
523
+ body: JSON.stringify({
524
+ clientId: "<google-client-id>",
525
+ clientSecret: "<google-client-secret>",
526
+ redirectUri: "https://demo.enfyra.io/api/auth/google/callback",
527
+ isEnabled: true
528
+ })
529
+ })`,
530
+ notes: [
531
+ 'Inspect first so setup is idempotent.',
532
+ 'Use the current system table name enfyra_oauth_config.',
533
+ 'Never expose the client secret back in app code or documentation.',
534
+ ],
535
+ },
536
+ ],
537
+ },
460
538
  'schema-relations': {
461
539
  title: 'Tables, columns, relations, cascade, and indexes',
462
540
  useWhen: 'Use when creating or changing persisted data models.',
@@ -51,7 +51,7 @@ export function buildMcpServerInstructions(apiBaseUrl) {
51
51
  '',
52
52
  '### App Connection Defaults',
53
53
  '- Generated Nuxt/Next/SSR apps should use a same-origin proxy such as `/enfyra/**` to the Enfyra API. Browser code calls `/enfyra/login`, `/enfyra/me`, `/enfyra/logout`, and `/enfyra/<table>`; it should not store JWTs.',
54
- '- OAuth starts through the same proxy prefix with `redirect=<absoluteReturnUrl>` and `cookieBridgePrefix=/enfyra`. OAuth setup details live in `get_enfyra_examples({ category: "ssr-app-auth" })`.',
54
+ '- OAuth starts through the same proxy prefix with `redirect=<absoluteReturnUrl>` and `cookieBridgePrefix=/enfyra`. Provider setup details live in `get_enfyra_examples({ category: "oauth-setup" })`.',
55
55
  '- Socket.IO browser clients connect to the gateway namespace, e.g. `io("/chat", { path: "/socket.io", withCredentials: true })`, while the app proxies `/socket.io/**` to Enfyra `/ws/socket.io/**`.',
56
56
  '',
57
57
  '### Dynamic Script Surface',