You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: update FM HTTP mode documentation and config details
- Changed model name in btca.config.jsonc to lowercase.
- Updated domain_map.yaml with new FM HTTP features and troubleshooting tips.
- Expanded skill_spec.md to reflect increased failure modes for typegen-setup.
- Added detailed instructions for local WebViewer development using FM HTTP in SKILL.md.
- Clarified critical mistakes related to FmHttpAdapter usage and environment variable settings in typegen-setup documentation.
- mistake: 'Using FmHttpAdapter in production application code'
177
+
mechanism: 'FmHttpAdapter is internal to typegen metadata fetching. Generated clients use WebViewerAdapter. Agent sees the adapter import in typegen source and uses it in app code.'
178
+
wrong_pattern: |
179
+
import { FmHttpAdapter } from "@proofkit/fmdapi/adapters/fm-http";
180
+
const client = DataApi({
181
+
adapter: new FmHttpAdapter({ baseUrl: "http://127.0.0.1:1365", connectedFileName: "MyFile" }),
182
+
layout: "Contacts",
183
+
});
184
+
correct_pattern: |
185
+
// Use typegen-generated client (which uses WebViewerAdapter internally)
- mistake: 'Setting standard FM env vars when using fmHttp mode'
194
+
mechanism: 'fmHttp mode does not need FM_SERVER, FM_DATABASE, or OTTO_API_KEY. Agent configures both standard and fmHttp env vars, causing confusion when standard vars fail validation.'
195
+
wrong_pattern: |
196
+
# .env — agent sets both
197
+
FM_SERVER=https://fm.example.com
198
+
FM_DATABASE=MyFile.fmp12
199
+
OTTO_API_KEY=dk_abc123
200
+
FM_HTTP_BASE_URL=http://127.0.0.1:1365
201
+
correct_pattern: |
202
+
# fmHttp mode only needs these (baseUrl defaults to 127.0.0.1:1365)
203
+
# connectedFileName is auto-discovered if not set
204
+
FM_CONNECTED_FILE_NAME=MyFile
205
+
source: 'source: getEnvValues.ts, constants.ts'
206
+
priority: HIGH
207
+
status: active
208
+
skills: ['typegen-setup']
209
+
210
+
- mistake: 'Suggesting OttoFMS/FetchAdapter fallback when FM HTTP fails'
211
+
mechanism: 'Agent troubleshoots FM HTTP connection failure by suggesting standard auth. Developer chose fmHttp because they have no hosted credentials or are working offline. Correct troubleshooting: check daemon health (GET http://127.0.0.1:1365/health), check /connectedFiles, ensure FM file has run "Connect to MCP" script and WebViewer window is open in Browse mode.'
212
+
source: 'maintainer interview'
213
+
priority: HIGH
214
+
status: active
215
+
skills: ['typegen-setup']
216
+
217
+
- mistake: 'FM HTTP WebViewer window closed or in Layout mode'
218
+
mechanism: 'The FM HTTP proxy works via a WebViewer window opened by the "Connect to MCP" script in FileMaker. If this window is closed or switched to Layout mode, all proxy requests fail. Error may not be obvious — typegen just fails to connect.'
219
+
correct_pattern: |
220
+
# Troubleshooting checklist:
221
+
# 1. Is the fm-http daemon running? GET http://127.0.0.1:1365/health
222
+
# 2. Is the file connected? GET http://127.0.0.1:1365/connectedFiles
223
+
# 3. If file not listed: open it in FileMaker, run "Connect to MCP" script
224
+
# 4. Ensure the WebViewer window stays open in Browse mode (not Layout mode)
225
+
source: 'maintainer interview'
226
+
priority: HIGH
227
+
status: active
228
+
skills: ['typegen-setup']
229
+
171
230
- name: 'Data API Client'
172
231
slug: 'fmdapi-client'
173
232
domain: 'data-access'
@@ -646,10 +705,12 @@ skills:
646
705
- 'First typegen run'
647
706
- 'First query with generated client'
648
707
- 'Choosing between Data API and OData'
708
+
- 'FM HTTP mode for local/offline WebViewer development (no credentials needed)'
649
709
tasks:
650
710
- 'Set up a new project with ProofKit'
651
711
- 'Connect to FileMaker server for the first time'
652
712
- 'Generate types and make first data query'
713
+
- 'Set up FM HTTP mode for local WebViewer development'
653
714
failure_modes:
654
715
- mistake: 'Missing fmrest or fmodata privilege on FM account'
655
716
mechanism: 'Data API requires fmrest extended privilege. OData requires fmodata privilege. Without these, all API calls return 401/403.'
Copy file name to clipboardExpand all lines: packages/typegen/skills/getting-started/SKILL.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,56 @@ if (error) {
187
187
}
188
188
```
189
189
190
+
### Path D: Local WebViewer Development (FM HTTP — no credentials)
191
+
192
+
For WebViewer apps running inside FileMaker, you can use FM HTTP mode to generate types from a local FileMaker file without any server credentials.
193
+
194
+
**Prerequisites:**
195
+
- FM HTTP daemon installed and running (`curl http://127.0.0.1:1365/health`)
196
+
- FileMaker file open locally with "Connect to MCP" script run
197
+
198
+
1. Install packages:
199
+
200
+
```bash
201
+
pnpm add @proofkit/fmdapi @proofkit/webviewer zod
202
+
```
203
+
204
+
2. No `.env` file needed for typegen (baseUrl defaults, connectedFileName is auto-discovered). Optionally set "connectedFileName" in the config.fmHttp.connectedFileName to override the auto-discovery.
4. Run typegen — it auto-discovers the connected file and writes it back to config:
223
+
224
+
```bash
225
+
npx @proofkit/typegen
226
+
```
227
+
228
+
5. First query (runs inside FileMaker WebViewer):
229
+
230
+
```ts
231
+
import { ContactsLayout } from"./schema/client";
232
+
233
+
const { data } =awaitContactsLayout.findOne({
234
+
query: { id: "==123" },
235
+
});
236
+
```
237
+
238
+
The generated client uses `WebViewerAdapter` with `"execute_data_api"` as the default script name. No server URL or API keys are needed at runtime — all calls go through the FileMaker script engine.
239
+
190
240
## Choosing Data API vs OData
191
241
192
242
| Aspect | Data API (`@proofkit/fmdapi`) | OData (`@proofkit/fmodata`) |
The `config` key can be an array mixing `fmdapi` and `fmodata` entries, each with its own `path` and `envNames`.
188
+
189
+
### FM HTTP mode (local development, no credentials)
190
+
191
+
FM HTTP mode lets typegen fetch layout metadata from a locally running FileMaker file via the FM HTTP proxy, without needing OttoFMS, a hosted server, or any credentials. Generated clients still use `WebViewerAdapter` — FM HTTP is only used during typegen.
`FmHttpAdapter` is internal to typegen's metadata fetching process. It only runs during code generation, never in production. Generated clients use `WebViewerAdapter` for runtime data access inside FileMaker WebViewer.
453
+
454
+
### HIGH: Setting standard FM env vars when using fmHttp mode
455
+
456
+
Wrong:
457
+
```bash
458
+
# Agent configures both standard and fmHttp vars
459
+
FM_SERVER=https://fm.example.com
460
+
FM_DATABASE=MyFile.fmp12
461
+
OTTO_API_KEY=dk_abc123
462
+
FM_HTTP_BASE_URL=http://127.0.0.1:1365
463
+
```
464
+
465
+
Correct:
466
+
```bash
467
+
# fmHttp mode only — no server/db/auth needed
468
+
# baseUrl defaults to http://127.0.0.1:1365 if not set
469
+
# connectedFileName is auto-discovered if not set
470
+
FM_CONNECTED_FILE_NAME=MyFile
471
+
```
472
+
473
+
fmHttp mode bypasses the standard FM_SERVER/FM_DATABASE/auth env vars entirely. Setting both causes confusion when standard validation reports missing values.
474
+
475
+
### HIGH: FM HTTP connection failures — troubleshooting
476
+
477
+
If typegen fails to connect in fmHttp mode, do NOT suggest falling back to OttoFMS or FetchAdapter. The developer chose fmHttp because they don't have hosted credentials or are working with a local-only file.
478
+
479
+
Troubleshooting checklist:
480
+
1.**Daemon running?**`curl http://127.0.0.1:1365/health` — should return `{"service":"fm-http","status":"ok"}`
481
+
2.**File connected?**`curl http://127.0.0.1:1365/connectedFiles` — should list the target file
482
+
3.**File not listed?** Open the FileMaker file and run the **"Connect to MCP"** script
483
+
4.**Still not working?** Ensure the WebViewer window opened by "Connect to MCP" is in **Browse mode**, not Layout mode. Closing this window or switching to Layout mode silently breaks the proxy.
484
+
421
485
## References
422
486
423
487
-**fmdapi-client**: Typegen generates the layout-specific clients consumed by `@proofkit/fmdapi`. Override files and `InferZodPortals` bridge typegen output into fmdapi usage.
0 commit comments