@terreno/mcp 57.19.2 → 57.20.0

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.
Files changed (197) hide show
  1. package/CHANGELOG.md +393 -0
  2. package/README.md +32 -269
  3. package/dist/bootstrap.d.ts +12 -0
  4. package/dist/bootstrap.d.ts.map +1 -1
  5. package/dist/bootstrap.js +77 -122
  6. package/dist/bootstrap.js.map +1 -1
  7. package/dist/docs/guidelines/ui/guidelines/core.md +1 -1
  8. package/dist/docs/resources/overview.md +4 -2
  9. package/dist/docs/resources/patterns.md +237 -176
  10. package/dist/docs/resources/ui.md +48 -17
  11. package/dist/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +0 -26
  12. package/dist/docs/templates/bootstrap/frontend/app/_layout.template.tsx +3 -2
  13. package/dist/docs/templates/bootstrap/frontend/app/login.template.tsx +1 -1
  14. package/dist/docs/upgrades/57.20.0.md +238 -0
  15. package/dist/docs/versioned/next/approval-rubric.md +30 -12
  16. package/dist/docs/versioned/next/explanation/README.md +5 -0
  17. package/dist/docs/versioned/next/explanation/account-linking.md +169 -0
  18. package/dist/docs/versioned/next/explanation/admin-interface.md +1 -1
  19. package/dist/docs/versioned/next/explanation/agent-guidelines.md +173 -0
  20. package/dist/docs/versioned/next/explanation/ai-development-loop.md +196 -0
  21. package/dist/docs/versioned/next/explanation/authentication.md +45 -1
  22. package/dist/docs/versioned/next/explanation/consent-forms.md +105 -0
  23. package/dist/docs/versioned/next/explanation/example-coverage.md +1 -0
  24. package/dist/docs/versioned/next/explanation/local-first-data.md +1 -1
  25. package/dist/docs/versioned/next/explanation/organizations.md +37 -0
  26. package/dist/docs/versioned/next/explanation/planning-plugins.md +4 -0
  27. package/dist/docs/versioned/next/explanation/responsive-design.md +143 -0
  28. package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +11 -0
  29. package/dist/docs/versioned/next/explanation/schema-metadata.md +5 -0
  30. package/dist/docs/versioned/next/how-to/README.md +7 -2
  31. package/dist/docs/versioned/next/how-to/audit-log.md +22 -3
  32. package/dist/docs/versioned/next/how-to/automate-terreno-upgrades.md +169 -0
  33. package/dist/docs/versioned/next/how-to/build-list-detail-screens.md +160 -0
  34. package/dist/docs/versioned/next/how-to/circleci.md +15 -5
  35. package/dist/docs/versioned/next/how-to/configure-better-auth.md +673 -53
  36. package/dist/docs/versioned/next/how-to/create-a-terreno-app.md +8 -5
  37. package/dist/docs/versioned/next/how-to/debug-with-mcp.md +393 -23
  38. package/dist/docs/versioned/next/how-to/enable-mcp-oauth.md +54 -3
  39. package/dist/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +9 -0
  40. package/dist/docs/versioned/next/how-to/password-reset.md +1 -1
  41. package/dist/docs/versioned/next/how-to/recover-locked-out-user.md +112 -0
  42. package/dist/docs/versioned/next/how-to/run-tests-locally.md +37 -8
  43. package/dist/docs/versioned/next/how-to/set-up-social-login.md +424 -0
  44. package/dist/docs/versioned/next/how-to/set-up-terreno-mcp.md +241 -36
  45. package/dist/docs/versioned/next/how-to/sign-consent-on-behalf.md +139 -0
  46. package/dist/docs/versioned/next/how-to/upgrade-terreno.md +4 -0
  47. package/dist/docs/versioned/next/implementationPlans/ai-dev-loop-boost.md +47 -32
  48. package/dist/docs/versioned/next/implementationPlans/auth-experience.md +952 -0
  49. package/dist/docs/versioned/next/implementationPlans/consent-forms.md +8 -0
  50. package/dist/docs/versioned/next/implementationPlans/list-detail-layout.md +297 -0
  51. package/dist/docs/versioned/next/implementationPlans/login-redesign/HANDOFF.md +211 -0
  52. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/AnotherWay.html +121 -0
  53. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/BackupCode.html +72 -0
  54. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/Cancelled.html +87 -0
  55. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/ContinueEmail.html +64 -0
  56. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/FirstVisit.html +81 -0
  57. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/Main.html +88 -0
  58. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/ManageAccounts.html +77 -0
  59. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/NotLinked.html +92 -0
  60. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/SigningIn.html +60 -0
  61. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/TwoFactor.html +76 -0
  62. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/TwoFactorError.html +81 -0
  63. package/dist/docs/versioned/next/implementationPlans/login-redesign/boards/WrongPassword.html +69 -0
  64. package/dist/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -1
  65. package/dist/docs/versioned/next/plans/2026-10-23-provisional-consent.md +297 -0
  66. package/dist/docs/versioned/next/plans/2026-10-29-fix-mcp-oauth-native-and-machine.md +68 -0
  67. package/dist/docs/versioned/next/reference/README.md +1 -0
  68. package/dist/docs/versioned/next/reference/account-security.md +700 -0
  69. package/dist/docs/versioned/next/reference/admin-backend.md +3 -1
  70. package/dist/docs/versioned/next/reference/admin-frontend.md +225 -1
  71. package/dist/docs/versioned/next/reference/api.md +461 -35
  72. package/dist/docs/versioned/next/reference/cli.md +1 -1
  73. package/dist/docs/versioned/next/reference/comms.md +8 -0
  74. package/dist/docs/versioned/next/reference/create-terreno-app.md +3 -1
  75. package/dist/docs/versioned/next/reference/environment-variables.md +9 -3
  76. package/dist/docs/versioned/next/reference/legacy/rtk.md +19 -3
  77. package/dist/docs/versioned/next/reference/lifecycle-plugin.md +6 -0
  78. package/dist/docs/versioned/next/reference/mcp-server.md +1158 -441
  79. package/dist/docs/versioned/next/reference/syncdb.md +8 -1
  80. package/dist/docs/versioned/next/reference/ui.md +1271 -27
  81. package/dist/docs/versioned/next/tasks/ai-dev-loop-boost.md +28 -16
  82. package/dist/docs/versioned/next/tutorials/README.md +4 -0
  83. package/dist/httpApp.d.ts +14 -0
  84. package/dist/httpApp.d.ts.map +1 -0
  85. package/dist/httpApp.js +99 -0
  86. package/dist/httpApp.js.map +1 -0
  87. package/dist/index.js +8 -90
  88. package/dist/index.js.map +1 -1
  89. package/dist/local/localTools.d.ts.map +1 -1
  90. package/dist/local/localTools.js +44 -14
  91. package/dist/local/localTools.js.map +1 -1
  92. package/dist/local/metro/metroDevSession.d.ts +18 -0
  93. package/dist/local/metro/metroDevSession.d.ts.map +1 -1
  94. package/dist/local/metro/metroDevSession.js +42 -3
  95. package/dist/local/metro/metroDevSession.js.map +1 -1
  96. package/dist/local/tools/databaseQuery.d.ts.map +1 -1
  97. package/dist/local/tools/databaseQuery.js +3 -13
  98. package/dist/local/tools/databaseQuery.js.map +1 -1
  99. package/dist/local/tools/databaseSchema.d.ts.map +1 -1
  100. package/dist/local/tools/databaseSchema.js +3 -13
  101. package/dist/local/tools/databaseSchema.js.map +1 -1
  102. package/dist/local/tools/localMongo.d.ts +10 -0
  103. package/dist/local/tools/localMongo.d.ts.map +1 -0
  104. package/dist/local/tools/localMongo.js +30 -0
  105. package/dist/local/tools/localMongo.js.map +1 -0
  106. package/dist/local/tools/runtime.d.ts +18 -2
  107. package/dist/local/tools/runtime.d.ts.map +1 -1
  108. package/dist/local/tools/runtime.js +75 -20
  109. package/dist/local/tools/runtime.js.map +1 -1
  110. package/dist/local/tools/syncDb.d.ts +11 -0
  111. package/dist/local/tools/syncDb.d.ts.map +1 -1
  112. package/dist/local/tools/syncDb.js +15 -3
  113. package/dist/local/tools/syncDb.js.map +1 -1
  114. package/dist/rateLimit.d.ts +35 -0
  115. package/dist/rateLimit.d.ts.map +1 -0
  116. package/dist/rateLimit.js +112 -0
  117. package/dist/rateLimit.js.map +1 -0
  118. package/dist/tools.d.ts.map +1 -1
  119. package/dist/tools.js +42 -60
  120. package/dist/tools.js.map +1 -1
  121. package/package.json +4 -3
  122. package/src/docs/guidelines/ui/guidelines/core.md +1 -1
  123. package/src/docs/resources/overview.md +4 -2
  124. package/src/docs/resources/patterns.md +237 -176
  125. package/src/docs/resources/ui.md +48 -17
  126. package/src/docs/templates/bootstrap/frontend/app/(tabs)/profile.template.tsx +0 -26
  127. package/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx +3 -2
  128. package/src/docs/templates/bootstrap/frontend/app/login.template.tsx +1 -1
  129. package/src/docs/upgrades/57.20.0.md +238 -0
  130. package/src/docs/versioned/next/approval-rubric.md +30 -12
  131. package/src/docs/versioned/next/explanation/README.md +5 -0
  132. package/src/docs/versioned/next/explanation/account-linking.md +169 -0
  133. package/src/docs/versioned/next/explanation/admin-interface.md +1 -1
  134. package/src/docs/versioned/next/explanation/agent-guidelines.md +173 -0
  135. package/src/docs/versioned/next/explanation/ai-development-loop.md +196 -0
  136. package/src/docs/versioned/next/explanation/authentication.md +45 -1
  137. package/src/docs/versioned/next/explanation/consent-forms.md +105 -0
  138. package/src/docs/versioned/next/explanation/example-coverage.md +1 -0
  139. package/src/docs/versioned/next/explanation/local-first-data.md +1 -1
  140. package/src/docs/versioned/next/explanation/organizations.md +37 -0
  141. package/src/docs/versioned/next/explanation/planning-plugins.md +4 -0
  142. package/src/docs/versioned/next/explanation/responsive-design.md +143 -0
  143. package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +11 -0
  144. package/src/docs/versioned/next/explanation/schema-metadata.md +5 -0
  145. package/src/docs/versioned/next/how-to/README.md +7 -2
  146. package/src/docs/versioned/next/how-to/audit-log.md +22 -3
  147. package/src/docs/versioned/next/how-to/automate-terreno-upgrades.md +169 -0
  148. package/src/docs/versioned/next/how-to/build-list-detail-screens.md +160 -0
  149. package/src/docs/versioned/next/how-to/circleci.md +15 -5
  150. package/src/docs/versioned/next/how-to/configure-better-auth.md +673 -53
  151. package/src/docs/versioned/next/how-to/create-a-terreno-app.md +8 -5
  152. package/src/docs/versioned/next/how-to/debug-with-mcp.md +393 -23
  153. package/src/docs/versioned/next/how-to/enable-mcp-oauth.md +54 -3
  154. package/src/docs/versioned/next/how-to/migrate-rtk-to-syncdb.md +9 -0
  155. package/src/docs/versioned/next/how-to/password-reset.md +1 -1
  156. package/src/docs/versioned/next/how-to/recover-locked-out-user.md +112 -0
  157. package/src/docs/versioned/next/how-to/run-tests-locally.md +37 -8
  158. package/src/docs/versioned/next/how-to/set-up-social-login.md +424 -0
  159. package/src/docs/versioned/next/how-to/set-up-terreno-mcp.md +241 -36
  160. package/src/docs/versioned/next/how-to/sign-consent-on-behalf.md +139 -0
  161. package/src/docs/versioned/next/how-to/upgrade-terreno.md +4 -0
  162. package/src/docs/versioned/next/implementationPlans/ai-dev-loop-boost.md +47 -32
  163. package/src/docs/versioned/next/implementationPlans/auth-experience.md +952 -0
  164. package/src/docs/versioned/next/implementationPlans/consent-forms.md +8 -0
  165. package/src/docs/versioned/next/implementationPlans/list-detail-layout.md +297 -0
  166. package/src/docs/versioned/next/implementationPlans/login-redesign/HANDOFF.md +211 -0
  167. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/AnotherWay.html +121 -0
  168. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/BackupCode.html +72 -0
  169. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/Cancelled.html +87 -0
  170. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/ContinueEmail.html +64 -0
  171. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/FirstVisit.html +81 -0
  172. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/Main.html +88 -0
  173. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/ManageAccounts.html +77 -0
  174. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/NotLinked.html +92 -0
  175. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/SigningIn.html +60 -0
  176. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/TwoFactor.html +76 -0
  177. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/TwoFactorError.html +81 -0
  178. package/src/docs/versioned/next/implementationPlans/login-redesign/boards/WrongPassword.html +69 -0
  179. package/src/docs/versioned/next/implementationPlans/mcp-boost-parity.md +1 -1
  180. package/src/docs/versioned/next/plans/2026-10-23-provisional-consent.md +297 -0
  181. package/src/docs/versioned/next/plans/2026-10-29-fix-mcp-oauth-native-and-machine.md +68 -0
  182. package/src/docs/versioned/next/reference/README.md +1 -0
  183. package/src/docs/versioned/next/reference/account-security.md +700 -0
  184. package/src/docs/versioned/next/reference/admin-backend.md +3 -1
  185. package/src/docs/versioned/next/reference/admin-frontend.md +225 -1
  186. package/src/docs/versioned/next/reference/api.md +461 -35
  187. package/src/docs/versioned/next/reference/cli.md +1 -1
  188. package/src/docs/versioned/next/reference/comms.md +8 -0
  189. package/src/docs/versioned/next/reference/create-terreno-app.md +3 -1
  190. package/src/docs/versioned/next/reference/environment-variables.md +9 -3
  191. package/src/docs/versioned/next/reference/legacy/rtk.md +19 -3
  192. package/src/docs/versioned/next/reference/lifecycle-plugin.md +6 -0
  193. package/src/docs/versioned/next/reference/mcp-server.md +1158 -441
  194. package/src/docs/versioned/next/reference/syncdb.md +8 -1
  195. package/src/docs/versioned/next/reference/ui.md +1271 -27
  196. package/src/docs/versioned/next/tasks/ai-dev-loop-boost.md +28 -16
  197. package/src/docs/versioned/next/tutorials/README.md +4 -0
