fms-odata-mcp 0.1.2 → 0.9.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 (72) hide show
  1. package/README.md +446 -37
  2. package/dist/bin/cli.d.ts +3 -0
  3. package/dist/bin/cli.d.ts.map +1 -0
  4. package/dist/bin/cli.js +11 -0
  5. package/dist/bin/cli.js.map +1 -0
  6. package/dist/config.d.ts +24 -0
  7. package/dist/config.d.ts.map +1 -1
  8. package/dist/config.js +82 -12
  9. package/dist/config.js.map +1 -1
  10. package/dist/connection.d.ts +55 -4
  11. package/dist/connection.d.ts.map +1 -1
  12. package/dist/connection.js +127 -16
  13. package/dist/connection.js.map +1 -1
  14. package/dist/fm-version.d.ts +63 -0
  15. package/dist/fm-version.d.ts.map +1 -0
  16. package/dist/fm-version.js +184 -0
  17. package/dist/fm-version.js.map +1 -0
  18. package/dist/http-server.d.ts +7 -0
  19. package/dist/http-server.d.ts.map +1 -0
  20. package/dist/http-server.js +57 -0
  21. package/dist/http-server.js.map +1 -0
  22. package/dist/index.d.ts +11 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +43 -14
  25. package/dist/index.js.map +1 -1
  26. package/dist/logger.d.ts +1 -1
  27. package/dist/logger.js +2 -2
  28. package/dist/logger.js.map +1 -1
  29. package/dist/odata-client.d.ts +265 -15
  30. package/dist/odata-client.d.ts.map +1 -1
  31. package/dist/odata-client.js +684 -60
  32. package/dist/odata-client.js.map +1 -1
  33. package/dist/odata-parser.d.ts +191 -11
  34. package/dist/odata-parser.d.ts.map +1 -1
  35. package/dist/odata-parser.js +374 -39
  36. package/dist/odata-parser.js.map +1 -1
  37. package/dist/simple-http-transport.d.ts +28 -0
  38. package/dist/simple-http-transport.d.ts.map +1 -0
  39. package/dist/simple-http-transport.js +206 -0
  40. package/dist/simple-http-transport.js.map +1 -0
  41. package/dist/tools/configuration.d.ts +6 -3
  42. package/dist/tools/configuration.d.ts.map +1 -1
  43. package/dist/tools/configuration.js +21 -4
  44. package/dist/tools/configuration.js.map +1 -1
  45. package/dist/tools/connection.d.ts +119 -0
  46. package/dist/tools/connection.d.ts.map +1 -1
  47. package/dist/tools/connection.js +554 -65
  48. package/dist/tools/connection.js.map +1 -1
  49. package/dist/tools/index.d.ts +675 -85
  50. package/dist/tools/index.d.ts.map +1 -1
  51. package/dist/tools/index.js +55 -22
  52. package/dist/tools/index.js.map +1 -1
  53. package/dist/tools/odata.d.ts +424 -56
  54. package/dist/tools/odata.d.ts.map +1 -1
  55. package/dist/tools/odata.js +865 -57
  56. package/dist/tools/odata.js.map +1 -1
  57. package/dist/tools/schema.d.ts +213 -0
  58. package/dist/tools/schema.d.ts.map +1 -0
  59. package/dist/tools/schema.js +315 -0
  60. package/dist/tools/schema.js.map +1 -0
  61. package/dist/transport.d.ts.map +1 -1
  62. package/dist/transport.js +10 -100
  63. package/dist/transport.js.map +1 -1
  64. package/dist/version.d.ts +2 -0
  65. package/dist/version.d.ts.map +1 -0
  66. package/dist/version.js +36 -0
  67. package/dist/version.js.map +1 -0
  68. package/dist/working-http-transport.d.ts +24 -0
  69. package/dist/working-http-transport.d.ts.map +1 -0
  70. package/dist/working-http-transport.js +85 -0
  71. package/dist/working-http-transport.js.map +1 -0
  72. package/package.json +15 -10