@@ -13,19 +13,19 @@ See: [`docs/implementationPlans/ai-dev-loop-boost.md`](../implementationPlans/ai
13
13
 
14
14
  ## Phase 1: Reconcile with merged #802
15
15
 
16
- - [ ] **Task 1.1**: Inventory the actual MCP surface
16
+ - [x] **Task 1.1**: Inventory the actual MCP surface
17
17
  - Description: Read `mcp-server/src/tools.ts`, `mcp-server/src/prompts.ts`, `mcp-server/src/resources.ts`, `mcp-server/src/local/localTools.ts`, and every file under `mcp-server/src/local/tools/`. Produce a table of every tool with its exact name, input schema, and which server hosts it. Separately list every environment variable the servers read (`TERRENO_MCP_EVAL`, `TERRENO_METRO_URL`, `TERRENO_PROJECT_ROOT`, `TERRENO_LOG_FILE`, `TERRENO_BROWSER_LOGS`, and any others found). Compare against the tool table in the IP and correct the IP where it is wrong. Put the deltas in the PR body.
18
18
  - Files: `docs/implementationPlans/ai-dev-loop-boost.md`
19
19
  - Depends on: PR #802 merged
20
20
  - Acceptance: every tool in the corrected table is greppable in the source; every environment variable cites its reading file; the PR body lists what differed from the pre-merge IP.
21
21
 
22
- - [ ] **Task 1.2**: Verify the log pipeline end to end
22
+ - [x] **Task 1.2**: Verify the log pipeline end to end
23
23
  - Description: Start the example backend and frontend, then exercise each `read_logs` source and record real output: `backend` (winston JSONL file transport), `app` (console output over Metro CDP), `metro` (bundler events), and `browser` (POST fallback). Deliberately break something to produce an error and confirm `last_error` returns it with a stack. Note which sources required extra setup and what happens when Metro is not running. Save the real outputs for use in the documentation tasks.
24
24
  - Files: none (findings recorded for later tasks)
25
25
  - Depends on: Task 1.1
26
26
  - Acceptance: all four sources produced output, or any that did not is documented with the reason; `last_error` output captured verbatim including a stack trace.
27
27
 
28
- - [ ] **Task 1.3**: Reproduce the Hermes CDP contention symptom
28
+ - [x] **Task 1.3**: Reproduce the Hermes CDP contention symptom
29
29
  - Description: With `read_logs` connected and streaming `app` source entries, open React Native DevTools (press `j` in Metro) and observe what happens to the log tool. Record the exact status message or failure the tool reports. Then close DevTools and confirm whether the tool recovers automatically. This becomes the documented symptom and workaround.
30
30
  - Files: none (findings recorded for later tasks)
31
31
  - Depends on: Task 1.2
@@ -33,19 +33,19 @@ See: [`docs/implementationPlans/ai-dev-loop-boost.md`](../implementationPlans/ai
33
33
 
34
34
  ## Phase 2: Reference completeness
35
35
 
36
- - [ ] **Task 2.1**: Update `docs/reference/mcp-server.md`
36
+ - [x] **Task 2.1**: Update `docs/reference/mcp-server.md`
37
37
  - Description: Rewrite the tool sections to match the Task 1.1 inventory exactly. Split clearly into "Hosted server (`terreno-mcp`)" and "Local server (`terreno-mcp-local`)" sections. For each tool: name, purpose, input schema table, example call, and example output. Add an "Environment variables" section listing every variable from Task 1.1 with its effect and default. Add a "What the local server can and cannot see" section — it reads `package.json`/lockfiles, connects to Mongo via the consumer's `.env`, tails log files, and attaches over CDP; it never imports consumer code. Document the Hermes limitation from Task 1.3. Update the hosted URL per IP question AI6 if the domain decision has been made.
38
38
  - Files: `docs/reference/mcp-server.md`
39
39
  - Depends on: Task 1.1, Task 1.3
40
40
  - Acceptance: tool list matches the inventory one-to-one; every environment variable documented; the can/cannot-see section is present; the Hermes symptom is quoted from Task 1.3.
41
41
 
42
- - [ ] **Task 2.2**: Sync `mcp-server/README.md`
42
+ - [x] **Task 2.2**: Sync `mcp-server/README.md`
43
43
  - Description: Bring the package README's tool list in line with the reference page (it is known to omit `terreno_search_docs`, `terreno_get_component_docs`, and `terreno_get_upgrade_guide`). Keep the README short — the six-section template from [`docs-reference-coverage`](../implementationPlans/docs-reference-coverage.md) — and link the reference page for full detail.
44
44
  - Files: `mcp-server/README.md`
45
45
  - Depends on: Task 2.1
46
46
  - Acceptance: the README and reference page list identical tool sets; the README follows the standard template; all links absolute.
47
47
 
48
- - [ ] **Task 2.3**: Document the browser-log route
48
+ - [x] **Task 2.3**: Document the browser-log route
49
49
  - Description: Add `POST /__terreno/browser-logs` to `docs/reference/api.md` (or the appropriate reference page) documenting: that it is registered only when `NODE_ENV !== "production"`, that it 404s in production, the `TERRENO_BROWSER_LOGS=false` override, the JSONL file it appends to, and the payload shape. Verify all of this against `api/src/browserLogsRoute.ts` in the merged tree.
50
50
  - Files: `docs/reference/api.md`, `docs/reference/environment-variables.md`
51
51
  - Depends on: Task 1.1
@@ -53,13 +53,13 @@ See: [`docs/implementationPlans/ai-dev-loop-boost.md`](../implementationPlans/ai
53
53
 
54
54
  ## Phase 3: The loop explainer
55
55
 
56
- - [ ] **Task 3.1**: Write `docs/explanation/ai-development-loop.md`
56
+ - [x] **Task 3.1**: Write `docs/explanation/ai-development-loop.md`
57
57
  - Description: Explainer covering the five stages (Ask, Generate, Run, Observe, Fix) with the mermaid diagram from the IP. For each stage, name the tools involved and what they contribute. Then a "Tool layer versus process layer" section using the table from the IP, stating that this page covers the tool layer and that the `/terreno-*` SDLC pipeline is the process layer, with a link to `docs/explanation/agentic-sdlc.md` — do not duplicate that page's content. Then a "What makes this different" section built on one narrow, defensible claim: the agent observes what the app actually did rather than a description of it. Then a "What the agent cannot see" section — production logs, native crash reports outside the dev loop, anything requiring a physical device not attached to a dev server, and the Hermes single-connection limitation. Then a "How this composes" section covering `expo-mcp` for simulator interaction, Playwright MCP for web, and Maestro for durable E2E flows, with the division of labor. No commands — this is conceptual.
58
58
  - Files: `docs/explanation/ai-development-loop.md` (new), `docs/explanation/README.md`
59
59
  - Depends on: Task 2.1
60
60
  - Acceptance: all five stages present with real tool names from the inventory; the tool/process table is present and links the companion page; the cannot-see section has at least four honest limitations; no shell commands; listed in the explanation index.
61
61
 
62
- - [ ] **Task 3.2**: Write `docs/explanation/agent-guidelines.md`
62
+ - [x] **Task 3.2**: Write `docs/explanation/agent-guidelines.md`
63
63
  - Description: Explainer on how conventions reach an agent: the hosted server's docs resources and search, per-package `.ai/guidelines/` shipped in npm tarballs (verify whether #802 Phase 2 shipped this before documenting it — if not, describe only what exists and note the rest as planned), `terreno_bootstrap_ai_rules` for generating editor-specific rule files, and the `.rulesync/` source-of-truth pattern with its generated targets. Add a section for consumers on extending the generated rules with their own project conventions without losing them on regeneration.
64
64
  - Files: `docs/explanation/agent-guidelines.md` (new), `docs/explanation/README.md`
65
65
  - Depends on: Task 1.1
@@ -67,19 +67,19 @@ See: [`docs/implementationPlans/ai-dev-loop-boost.md`](../implementationPlans/ai
67
67
 
68
68
  ## Phase 4: Setup and debug how-tos
69
69
 
70
- - [ ] **Task 4.1**: Write `docs/how-to/set-up-terreno-mcp.md`
70
+ - [x] **Task 4.1**: Write `docs/how-to/set-up-terreno-mcp.md`
71
71
  - Description: Per-editor setup for both Terreno servers. Cover at minimum Cursor (`.cursor/mcp.json`) and Claude Code, with the exact JSON for each including the hosted HTTP entry and the `bunx terreno-mcp-local` stdio entry. Then: what `terreno-mcp-local` needs to work (project root discovery and the `TERRENO_PROJECT_ROOT` override, a reachable `MONGO_URI`, the backend log file, Metro running for app logs); an optional section on adding `expo-mcp` and Playwright MCP with the division of labor from Task 3.1; and a verification section — ask the agent to call `application_info` and confirm it reports the project's `@terreno/*` versions. Compare the JSON against what `terreno_bootstrap_app` actually generates and make them identical.
72
72
  - Files: `docs/how-to/set-up-terreno-mcp.md` (new), `docs/how-to/README.md`
73
73
  - Depends on: Task 2.1
74
74
  - Acceptance: configuration for at least two editors, each verified by actually loading it; the JSON matches bootstrap output byte-for-byte in structure; the `application_info` verification step works.
75
75
 
76
- - [ ] **Task 4.2**: Write `docs/how-to/debug-with-mcp.md`
76
+ - [x] **Task 4.2**: Write `docs/how-to/debug-with-mcp.md`
77
77
  - Description: Task-focused guide using the real failure and real outputs captured in Task 1.2. Structure: the symptom; `last_error` to locate it; `read_logs` with source filtering to see the surrounding context; `database_query` to check the data; `get_client_state` to check the client; `navigate` plus a screenshot from the composed server to confirm the fix. Include a "which tool for which symptom" table (app crashes on a screen; API returns 403; data looks wrong; screen renders empty; bundler fails). Use verbatim tool output.
78
78
  - Files: `docs/how-to/debug-with-mcp.md` (new), `docs/how-to/README.md`
79
79
  - Depends on: Task 1.2, Task 4.1
80
80
  - Acceptance: all tool outputs are verbatim from Task 1.2; the symptom-to-tool table has at least five rows; the walkthrough ends with a verified fix.
81
81
 
82
- - [ ] **Task 4.3**: Add discovery paths for the local server
82
+ - [x] **Task 4.3**: Add discovery paths for the local server
83
83
  - Description: Nothing currently tells a developer that `terreno-mcp-local` exists. Add links to `docs/how-to/set-up-terreno-mcp.md` from: the README's MCP section, `docs/README.md` quick links, `docs/tutorials/README.md`, and the `terreno://docs/overview` MCP resource. Also confirm `terreno_bootstrap_app` output includes a comment or README line pointing at the setup guide.
84
84
  - Files: `README.md`, `docs/README.md`, `docs/tutorials/README.md`, `mcp-server/src/docs/resources/overview.md`, `mcp-server/src/docs/templates/bootstrap/**`
85
85
  - Depends on: Task 4.1
@@ -87,33 +87,45 @@ See: [`docs/implementationPlans/ai-dev-loop-boost.md`](../implementationPlans/ai
87
87
 
88
88
  ## Phase 5: Gap fixes
89
89
 
90
- - [ ] **Task 5.1**: `[RTK]` Rename `get_rtk_state` to `get_client_state`
90
+ - [x] **Task 5.1**: `[RTK]` Rename `get_rtk_state` to `get_client_state`
91
91
  - Description: Per IP question AI1, rename the tool to `get_client_state` and extend it to detect either store type, returning a field identifying which layer it found (RTK Query cache versus syncdb store). Keep `get_rtk_state` registered as an alias whose description marks it deprecated and names the replacement. Update the tool description to explain what it returns for each layer. Add tests covering: syncdb store present, RTK store present, neither present, and the alias resolving to the same handler.
92
92
  - Files: `mcp-server/src/local/tools/runtime.ts`, `mcp-server/src/local/localTools.ts`, tests under `mcp-server/src/local/`
93
93
  - Depends on: Task 1.1, PR #869 merged
94
94
  - Acceptance: both names work; the response identifies the detected layer; the alias description marks it deprecated; all four test cases pass; `bun run mcp:build` succeeds.
95
95
 
96
- - [ ] **Task 5.2**: `[RTK]` Relocate the dev console logger
96
+ - [x] **Task 5.2**: `[RTK]` Relocate the dev console logger
97
97
  - Description: Per IP question AI2, move `installTerrenoDevConsoleLogger` from `rtk/src/devConsoleLogger.ts` to the syncdb package, keeping a re-export from `@terreno/rtk` for the deprecation window so existing consumers are unaffected. Move its tests with it. Update the bootstrap `_layout` template and `example-frontend/app/_layout.tsx` to import from the new location. Add the re-export to the RTK deprecation notes.
98
98
  - Files: `syncdb/src/devConsoleLogger.ts` (moved), `rtk/src/devConsoleLogger.ts` (re-export), `rtk/src/index.ts`, `syncdb/src/index.ts`, `mcp-server/src/docs/templates/bootstrap/frontend/app/_layout.template.tsx`, `example-frontend/app/_layout.tsx`, tests
99
99
  - Depends on: Task 5.1
100
100
  - Acceptance: both import paths work; tests pass from the new location; `bun run compile` succeeds across the workspace; the example app still ships browser logs to the backend route (verify by producing a `console.error` and reading it back with `read_logs`).
101
101
 
102
- - [ ] **Task 5.3**: Add rate limiting to the hosted MCP server
102
+ - [x] **Task 5.3**: Add rate limiting to the hosted MCP server
103
103
  - Description: Per IP question AI5 — a launch prerequisite. Add per-IP rate limiting to the hosted server's JSON-RPC endpoint. Choose limits appropriate to the workload (search and codegen are cheap per call; the index is built once at startup) and make them configurable by environment variable with a sensible default. Return a clear JSON-RPC error when exceeded, naming the limit and the retry window. Add tests for under-limit, at-limit, and over-limit behavior. Document the limit in `docs/reference/mcp-server.md`.
104
104
  - Files: `mcp-server/src/index.ts`, tests under `mcp-server/src/`, `docs/reference/mcp-server.md`, `docs/reference/environment-variables.md`
105
105
  - Depends on: Task 2.1
106
106
  - Acceptance: exceeding the limit returns a structured error naming the limit and retry window; the limit is configurable by environment variable; three test cases pass; the limit is documented.
107
107
 
108
- - [ ] **Task 5.4**: Handle the MCP domain change
108
+ - [x] **Task 5.4**: Handle the MCP domain change
109
109
  - Description: If program question P4 / IP question AI6 was answered in favor of moving off `mcp.terreno.flourish.health`, update every occurrence of the URL: `README.md`, `docs/reference/mcp-server.md`, `mcp-server/README.md`, `mcp-server/src/**` defaults, bootstrap templates, and `infra/flourish/` deployment config. Keep the old hostname serving with a redirect or CNAME for at least one release and document the cutover. If the decision was to keep the current domain, make no change and record that.
110
110
  - Files: various (grep `rg -n "mcp\.terreno"`)
111
111
  - Depends on: Task 2.1
112
112
  - Acceptance: `rg -n "mcp\.terreno\.flourish\.health"` returns only intentional legacy references; a bootstrapped app's `mcp.json` uses the new URL; the cutover plan is documented; or the no-change decision is recorded in the PR body.
113
113
 
114
+ - [x] **Task 5.5**: Let `terreno-mcp-local` attach to Metro's inspector proxy
115
+ - Description: Found by Task 1.3. `@react-native/dev-middleware` 0.86 (Expo 57) rejects debugger WebSocket upgrades that carry no `Origin` header (`InspectorProxy.js` `verifyClient`), and neither Bun nor Node sends one, so the `app` log source and every CDP-backed tool fail with `CDP websocket error: ... Expected 101 status code`. Send an `Origin` matching the Metro base URL's loopback origin on the CDP socket, and surface Metro's close code and reason (for example `[NEW_DEBUGGER_OPENED]`) in the status hint instead of the bare `CDP disconnected`. Add tests at the session seam.
116
+ - Files: `mcp-server/src/local/metro/metroDevSession.ts`, its tests
117
+ - Depends on: Task 1.3
118
+ - Acceptance: against a real Metro, `read_logs` with source `app` connects to a debuggable target without a preload shim; when another debugger takes the session, the status names Metro's close reason; tests cover the header and the close-reason hint; `bun run mcp:build` succeeds.
119
+
120
+ - [x] **Task 5.6**: Make the local database tools load Mongoose under Bun
121
+ - Description: Found by Task 2.1. `database_schema` and `database_query` call `await import("mongoose")` and read `.connection` on the namespace object; under Bun with Mongoose 9 that property is undefined, so both tools fail with `undefined is not an object (evaluating 'mongoose.connection.readyState')` whenever a Mongo URI is found. Use the module's default export, and add a test that exercises the real import path against the in-memory Mongo used by the package tests.
122
+ - Files: `mcp-server/src/local/tools/databaseSchema.ts`, `mcp-server/src/local/tools/databaseQuery.ts`, their tests
123
+ - Depends on: Task 2.1
124
+ - Acceptance: against the running example database, `database_schema` and `database_query` return real results through `terreno-mcp-local`; tests fail before the fix and pass after; `bun run mcp:build` succeeds.
125
+
114
126
  ## Phase 6: Verification
115
127
 
116
- - [ ] **Task 6.1**: Run the loop end to end and capture evidence
128
+ - [x] **Task 6.1**: Run the loop end to end and capture evidence
117
129
  - Description: In a fresh agent session with both MCP servers configured per `docs/how-to/set-up-terreno-mcp.md`, complete a full loop: ask for a small feature, let the agent generate it, run the app, introduce a bug, use `last_error` and `read_logs` to find it, fix it, and verify with `navigate` plus a screenshot. Capture the transcript highlights and screenshots to `/opt/cursor/artifacts/`. Fix any documentation gap the run exposed.
118
130
  - Files: any documentation needing correction
119
131
  - Depends on: Task 4.2, Task 5.1, Task 5.3
@@ -5,3 +5,7 @@ Learning-oriented, hands-on lessons. Start here if you are new to Terreno.
5
5
  ## Contents
6
6
 
7
7
  - [Getting started](getting-started.md) — Scaffold a new app with `create-terreno-app`, run it locally, or explore monorepo examples
8
+
9
+ ## Next steps
10
+
11
+ - [Set up Terreno MCP](../how-to/set-up-terreno-mcp.md) — Connect your editor to the hosted `terreno` server and the local `terreno-mcp-local` server (logs, last error, client state, database)
@@ -0,0 +1,14 @@
1
+ import type { Express } from "express";
2
+ import { type McpRateLimitConfig } from "./rateLimit.js";
3
+ export interface McpHttpAppOptions {
4
+ host: string;
5
+ /** Per-IP limit on the JSON-RPC routes (`/mcp` and `POST /`). */
6
+ rateLimit: McpRateLimitConfig;
7
+ /** Reverse-proxy hops to trust for `req.ip`; see `resolveTrustProxyHops`. Default 0. */
8
+ trustProxyHops?: number;
9
+ /** Test-only clock for the rate limiter. */
10
+ now?: () => number;
11
+ }
12
+ /** Builds the hosted MCP Express app (JSON-RPC routes plus the `GET /` health check). */
13
+ export declare const createMcpHttpApp: ({ host, now, rateLimit, trustProxyHops, }: McpHttpAppOptions) => Express;
14
+ //# sourceMappingURL=httpApp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpApp.d.ts","sourceRoot":"","sources":["../src/httpApp.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,OAAO,EAAiB,MAAM,SAAS,CAAC;AAErD,OAAO,EAA+B,KAAK,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAiFrF,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,kBAAkB,CAAC;IAC9B,wFAAwF;IACxF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,yFAAyF;AACzF,eAAO,MAAM,gBAAgB,GAAI,2CAK9B,iBAAiB,KAAG,OA4BtB,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { createMcpExpressApp } from "@modelcontextprotocol/express";
2
+ import { toNodeHandler } from "@modelcontextprotocol/node";
3
+ import { createMcpHandler, McpServer } from "@modelcontextprotocol/server";
4
+ import * as Sentry from "@sentry/bun";
5
+ import { logger } from "@terreno/api";
6
+ import { handlePromptRequest, prompts } from "./prompts.js";
7
+ import { createMcpRateLimitMiddleware } from "./rateLimit.js";
8
+ import { resources } from "./resources.js";
9
+ import { handleToolCall, tools } from "./tools.js";
10
+ const createServer = () => {
11
+ const server = Sentry.wrapMcpServerWithSentry(new McpServer({
12
+ name: "terreno-mcp",
13
+ version: "1.0.0",
14
+ }, {
15
+ capabilities: {
16
+ prompts: {},
17
+ resources: {},
18
+ tools: {},
19
+ },
20
+ }));
21
+ server.server.setRequestHandler("resources/list", async () => {
22
+ return {
23
+ resources: resources.map((r) => ({
24
+ description: r.description,
25
+ mimeType: r.mimeType,
26
+ name: r.name,
27
+ uri: r.uri,
28
+ })),
29
+ };
30
+ });
31
+ server.server.setRequestHandler("resources/read", async (request) => {
32
+ logger.info("MCP ReadResource", { uri: request.params.uri });
33
+ const resource = resources.find((r) => r.uri === request.params.uri);
34
+ if (!resource) {
35
+ throw new Error(`Resource not found: ${request.params.uri}`);
36
+ }
37
+ return {
38
+ contents: [
39
+ {
40
+ mimeType: resource.mimeType,
41
+ text: resource.content,
42
+ uri: resource.uri,
43
+ },
44
+ ],
45
+ };
46
+ });
47
+ server.server.setRequestHandler("tools/list", async () => {
48
+ return { tools };
49
+ });
50
+ server.server.setRequestHandler("tools/call", async (request) => {
51
+ logger.info("MCP CallTool", { arguments: request.params.arguments, name: request.params.name });
52
+ return await handleToolCall(request.params.name, request.params.arguments ?? {});
53
+ });
54
+ server.server.setRequestHandler("prompts/list", async () => {
55
+ return {
56
+ prompts: prompts.map((p) => ({
57
+ arguments: p.arguments,
58
+ description: p.description,
59
+ name: p.name,
60
+ })),
61
+ };
62
+ });
63
+ server.server.setRequestHandler("prompts/get", async (request) => {
64
+ logger.info("MCP GetPrompt", { arguments: request.params.arguments, name: request.params.name });
65
+ return handlePromptRequest(request.params.name, request.params.arguments ?? {});
66
+ });
67
+ return server;
68
+ };
69
+ const handleMcpError = (error) => {
70
+ Sentry.captureException(error);
71
+ logger.error("Error handling MCP request", { error });
72
+ };
73
+ /** Builds the hosted MCP Express app (JSON-RPC routes plus the `GET /` health check). */
74
+ export const createMcpHttpApp = ({ host, now, rateLimit, trustProxyHops = 0, }) => {
75
+ const app = createMcpExpressApp({ host });
76
+ app.set("trust proxy", trustProxyHops > 0 ? trustProxyHops : false);
77
+ const handler = createMcpHandler(createServer, {
78
+ legacy: "stateless",
79
+ onerror: handleMcpError,
80
+ responseMode: "auto",
81
+ });
82
+ const nodeHandler = toNodeHandler(handler);
83
+ // One limiter instance so `/mcp` and `POST /` count against the same per-IP bucket.
84
+ const rateLimitMiddleware = createMcpRateLimitMiddleware({ ...rateLimit, now });
85
+ const handleJsonRpc = (req, res) => {
86
+ void nodeHandler(req, res, req.body);
87
+ };
88
+ app.all("/mcp", ...rateLimitMiddleware, handleJsonRpc);
89
+ app.post("/", ...rateLimitMiddleware, handleJsonRpc);
90
+ app.get("/", (_req, res) => {
91
+ res.status(200).json({
92
+ mcpEndpoint: "/mcp",
93
+ service: "terreno-mcp",
94
+ status: "ok",
95
+ });
96
+ });
97
+ return app;
98
+ };
99
+ //# sourceMappingURL=httpApp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpApp.js","sourceRoot":"","sources":["../src/httpApp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAC,mBAAmB,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,4BAA4B,EAA0B,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjD,MAAM,YAAY,GAAG,GAAc,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AmB,EAAE,aAAa,CAAC,CAAC;IACrD,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE;QACzB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,WAAW,EAAE,MAAM;YACnB,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
package/dist/index.js CHANGED
@@ -1,72 +1,9 @@
1
1
  #!/usr/bin/env bun
2
2
  import "./instrument.js";
3
- import { createMcpExpressApp } from "@modelcontextprotocol/express";
4
- import { toNodeHandler } from "@modelcontextprotocol/node";
5
- import { createMcpHandler, McpServer } from "@modelcontextprotocol/server";
6
3
  import * as Sentry from "@sentry/bun";
7
4
  import { logger } from "@terreno/api";
8
- import { handlePromptRequest, prompts } from "./prompts.js";
9
- import { resources } from "./resources.js";
10
- import { handleToolCall, tools } from "./tools.js";
11
- const createServer = () => {
12
- const server = Sentry.wrapMcpServerWithSentry(new McpServer({
13
- name: "terreno-mcp",
14
- version: "1.0.0",
15
- }, {
16
- capabilities: {
17
- prompts: {},
18
- resources: {},
19
- tools: {},
20
- },
21
- }));
22
- server.server.setRequestHandler("resources/list", async () => {
23
- return {
24
- resources: resources.map((r) => ({
25
- description: r.description,
26
- mimeType: r.mimeType,
27
- name: r.name,
28
- uri: r.uri,
29
- })),
30
- };
31
- });
32
- server.server.setRequestHandler("resources/read", async (request) => {
33
- logger.info("MCP ReadResource", { uri: request.params.uri });
34
- const resource = resources.find((r) => r.uri === request.params.uri);
35
- if (!resource) {
36
- throw new Error(`Resource not found: ${request.params.uri}`);
37
- }
38
- return {
39
- contents: [
40
- {
41
- mimeType: resource.mimeType,
42
- text: resource.content,
43
- uri: resource.uri,
44
- },
45
- ],
46
- };
47
- });
48
- server.server.setRequestHandler("tools/list", async () => {
49
- return { tools };
50
- });
51
- server.server.setRequestHandler("tools/call", async (request) => {
52
- logger.info("MCP CallTool", { arguments: request.params.arguments, name: request.params.name });
53
- return await handleToolCall(request.params.name, request.params.arguments ?? {});
54
- });
55
- server.server.setRequestHandler("prompts/list", async () => {
56
- return {
57
- prompts: prompts.map((p) => ({
58
- arguments: p.arguments,
59
- description: p.description,
60
- name: p.name,
61
- })),
62
- };
63
- });
64
- server.server.setRequestHandler("prompts/get", async (request) => {
65
- logger.info("MCP GetPrompt", { arguments: request.params.arguments, name: request.params.name });
66
- return handlePromptRequest(request.params.name, request.params.arguments ?? {});
67
- });
68
- return server;
69
- };
5
+ import { createMcpHttpApp } from "./httpApp.js";
6
+ import { resolveMcpRateLimitConfig, resolveTrustProxyHops } from "./rateLimit.js";
70
7
  const resolvePort = () => {
71
8
  const envPort = process.env.PORT;
72
9
  if (!envPort) {
@@ -85,46 +22,27 @@ const resolveHost = () => {
85
22
  }
86
23
  return "0.0.0.0";
87
24
  };
88
- const handleMcpError = (error) => {
89
- Sentry.captureException(error);
90
- logger.error("Error handling MCP request", { error });
91
- };
92
25
  const main = async () => {
93
26
  const { setupLogging } = (await import("@terreno/api"));
94
27
  setupLogging?.({ disableConsoleColors: process.env.NODE_ENV === "production" });
95
28
  const port = resolvePort();
96
29
  const host = resolveHost();
97
- const app = createMcpExpressApp({ host });
98
- const handler = createMcpHandler(createServer, {
99
- legacy: "stateless",
100
- onerror: handleMcpError,
101
- responseMode: "auto",
102
- });
103
- const nodeHandler = toNodeHandler(handler);
104
- app.all("/mcp", (req, res) => {
105
- void nodeHandler(req, res, req.body);
106
- });
107
- app.post("/", (req, res) => {
108
- void nodeHandler(req, res, req.body);
109
- });
110
- app.get("/", (_req, res) => {
111
- res.status(200).json({
112
- mcpEndpoint: "/mcp",
113
- service: "terreno-mcp",
114
- status: "ok",
115
- });
116
- });
30
+ const rateLimit = resolveMcpRateLimitConfig();
31
+ const trustProxyHops = resolveTrustProxyHops();
32
+ const app = createMcpHttpApp({ host, rateLimit, trustProxyHops });
117
33
  app.listen(port, host, (error) => {
118
34
  if (error) {
119
35
  logger.error("Failed to start server:", error);
120
36
  process.exit(1);
121
37
  return;
122
38
  }
123
- logger.info(`Terreno MCP server listening on ${host}:${port}`);
39
+ logger.info(`Terreno MCP server listening on ${host}:${port}`, { rateLimit, trustProxyHops });
124
40
  });
125
41
  };
126
42
  main().catch((error) => {
127
43
  Sentry.captureException(error);
128
44
  logger.error("Fatal error starting MCP server:", error);
45
+ // Flush the captured exception before exiting so a bad config fails the deploy visibly.
46
+ void Sentry.flush(2000).finally(() => process.exit(1));
129
47
  });
130
48
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,iBAAiB,CAAC;AAEzB,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,mBAAmB,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,cAAc,EAAE,KAAK,EAAC,MAAM,YAAY,CAAC;AAEjD,MAAM,YAAY,GAAG,GAAc,EAAE;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,uBAAuB,CAC3C,IAAI,SAAS,CACX;QACE,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,OAAO,EAAE,EAAE;YACX,SAAS,EAAE,EAAE;YACb,KAAK,EAAE,EAAE;SACV;KACF,CACF,CACF,CAAC;IA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E,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC,CAAC,CAAA;CAAC,CA8JI,CAAC"}
@@ -3,8 +3,37 @@ import { isBrowserAction, useBrowser } from "./tools/browser.js";
3
3
  import { databaseQuery } from "./tools/databaseQuery.js";
4
4
  import { databaseSchema } from "./tools/databaseSchema.js";
5
5
  import { lastError, readLogs } from "./tools/readLogs.js";
6
- import { evaluate, getRtkState, navigate } from "./tools/runtime.js";
6
+ import { evaluate, getClientState, navigate } from "./tools/runtime.js";
7
7
  import { getSyncDbState, syncDbAction, syncDbSnapshot } from "./tools/syncDb.js";
8
+ const CLIENT_STATE_INPUT_SCHEMA = {
9
+ additionalProperties: false,
10
+ properties: {
11
+ collection: { description: "SyncDB: optional collection filter", type: "string" },
12
+ entityId: { description: "SyncDB: optional entity id filter", type: "string" },
13
+ includeDebugEvents: {
14
+ description: "SyncDB: set false to return debug stats without event bodies",
15
+ type: "boolean",
16
+ },
17
+ limit: {
18
+ description: "SyncDB: entity limit per collection (default 500, max 2000)",
19
+ type: "number",
20
+ },
21
+ name: {
22
+ description: "SyncDB: client/store name; defaults to the first registered client",
23
+ type: "string",
24
+ },
25
+ query: {
26
+ description: "RTK: when slice is rtk/terreno-rtk (or omitted), filter cache rows whose endpoint name or serialized args contain this substring (case-insensitive).",
27
+ type: "string",
28
+ },
29
+ slice: {
30
+ description: "RTK: `auth`, `betterAuth`, `rtk`/`terreno-rtk`, or any top-level Redux state key. Omit for auth + RTK Query cache summary.",
31
+ type: "string",
32
+ },
33
+ },
34
+ type: "object",
35
+ };
36
+ const GET_CLIENT_STATE_DESCRIPTION = "Inspect the running app's client data layer. Detects the RTK Query Redux store (`registerTerrenoDevStore` / `globalThis.__TERRENO_STORE__`) and the SyncDB client (`createSyncDb({debug: true})` / `globalThis.__TERRENO_SYNCDB__`), in-process or via CDP. Returns JSON with `layer`: `rtk`, `syncdb`, `syncdb+rtk` (both present; both payloads returned), or `none`. `rtk` holds auth plus an RTK Query cache summary (queries/mutations with endpoint, status, args), narrowed by `slice`/`query`. `syncdb` holds the SyncDB inspect output (status, entities, outbox, conflicts, cursors, streams, debug events), narrowed by `name`/`collection`/`entityId`/`limit`/`includeDebugEvents`. `none` returns a setup `hint`, per-layer `reasons`, and the CDP `connection` status. Sensitive fields are redacted. Use `get_syncdb_state` for SyncDB-only reads.";
8
37
  export const localMcpTools = [
9
38
  {
10
39
  description: "Read the consumer app's package.json workspaces and key dependency versions (@terreno/*, Expo, React Native, Mongoose). Looks in `backend/` or `example-backend/`, and `frontend/` or `example-frontend/`. Call at the start of each chat and write version-specific code (Boost-style).",
@@ -75,18 +104,13 @@ export const localMcpTools = [
75
104
  name: "last_error",
76
105
  },
77
106
  {
78
- description: "Inspect Redux store (auth + RTK Query cache summary) via `registerTerrenoDevStore` / `globalThis.__TERRENO_STORE__`, or via CDP when the MCP process cannot see the app heap.",
79
- inputSchema: {
80
- additionalProperties: false,
81
- properties: {
82
- query: {
83
- description: "When slice is rtk/terreno-rtk, filter cache rows whose endpoint name or serialized args contain this substring (case-insensitive).",
84
- type: "string",
85
- },
86
- slice: { type: "string" },
87
- },
88
- type: "object",
89
- },
107
+ description: GET_CLIENT_STATE_DESCRIPTION,
108
+ inputSchema: CLIENT_STATE_INPUT_SCHEMA,
109
+ name: "get_client_state",
110
+ },
111
+ {
112
+ description: "Deprecated: use `get_client_state`. Alias kept for one release; it runs the same handler and returns the same `{layer, rtk?, syncdb?}` response.",
113
+ inputSchema: CLIENT_STATE_INPUT_SCHEMA,
90
114
  name: "get_rtk_state",
91
115
  },
92
116
  {
@@ -289,8 +313,14 @@ export const createLocalToolCallHandler = (browserRunner = useBrowser) => {
289
313
  });
290
314
  return { content: [{ text, type: "text" }] };
291
315
  }
316
+ case "get_client_state":
292
317
  case "get_rtk_state": {
293
- const text = await getRtkState({
318
+ const text = await getClientState({
319
+ collection: typeof args.collection === "string" ? args.collection : undefined,
320
+ entityId: typeof args.entityId === "string" ? args.entityId : undefined,
321
+ includeDebugEvents: typeof args.includeDebugEvents === "boolean" ? args.includeDebugEvents : undefined,
322
+ limit: typeof args.limit === "number" ? args.limit : undefined,
323
+ name: typeof args.name === "string" ? args.name : undefined,
294
324
  query: typeof args.query === "string" ? args.query : undefined,
295
325
  slice: typeof args.slice === "string" ? args.slice : undefined,
296
326
  });
@@ -1 +1 @@
1
- {"version":3,"file":"localTools.js","sourceRoot":"","sources":["../../src/local/localTools.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,eAAe,EAAC,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AACnE,OAAO,EAAC,cAAc,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,mBAAmB,CAAC;AAE/E,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC;QACE,WAAW,EACT,0RAA0R;QAC5R,WAAW,EAAE,EAAC,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAC;QAC1E,IAAI,EAAE,kBAAkB;KACzB;IACD;QACE,WAAW,EACT,2JAA2J;QAC7J,WAAW,EAAE;YACX,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,gBAAgB,EAAE,EAAC,WAAW,EAAE,uCAAuC,EAAE,IAAI,EAAE,QAAQ,EAAC;gBACxF,OAAO,EAAE,EAAC,WAAW,EAAE,0CAA0C,EAAE,IAAI,EAAE,SAAS,EAAC;aACpF;YACD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE,iBAAiB;KACxB;IACD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,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;oBACpE,GAAG,EAAE,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS;oBACxD,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;oBAC9D,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;oBAClD,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS;iBACnD,CAAC,CAAC;gBACH,OAAO,EAAC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,EAAC,CAAC;YAC3C,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,OAAO,EAAC,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,iBAAiB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,EAAC,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,0BAA0B,EAAE,CAAC"}
@@ -5,6 +5,24 @@ interface RingEntry {
5
5
  timestamp?: string;
6
6
  }
7
7
  export declare const resolveMetroHttpBase: () => string;
8
+ /**
9
+ * Origin header for Metro's `/inspector/debug` socket. Neither Bun nor Node sends one, and two
10
+ * checks must both pass:
11
+ * - `@react-native/dev-middleware` (0.86+) `verifyClient` rejects the upgrade when Origin is missing.
12
+ * Otherwise the Origin must equal the server's own `serverBaseUrl` origin or have a loopback hostname
13
+ * (`localhost`, `127.0.0.1`, `0.0.0.0`, `[::]`).
14
+ * - Expo CLI's `isMatchingOrigin` then terminates the socket unless the Origin's host equals the
15
+ * `serverBaseUrl` host. Expo always builds `serverBaseUrl` with `hostType: "localhost"`, which its
16
+ * UrlCreator rewrites to `127.0.0.1:<Metro port>`, whatever host the caller used. So
17
+ * `Origin: http://localhost:8082` is accepted by dev-middleware but terminated by Expo (close 1006).
18
+ *
19
+ * `127.0.0.1` on the Metro base URL's own scheme and port satisfies both, for Expo and for the bare
20
+ * React Native CLI (which has no host check). The hostname is replaced even for a LAN base URL, because
21
+ * Expo's expected host is `127.0.0.1` there too. The port must be Metro's real port, so a base URL
22
+ * that reaches Metro through a port-remapping tunnel still fails Expo's check, as does a Metro whose
23
+ * `serverBaseUrl` host is overridden by `REACT_NATIVE_PACKAGER_HOSTNAME` or `EXPO_PACKAGER_PROXY_URL`.
24
+ */
25
+ export declare const metroDebuggerOrigin: (httpBase: string) => string;
8
26
  export declare const ensureCdpConnected: () => Promise<{
9
27
  ok: boolean;
10
28
  detail: string;