package/README.md CHANGED
@@ -3,16 +3,37 @@
3
3
  [![npm version](https://img.shields.io/npm/v/fms-odata-mcp.svg)](https://www.npmjs.com/package/fms-odata-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Model Context Protocol (MCP) server providing FileMaker Server OData 4.01 API integration for AI assistants like Claude Desktop, Windsurf, Cursor, and Cline.
6
+ Model Context Protocol (MCP) server providing FileMaker Server OData 4.01 API integration
7
+ for AI assistants like Claude Desktop, Windsurf, Cursor, and Cline.
7
8
 
8
9
  ## Features
9
10
 
10
- - 🔌 **19 MCP Tools** for FileMaker database operations
11
- - 🔍 **Database Discovery** - Explore tables, fields, and metadata
12
- - 📊 **CRUD Operations** - Create, read, update, and delete records
13
- - 🔐 **Secure Connections** - SSL support for self-signed certificates
14
- - 💾 **Connection Management** - Save and reuse database connections
15
- - 📝 **OData 4.01 Standard** - Full query capabilities ($filter, $select, $orderby, etc.)
11
+ - **39 MCP Tools** for FileMaker database operations (33 standard + 6 optional schema editing)
12
+ - **Multi-File Support** - Connect to multiple databases simultaneously (`fm_odata_connect_multi`)
13
+ - **Session Management** - List and target active sessions per call
14
+ (`fm_odata_list_active_sessions`, per-call `connection` param)
15
+ - **Schema Discovery** - Merged schema across all active sessions (`fm_odata_describe_sessions`)
16
+ - **Database Discovery** - Explore tables, fields, and metadata
17
+ - **CRUD Operations** - Create, read, update, and delete records
18
+ - **Secure Connections** - SSL support for self-signed certificates
19
+ - **Connection Management** - Save and reuse database connections
20
+ - **OData 4.01 Standard** - Full query capabilities ($filter, $select, $orderby, $apply, etc.)
21
+ - **Password Redaction** - Credentials are scrubbed from debug logs
22
+ - **FileMaker 2025 Aggregation** - Server-side `$apply` via `fm_odata_aggregate` (v22.0.1+)
23
+ - **Type Casting & Parameterized Filters** - `fm_odata_cast` and `fm_odata_build_filter` (v21.1+)
24
+ - **Server Version Detection** - `fm_odata_get_server_version` reports the FM Server version
25
+ and a feature-compatibility map; version-gated tools fall back gracefully on older servers
26
+ - **FileMaker 2026 Metadata Comments** - Table/field comments and AI annotations extracted
27
+ from `$metadata` on v26+ servers (`fm_odata_list_tables` with `includeDetails`,
28
+ enriched `fm_odata_describe_sessions` output)
29
+ - **Automatic FMFID Resolution (v26+)** - Non-ASCII field names are automatically resolved
30
+ to stable internal `FMFID` IDs in `$filter` expressions, eliminating double-quote escaping
31
+ and preventing breakage on field renames. Falls back to auto-quoting on older servers.
32
+ - **Script Execution by FMSID (v26+)** - Run FileMaker scripts by stable internal `FMSID`
33
+ instead of script name, preventing integration breakage when scripts are renamed.
34
+ `fm_odata_list_scripts` exposes IDs so agents can prefer ID-based calls.
35
+ - **Schema Editing (DDL)** - Create/alter/delete tables, fields, and indexes via
36
+ FileMaker's OData schema endpoints (opt-in with `FM_ALLOW_SCHEMA_EDITS=true`)
16
37
 
17
38
  ## Quick Start
18
39
 
@@ -23,13 +44,24 @@ Model Context Protocol (MCP) server providing FileMaker Server OData 4.01 API in
23
44
  npm install -g fms-odata-mcp
24
45
 
25
46
  # Or local development
26
- git clone https://github.com/fsans/FMS-ODATA-MCP.git
27
- cd FMS-ODATA-MCP
47
+ git clone https://github.com/fsans/fms-odata-mcp.git
48
+ cd fms-odata-mcp
28
49
  npm install
29
50
  npm run build
30
51
  ```
31
52
 
32
- ### Setup for Claude Desktop
53
+ > **Note:** This package was previously published as `filemaker-odata-mcp`. It has been
54
+ > renamed to `fms-odata-mcp` to align with the related `fms-*` repositories
55
+ > (`fms-odata-js`, `fms-odata-spec`). The old name is deprecated on npm; update your
56
+ > installs to `fms-odata-mcp`.
57
+
58
+ ## Deployment Modes
59
+
60
+ ### 1. MCP Server Mode (Default)
61
+
62
+ For use with AI assistants that support MCP (Claude Desktop, Windsurf, Cursor, Cline).
63
+
64
+ #### Setup for Claude Desktop
33
65
 
34
66
  1. **Locate your Claude config file:**
35
67
  - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
@@ -40,7 +72,7 @@ npm run build
40
72
  ```json
41
73
  {
42
74
  "mcpServers": {
43
- "filemaker": {
75
+ "filemaker-odata": {
44
76
  "command": "npx",
45
77
  "args": ["-y", "fms-odata-mcp"],
46
78
  "env": {
@@ -48,22 +80,263 @@ npm run build
48
80
  "FM_DATABASE": "YourDatabase",
49
81
  "FM_USER": "your-username",
50
82
  "FM_PASSWORD": "your-password",
51
- "FM_VERIFY_SSL": "true"
83
+ "FM_VERIFY_SSL": "true",
84
+ "FM_ALLOW_SCHEMA_EDITS": "false"
52
85
  }
53
86
  }
54
87
  }
55
88
  }
56
89
  ```
57
90
 
91
+ > **Schema editing is disabled by default.** The 6 schema (DDL) tools (`fm_odata_create_table`,
92
+ > `fm_odata_add_fields`, `fm_odata_delete_table`, `fm_odata_delete_field`, `fm_odata_create_index`,
93
+ > `fm_odata_delete_index`) are **not registered** unless `FM_ALLOW_SCHEMA_EDITS` is set to `"true"`.
94
+ > When `"false"` (default), these tools are completely absent from the tool list and cannot be called.
95
+ > Set to `"true"` only if your FileMaker account has full-access (schema modification) privileges.
96
+
58
97
  3. **For self-signed SSL certificates**, set `FM_VERIFY_SSL` to `"false"`
59
98
 
60
99
  4. **Restart Claude Desktop**
61
100
 
101
+ #### Setup for Windsurf/Cursor
102
+
103
+ The server will be automatically detected when installed globally. For local development, add to your MCP config.
104
+
105
+ ### 2. Standalone HTTP Server Mode
106
+
107
+ Run as a standalone HTTP server accessible from any application:
108
+
109
+ ```bash
110
+ # Set environment variables for HTTP mode
111
+ export MCP_TRANSPORT=http
112
+ export MCP_PORT=3333
113
+ export MCP_HOST=0.0.0.0 # Listen on all interfaces
114
+
115
+ # Run the server
116
+ fms-odata-mcp
117
+ ```
118
+
119
+ The server will start on `http://localhost:3333` with the following endpoints:
120
+
121
+ - **MCP endpoint**: `http://localhost:3333/mcp` (POST requests with JSON-RPC 2.0)
122
+ - **Health check**: `http://localhost:3333/health`
123
+ - **Server info**: `http://localhost:3333/mcp` (GET request)
124
+
125
+ #### Example HTTP Client Request
126
+
127
+ ```bash
128
+ curl -X POST http://localhost:3333/mcp \
129
+ -H "Content-Type: application/json" \
130
+ -d '{
131
+ "jsonrpc": "2.0",
132
+ "id": 1,
133
+ "method": "tools/list",
134
+ "params": {}
135
+ }'
136
+ ```
137
+
138
+ #### HTTPS Mode
139
+
140
+ ```bash
141
+ export MCP_TRANSPORT=https
142
+ export MCP_PORT=3443
143
+ export MCP_CERT_PATH=/path/to/cert.pem
144
+ export MCP_KEY_PATH=/path/to/key.pem
145
+ ```
146
+
147
+ #### HTTP/HTTPS Authentication
148
+
149
+ When the server is accessible on a non-localhost network, set `MCP_AUTH_TOKEN` to require Bearer token authentication for `/mcp` POST requests. This prevents unauthorized tool invocation.
150
+
151
+ ```bash
152
+ # Generate a random token
153
+ export MCP_AUTH_TOKEN=$(openssl rand -hex 32)
154
+
155
+ # Clients must now send the token in the Authorization header:
156
+ curl -X POST http://localhost:3333/mcp \
157
+ -H "Content-Type: application/json" \
158
+ -H "Authorization: Bearer $MCP_AUTH_TOKEN" \
159
+ -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
160
+ ```
161
+
162
+ - When `MCP_AUTH_TOKEN` is set, POST requests to `/mcp` without a valid `Authorization: Bearer <token>` header receive a 401 response.
163
+ - The `/health` endpoint and `GET /mcp` (server info) remain open — no auth required.
164
+ - When unset, a warning is logged and the endpoint is open (suitable for local development only).
165
+
166
+ #### Integration Examples
167
+
168
+ **Python Example:**
169
+
170
+ ```python
171
+ import requests
172
+
173
+ # List available tools
174
+ response = requests.post("http://localhost:3333/mcp", json={
175
+ "jsonrpc": "2.0",
176
+ "id": 1,
177
+ "method": "tools/list",
178
+ "params": {}
179
+ })
180
+ tools = response.json()
181
+
182
+ # Query records
183
+ response = requests.post("http://localhost:3333/mcp", json={
184
+ "jsonrpc": "2.0",
185
+ "id": 2,
186
+ "method": "tools/call",
187
+ "params": {
188
+ "name": "fm_odata_query_records",
189
+ "arguments": {
190
+ "table": "Contacts",
191
+ "filter": "City eq 'New York'"
192
+ }
193
+ }
194
+ })
195
+ ```
196
+
197
+ **JavaScript Example:**
198
+
199
+ ```javascript
200
+ // Connect to FileMaker
201
+ const response = await fetch('http://localhost:3333/mcp', {
202
+ method: 'POST',
203
+ headers: { 'Content-Type': 'application/json' },
204
+ body: JSON.stringify({
205
+ jsonrpc: '2.0',
206
+ id: 1,
207
+ method: 'tools/call',
208
+ params: {
209
+ name: 'fm_odata_connect',
210
+ arguments: {
211
+ server: 'https://your-server.com/fmi/odata/v4',
212
+ database: 'Contacts',
213
+ user: 'admin',
214
+ password: 'secret',
215
+ verifySsl: false
216
+ }
217
+ }
218
+ })
219
+ });
220
+ ```
221
+
222
+ ### 3. Docker Deployment
223
+
224
+ #### Option A: Using `start.sh` (Recommended)
225
+
226
+ The included `start.sh` script handles building, credential injection from `.env`, and container lifecycle:
227
+
228
+ ```bash
229
+ git clone https://github.com/fsans/fms-odata-mcp.git
230
+ cd fms-odata-mcp
231
+ cp .env.example .env
232
+ # Edit .env with your FileMaker credentials and set MCP_TRANSPORT=http, MCP_HOST=0.0.0.0
233
+ ./start.sh
234
+ ```
235
+
236
+ The script will build TypeScript, build the Docker image, remove any existing container,
237
+ and start a fresh one. Logs are tailed automatically.
238
+
239
+ #### Option B: Using Docker Run
240
+
241
+ ```bash
242
+ # Clone and build
243
+ git clone https://github.com/fsans/fms-odata-mcp.git
244
+ cd fms-odata-mcp
245
+ npm run build
246
+ docker build -t fms-odata-mcp:latest .
247
+
248
+ # Run the container
249
+ docker run -d \
250
+ --name fms-odata-mcp \
251
+ -p 3333:3333 \
252
+ -e FM_SERVER=https://your-filemaker-server.com \
253
+ -e FM_DATABASE=YourDatabase \
254
+ -e FM_USER=your-username \
255
+ -e FM_PASSWORD=your-password \
256
+ -e FM_VERIFY_SSL=false \
257
+ -e MCP_TRANSPORT=http \
258
+ -e MCP_HOST=0.0.0.0 \
259
+ -v ~/.fms-odata-mcp:/home/mcp/.fms-odata-mcp \
260
+ fms-odata-mcp:latest
261
+ ```
262
+
263
+ > **Important:** Set `MCP_HOST=0.0.0.0` when running in a container. Using `localhost` binds only to the container's loopback interface and makes the port unreachable from outside.
264
+
265
+ #### Option C: Using Docker Compose
266
+
267
+ 1. **Clone and build:**
268
+
269
+ ```bash
270
+ git clone https://github.com/fsans/fms-odata-mcp.git
271
+ cd fms-odata-mcp
272
+ npm run build
273
+ ```
274
+
275
+ 2. **Configure environment:**
276
+
277
+ ```bash
278
+ cp docker-compose.yml my-docker-compose.yml
279
+ # Edit my-docker-compose.yml with your FileMaker credentials
280
+ ```
281
+
282
+ 3. **Start the server:**
283
+
284
+ ```bash
285
+ docker-compose -f my-docker-compose.yml up -d
286
+ ```
287
+
288
+ #### Option D: Docker Compose with HTTPS
289
+
290
+ ```bash
291
+ # Start with Nginx reverse proxy for HTTPS
292
+ docker-compose -f docker-compose.yml --profile https up -d
293
+ ```
294
+
295
+ Generate your own SSL certificates and place them in the `./ssl` directory:
296
+ ```bash
297
+ mkdir -p ssl
298
+ openssl req -x509 -newkey rsa:4096 -keyout ssl/key.pem -out ssl/cert.pem -days 365 -nodes
299
+ ```
300
+ - `ssl/cert.pem` - SSL certificate
301
+ - `ssl/key.pem` - SSL private key
302
+
303
+ #### Docker Features
304
+
305
+ - **Health checks** - Automatic monitoring of server status
306
+ - **Persistent connections** - Mount volume to save connection configurations
307
+ - **Non-root user** - Security best practices
308
+ - **Alpine Linux** - Small image size (~50MB)
309
+ - **Signal handling** - Graceful shutdown with dumb-init
310
+
311
+ #### Accessing the Server
312
+
313
+ Once running, access the server at:
314
+ - HTTP: `http://localhost:3333`
315
+ - HTTPS (with Nginx): `https://localhost`
316
+
317
+ Check the health endpoint:
318
+
319
+ ```bash
320
+ curl http://localhost:3333/health
321
+ ```
322
+
323
+ ### 4. Dify Integration
324
+
325
+ To use this server as an MCP tool in [Dify](https://dify.ai):
326
+
327
+ 1. Start the server in HTTP mode (see Docker Deployment above)
328
+ 2. In Dify, add a new MCP tool with:
329
+ - **Transport:** `streamable_http`
330
+ - **URL:** `http://host.docker.internal:3333/mcp` (if Dify runs in Docker on the same host)
331
+ 3. No authentication headers are required
332
+
333
+ > **Note:** If Dify returns a 403 error, check your SSRF proxy configuration. Dify uses a Squid proxy to prevent SSRF attacks — port 3333 must be added to the `Safe_ports` ACL in `squid.conf`.
334
+
62
335
  ### First Steps
63
336
 
64
337
  Once connected, try these prompts in Claude:
65
338
 
66
- ```
339
+ ```text
67
340
  What tables are in my FileMaker database?
68
341
 
69
342
  Show me the first 5 records from the Contacts table
@@ -75,20 +348,40 @@ Create a new contact with name "John Doe" and email "john@example.com"
75
348
 
76
349
  ## Documentation
77
350
 
78
- - **[Quick Reference](./dev_stuf/QUICK_REFERENCE.md)** - One-page setup guide
79
- - **[Prompt Examples](./dev_stuf/CLAUDE_DESKTOP_PROMPTS.md)** - Complete prompt reference
80
- - **[Claude Desktop Setup](./dev_stuf/CLAUDE_DESKTOP_SETUP.md)** - Detailed configuration
81
- - **[Windsurf Setup](./dev_stuf/WINDSURF_SETUP.md)** - IDE integration guide
351
+ - **[Docker Deployment](./DOCKER.md)** - Complete Docker guide with production examples
352
+ - **[Roadmap](./ROADMAP.md)** - Planned features and version history
353
+ - **[Changelog](./CHANGELOG.md)** - Detailed release notes
82
354
 
83
355
  ## Available Tools
84
356
 
85
- | Category | Tools |
86
- |----------|-------|
87
- | **Discovery** | `fm_odata_list_tables`, `fm_odata_get_metadata`, `fm_odata_get_service_document` |
88
- | **Queries** | `fm_odata_query_records`, `fm_odata_get_record`, `fm_odata_get_records`, `fm_odata_count_records` |
89
- | **CRUD** | `fm_odata_create_record`, `fm_odata_update_record`, `fm_odata_delete_record` |
90
- | **Connection** | `fm_odata_connect`, `fm_odata_set_connection`, `fm_odata_list_connections`, `fm_odata_get_current_connection` |
91
- | **Config** | `fm_odata_config_add_connection`, `fm_odata_config_remove_connection`, `fm_odata_config_list_connections` |
357
+ | Category | Tools |
358
+ |-------------------|-----------------------------------------------------------------------|
359
+ | **Discovery** | `fm_odata_list_tables`, `fm_odata_get_metadata`, `fm_odata_get_service_document` |
360
+ | **Queries** | `fm_odata_query_records`, `fm_odata_get_record`, `fm_odata_get_records`, `fm_odata_count_records` |
361
+ | **CRUD** | `fm_odata_create_record`, `fm_odata_update_record`, `fm_odata_delete_record` |
362
+ | **FM 2024/2025+** | `fm_odata_aggregate`, `fm_odata_cast`, `fm_odata_build_filter` |
363
+ | **Connection** | `fm_odata_connect`, `fm_odata_connect_multi`, `fm_odata_set_connection`, `fm_odata_list_connections`, `fm_odata_get_current_connection` |
364
+ | **Sessions** | `fm_odata_list_active_sessions`, `fm_odata_describe_sessions` |
365
+ | **Diagnostics** | `fm_odata_get_server_version` |
366
+ | **Config** | `fm_odata_config_add_connection`, `fm_odata_config_remove_connection`, `fm_odata_config_list_connections`, `fm_odata_config_get_connection`, `fm_odata_config_set_default_connection` |
367
+ | **Schema (DDL)** | `fm_odata_create_table`, `fm_odata_add_fields`, `fm_odata_delete_table`, `fm_odata_delete_field`, `fm_odata_create_index`, `fm_odata_delete_index` |
368
+
369
+ > The **FM 2024/2025+** tools are connection-free expression builders. `fm_odata_cast` and
370
+ > `fm_odata_build_filter` require FileMaker Server v21.1+ (FileMaker 2024); `fm_odata_aggregate`
371
+ > requires FileMaker Server v22.0.1+ (FileMaker 2025).
372
+ >
373
+ > All connection-dependent OData tools (including the 6 schema DDL tools when enabled) accept
374
+ > an optional `connection` parameter to target a specific session without changing the active
375
+ > connection. Useful in multi-file solutions.
376
+ >
377
+ > `fm_odata_get_server_version` detects the connected FileMaker Server version from `$metadata`
378
+ > (cached per session) and returns a feature-compatibility report covering `basic_odata`,
379
+ > `cast`, `build_filter`, `aggregate`, and `metadata_comments` (v26+). On servers that do not
380
+ > support server-side `$apply`, `fm_odata_aggregate` automatically falls back to client-side
381
+ > computation (capped at 10 000 records) with a `[Compatibility]` advisory.
382
+ >
383
+ > The **Schema (DDL)** tools are hidden by default. Set `FM_ALLOW_SCHEMA_EDITS=true` to
384
+ > register them. See [Schema Editing](#schema-editing-ddl) below.
92
385
 
93
386
  ## Requirements
94
387
 
@@ -98,20 +391,34 @@ Create a new contact with name "John Doe" and email "john@example.com"
98
391
 
99
392
  ## Environment Variables
100
393
 
101
- | Variable | Description | Required | Default |
102
- |----------|-------------|----------|---------|
103
- | `FM_SERVER` | FileMaker Server URL | Yes | - |
104
- | `FM_DATABASE` | Database name | Yes | - |
105
- | `FM_USER` | Username | Yes | - |
106
- | `FM_PASSWORD` | Password | Yes | - |
107
- | `FM_VERIFY_SSL` | Verify SSL certificates | No | `true` |
108
- | `FM_TIMEOUT` | Request timeout (ms) | No | `30000` |
394
+ ### FileMaker Connection
395
+
396
+ | Variable | Description | Required | Default |
397
+ |---------------|------------------------------------------------|----------|---------|
398
+ | `FM_SERVER` | FileMaker Server URL | Yes | - |
399
+ | `FM_DATABASE` | Database name | Yes | - |
400
+ | `FM_USER` | Username | Yes | - |
401
+ | `FM_PASSWORD` | Password | Yes | - |
402
+ | `FM_VERIFY_SSL`| Verify SSL certificates | No | `true` |
403
+ | `FM_TIMEOUT` | Request timeout (ms) | No | `30000` |
404
+ | `FM_ALLOW_SCHEMA_EDITS` | Enable schema (DDL) tools | No | `false` |
405
+
406
+ ### HTTP/HTTPS Transport
407
+
408
+ | Variable | Description | Required | Default |
409
+ |-----------------|------------------------------------------------|----------|-----------------------------------|
410
+ | `MCP_TRANSPORT` | Transport type: `stdio`, `http`, or `https` | No | `stdio` |
411
+ | `MCP_PORT` | Port for HTTP/HTTPS server | No | `3333` (HTTP), `3443` (HTTPS) |
412
+ | `MCP_HOST` | Host to bind to | No | `localhost` |
413
+ | `MCP_CERT_PATH` | Path to SSL certificate (HTTPS only) | No | - |
414
+ | `MCP_KEY_PATH` | Path to SSL private key (HTTPS only) | No | - |
415
+ | `MCP_AUTH_TOKEN`| Bearer token for `/mcp` auth (HTTP/HTTPS) | No | - (open endpoint, warning logged) |
109
416
 
110
417
  ## OData Query Syntax
111
418
 
112
419
  The server supports OData 4.01 query options:
113
420
 
114
- ```
421
+ ```text
115
422
  $filter - Filter records (e.g., "Age gt 18")
116
423
  $select - Select specific fields
117
424
  $orderby - Sort results
@@ -119,10 +426,12 @@ $top - Limit results
119
426
  $skip - Skip records (pagination)
120
427
  $expand - Include related records
121
428
  $count - Include total count
429
+ $apply - Server-side aggregation (FileMaker Server v22.0.1+ / FileMaker 2025)
122
430
  ```
123
431
 
124
432
  **Example prompts:**
125
- ```
433
+
434
+ ```text
126
435
  Get contacts where Age is greater than 18
127
436
 
128
437
  Show only Name and Email fields from Contacts
@@ -132,6 +441,106 @@ Sort contacts by LastName in descending order
132
441
  Get the first 10 contacts, skip the first 20
133
442
  ```
134
443
 
444
+ ### FileMaker 2025 Advanced Features
445
+
446
+ Three additional tools provide expression-builder helpers for newer FileMaker Server capabilities.
447
+ They require no active connection and return strings ready to use in the standard query tools.
448
+
449
+ **`fm_odata_aggregate`** — server-side aggregation (FileMaker Server v22.0.1+ / FileMaker 2025):
450
+
451
+ ```text
452
+ Sum invoice amounts grouped by customer:
453
+ table=Invoices, method=sum, field=Amount, alias=Total, groupBy=["Customer"]
454
+
455
+ Count open cases per user:
456
+ table=Cases, method=count, alias=OpenCount, filter="Status eq 'Open'", groupBy=["AssignedTo"]
457
+ ```
458
+
459
+ **`fm_odata_cast`** — server-side type coercion (FileMaker Server v21.1+ / FileMaker 2024):
460
+
461
+ ```text
462
+ Return StartDate as a number for arithmetic:
463
+ fields=[{field:"StartDate", type:"Int64"}], context="select"
464
+ → use result as $select value in fm_odata_query_records
465
+
466
+ Cast Amount to String for text comparison in a filter:
467
+ fields=[{field:"Amount", type:"String"}], context="filter"
468
+ → embed result in a $filter expression: Amount/Edm.String eq '100'
469
+ ```
470
+
471
+ **`fm_odata_build_filter`** — parameterized filter builder (FileMaker Server v21.1+ / FileMaker 2024):
472
+
473
+ ```text
474
+ Reusable filter with named placeholders:
475
+ template="Title eq @title and Age gt @minAge",
476
+ params={"@title":"Wizard of Oz","@minAge":18}
477
+ → filter: "Title eq 'Wizard of Oz' and Age gt 18"
478
+ ```
479
+
480
+ ### FileMaker 2026 Metadata Comments
481
+
482
+ FileMaker Server 2026 (v26) exposes table and field comments — including AI annotations —
483
+ in the OData `$metadata` document. When connected to a v26+ server:
484
+
485
+ ```text
486
+ List tables with their comments:
487
+ fm_odata_list_tables with includeDetails=true
488
+ → contact — Contact table
489
+
490
+ Merged schema with field comments and AI annotations:
491
+ fm_odata_describe_sessions
492
+ → tables include `comment`; fields include `comment` and `aiAnnotation`
493
+ ```
494
+
495
+ On v25 and older servers these options are ignored safely — call
496
+ `fm_odata_get_server_version` first to check `metadata_comments` support.
497
+
498
+ ## Schema Editing (DDL)
499
+
500
+ FileMaker Server exposes a proprietary OData schema extension through the
501
+ `FileMaker_Tables` and `FileMaker_Indexes` system endpoints. Six tools wrap it:
502
+
503
+ | Tool | Operation |
504
+ |------|-----------|
505
+ | `fm_odata_create_table` | Create a table with field definitions |
506
+ | `fm_odata_add_fields` | Add fields to an existing table |
507
+ | `fm_odata_delete_table` | Delete a table and ALL its records |
508
+ | `fm_odata_delete_field` | Delete a field and all its data |
509
+ | `fm_odata_create_index` | Create an index on a field |
510
+ | `fm_odata_delete_index` | Delete a field index (no data loss) |
511
+
512
+ **Safety model:**
513
+
514
+ - The tools are **not registered** unless the environment variable
515
+ `FM_ALLOW_SCHEMA_EDITS=true` is set on the MCP server.
516
+ - `fm_odata_delete_table` and `fm_odata_delete_field` are irreversible and require an
517
+ explicit `confirm: true` argument; without it they refuse and describe what would be deleted.
518
+ - The FileMaker account needs full access (schema modification) privileges. Claris recommends
519
+ a dedicated account for table deletion.
520
+
521
+ **Field definitions** use SQL-style types: `NUMERIC`, `DECIMAL`, `INT`, `DATE`, `TIME`,
522
+ `TIMESTAMP`, `VARCHAR(n)`, `BLOB`, etc. Repetitions in brackets (`INT[4]`). Optional flags:
523
+ `primary`, `unique`, `global`, `nullable`, `default` (keyword such as `CURRENT_USER` or
524
+ `CURRENT_TIMESTAMP`), and `externalSecurePath` for container fields.
525
+
526
+ ```text
527
+ Create a Company table:
528
+ tableName="Company", fields=[
529
+ {name:"Company ID", type:"int", primary:true},
530
+ {name:"Company Name", type:"varchar(100)", nullable:false},
531
+ {name:"Notes", type:"varchar(2000)", global:true}
532
+ ]
533
+
534
+ Add a phone field:
535
+ table="Company", fields=[{name:"Phone", type:"varchar(25)"}]
536
+
537
+ Index the State field:
538
+ table="Company", field="State"
539
+ ```
540
+
541
+ > **Limitations:** relationships, layouts, scripts, value lists, and calculation/summary
542
+ > fields cannot be created via OData — only base tables, regular fields, and indexes.
543
+
135
544
  ## Contributing
136
545
 
137
546
  See [CONTRIBUTING.md](./CONTRIBUTING.md) for development guidelines.
@@ -142,12 +551,12 @@ MIT License - see [LICENSE](./LICENSE) file for details.
142
551
 
143
552
  ## Support
144
553
 
145
- - **Issues**: [GitHub Issues](https://github.com/fsans/FMS-ODATA-MCP/issues)
146
- - **Discussions**: [GitHub Discussions](https://github.com/fsans/FMS-ODATA-MCP/discussions)
554
+ - **Issues**: [GitHub Issues](https://github.com/fsans/fms-odata-mcp/issues)
555
+ - **Discussions**: [GitHub Discussions](https://github.com/fsans/fms-odata-mcp/discussions)
147
556
 
148
557
  ## Changelog
149
558
 
150
- See [dev_stuf/VERSIONING.md](./dev_stuf/VERSIONING.md) for version history.
559
+ See [CHANGELOG.md](./CHANGELOG.md) for detailed release notes.
151
560
 
152
561
  ---
153
562
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import { FileMakerODataServer } from '../index.js';
3
+ async function main() {
4
+ const server = new FileMakerODataServer();
5
+ await server.run();
6
+ }
7
+ main().catch((error) => {
8
+ console.error('Server error:', error);
9
+ process.exit(1);
10
+ });
11
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/bin/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC1C,MAAM,MAAM,CAAC,GAAG,EAAE,CAAC;AACrB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/dist/config.d.ts CHANGED
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Default transport ports. Keep in one place so `config.ts` and
3
+ * `transport.ts` cannot drift apart.
4
+ */
5
+ export declare const DEFAULT_HTTP_PORT = 3333;
6
+ export declare const DEFAULT_HTTPS_PORT = 3443;
1
7
  export interface ServerConfig {
2
8
  transport: "stdio" | "http" | "https";
3
9
  port: number;
@@ -10,6 +16,14 @@ export interface FileMakerConfig {
10
16
  password?: string;
11
17
  verifySsl?: boolean;
12
18
  timeout?: number;
19
+ /** Maximum records per batch operation (default: 100). */
20
+ batchMaxItems?: number;
21
+ /** Server-wide cap on total records returned by queryAllRecords (default: 10000). */
22
+ maxRecords?: number;
23
+ /** Authentication method: "basic" (default) or "bearer" (token-based). */
24
+ authType?: "basic" | "bearer";
25
+ /** Bearer token (when authType === "bearer"). */
26
+ bearerToken?: string;
13
27
  }
14
28
  export interface SecurityConfig {
15
29
  certPath?: string;
@@ -21,6 +35,11 @@ export interface Connection {
21
35
  database: string;
22
36
  user: string;
23
37
  password: string;
38
+ verifySsl?: boolean;
39
+ /** Authentication method: "basic" (default) or "bearer" (token-based). */
40
+ authType?: "basic" | "bearer";
41
+ /** Bearer token (required when authType === "bearer"). */
42
+ bearerToken?: string;
24
43
  }
25
44
  export interface AppConfig {
26
45
  server: ServerConfig;
@@ -81,6 +100,11 @@ export declare function getConnection(name: string): Connection | null;
81
100
  * Add a connection to config file
82
101
  */
83
102
  export declare function addConnection(name: string, connection: Connection): void;
103
+ /**
104
+ * Resolve the effective verifySsl flag from possibly-undefined sources.
105
+ * Defaults to `true` unless explicitly set to `false`.
106
+ */
107
+ export declare function resolveVerifySsl(...sources: Array<boolean | undefined>): boolean;
84
108
  /**
85
109
  * Remove a connection from config file
86
110
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],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