# fsans/fms-odata-mcp architecture

> Architecture diagram of the GitHub repository fsans/fms-odata-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fsans/fms-odata-mcp
- Repository: https://github.com/fsans/fms-odata-mcp

## Overview

1. **What this repository is**
   - This is a Node.js/TypeScript Model Context Protocol server that sits between AI clients and a FileMaker Server OData 4.01 endpoint.
   - Its job is to translate MCP tool calls into FileMaker OData requests, then return structured results back to the AI client.

2. **Top-level runtime shape**
   - The main runtime starts in `src/index.ts`, with a CLI entrypoint in `src/bin/cli.ts`.
   - The server can run in three transport modes: MCP over stdio, plain HTTP, or HTTPS.
   - Environment variables drive both the FileMaker connection and the transport binding, so deployment is mostly configuration-based.

3. **Protocol boundary: MCP layer**
   - `src/tools/` contains the MCP tool surface exposed to clients.
   - The tool set is split by concern: discovery, records/query operations, connection management, and saved configuration management.
   - These tools are the main external API of the server; everything else exists to support tool execution.

4. **Transport abstraction**
   - `src/transport.ts` defines the transport boundary, with implementations in `src/simple-http-transport.ts` and `src/working-http-transport.ts`.
   - `src/http-server.ts` likely hosts the HTTP/HTTPS MCP endpoint and health/info routes described in the README.
   - This separation lets the same tool layer serve both IDE assistants via stdio and external apps via HTTP/HTTPS.

5. **FileMaker integration core**
   - `src/odata-client.ts` is the main integration layer for FileMaker Server’s OData API.
   - `src/connection.ts` manages connection state and credentials for the active FileMaker target.
   - `src/config.ts` handles configuration defaults and environment-derived settings such as server URL, database, user/password, timeout, and SSL verification.

6. **Request parsing and OData semantics**
   - `src/odata-parser.ts` is the query/response interpretation layer for OData-specific behavior.
   - This is where OData 4.01 constructs like `$filter`, `$select`, `$orderby`, `$top`, `$skip`, `$expand`, and `$count` are likely normalized or parsed for use by the client and tools.
   - It forms the translation boundary between generic MCP tool arguments and FileMaker-specific query syntax.

7. **Tool execution flow**
   - A typical call path is: MCP client -> transport -> tool handler in `src/tools/` -> connection/config lookup -> OData client -> FileMaker Server -> response back through parser/formatter -> MCP response.
   - Connection-oriented tools (`connect`, `set_connection`, `list_connections`, `get_current_connection`) affect shared state, while query/CRUD tools operate against that selected target.

8. **State and persistence**
   - Connection configuration can be saved and reused, which implies a small local persistence layer or file-backed storage under the user’s home directory.
   - The README and Docker examples suggest persistent volume mounting is used to preserve connection state across restarts in containerized deployments.
   - This persistence is operational, not business data storage; FileMaker remains the system of record.

9. **Logging and operational concerns**
   - `src/logger.ts` centralizes logging, likely to keep MCP, HTTP transport, and OData client output consistent.
   - The server also exposes a health endpoint in HTTP mode, which is important for container orchestration and reverse proxy setups.

10. **Deployment packaging**
   - The repo supports direct Node execution, Docker image builds, Docker Compose, and an optional Nginx front end for HTTPS termination.
   - `Dockerfile`, `docker-compose.yml`, `nginx.conf`, `ssl/`, and `start.sh` form the container/deployment layer.
   - These are not core application logic, but they materially affect how the server is exposed and secured.

11. **Testing structure**
   - Tests are split into unit tests under `tests/unit/` and integration tests under `tests/integration/`.
   - Unit tests focus on config, OData parsing, and the client boundary; integration tests cover the exposed tools and their end-to-end behavior.
   - This mirrors the architecture: isolated pure logic in the parser/config layers, and integration coverage for the MCP tool surface.

12. **Architecture boundary summary**
   - The cleanest diagram is: AI client or HTTP caller on one side, MCP transport and tool layer in the middle, and FileMaker OData API on the other side.
   - Supporting subsystems around that core are configuration, connection persistence, logging, and deployment wrappers for Docker/HTTPS.

Main entry points: [`src/odata-client.ts`](https://github.com/fsans/fms-odata-mcp/blob/master/src/odata-client.ts) (OData client), [`src/index.ts`](https://github.com/fsans/fms-odata-mcp/blob/master/src/index.ts) (Main), [`src/tools/configuration.ts`](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/configuration.ts) (Config tools), [`src/tools/connection.ts`](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/connection.ts) (Connection tools)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_src["Source"]
  node_node_cli["CLI<br/>entrypoint<br/>[cli.ts]"]
  node_node_index["Main<br/>runtime bootstrap<br/>[index.ts]"]
  node_node_transport["Transport<br/>boundary<br/>[transport.ts]"]
  node_node_stdio_http["StdIO HTTP<br/>transport impl"]
  node_node_working_http["Working HTTP<br/>transport impl"]
  node_node_http_server["HTTP server<br/>[http-server.ts]"]
  node_node_tools_index["Tools API<br/>mcp surface<br/>[index.ts]"]
  node_node_tools_config["Config tools<br/>mcp tools<br/>[configuration.ts]"]
  node_node_tools_conn["Connection tools<br/>mcp tools<br/>[connection.ts]"]
  node_node_tools_odata["OData tools<br/>mcp tools<br/>[odata.ts]"]
  node_node_config["Config<br/>settings<br/>[config.ts]"]
  node_node_connection["Connection<br/>state<br/>[connection.ts]"]
  node_node_odata_client["OData client<br/>integration client<br/>[odata-client.ts]"]
  node_node_parser["OData parser<br/>translation<br/>[odata-parser.ts]"]
  node_node_logger["Logger<br/>ops<br/>[logger.ts]"]
end

subgraph group_group_tests["Tests"]
  node_node_unit_config["Config tests<br/>unit tests<br/>[config.test.ts]"]
  node_node_unit_client["Client tests<br/>unit tests"]
  node_node_unit_parser["Parser tests<br/>unit tests"]
  node_node_int_tools["Tool tests<br/>integration tests<br/>[odata.test.ts]"]
  node_node_int_conn["Conn tests<br/>integration tests<br/>[connection.test.ts]"]
  node_node_int_config["Config integration<br/>integration tests"]
end

subgraph group_group_deploy["Deployment"]
  node_node_dockerfile["Dockerfile<br/>build"]
  node_node_compose["Compose<br/>deployment<br/>[docker-compose.yml]"]
  node_node_nginx["Nginx<br/>tls proxy<br/>[nginx.conf]"]
  node_node_start["Start script<br/>startup<br/>[start.sh]"]
end

node_node_cli -->|"starts"| node_node_index
node_node_index -->|"selects"| node_node_transport
node_node_index -->|"hosts"| node_node_http_server
node_node_transport -->|"impl"| node_node_stdio_http
node_node_transport -->|"impl"| node_node_working_http
node_node_http_server -->|"logs"| node_node_logger
node_node_tools_index -->|"exports"| node_node_tools_config
node_node_tools_index -->|"exports"| node_node_tools_conn
node_node_tools_index -->|"exports"| node_node_tools_odata
node_node_tools_config -->|"reads"| node_node_config
node_node_tools_config -->|"updates"| node_node_connection
node_node_tools_conn -->|"reads"| node_node_connection
node_node_tools_conn -->|"uses"| node_node_odata_client
node_node_tools_odata -->|"uses"| node_node_odata_client
node_node_tools_odata -->|"formats"| node_node_parser
node_node_odata_client -->|"reads"| node_node_config
node_node_odata_client -->|"uses"| node_node_connection
node_node_odata_client -->|"logs"| node_node_logger
node_node_parser -->|"influences"| node_node_config
node_node_unit_config -.->|"tests"| node_node_config
node_node_unit_client -.->|"tests"| node_node_odata_client
node_node_unit_parser -.->|"tests"| node_node_parser
node_node_int_tools -.->|"tests"| node_node_tools_odata
node_node_int_conn -.->|"tests"| node_node_tools_conn
node_node_int_config -.->|"tests"| node_node_tools_config
node_node_dockerfile -->|"uses"| node_node_start
node_node_compose -->|"builds"| node_node_dockerfile
node_node_compose -->|"proxies"| node_node_nginx
node_node_start -->|"runs"| node_node_index
node_node_nginx -->|"fronts"| node_node_http_server

click node_node_cli "https://github.com/fsans/fms-odata-mcp/blob/master/src/bin/cli.ts"
click node_node_index "https://github.com/fsans/fms-odata-mcp/blob/master/src/index.ts"
click node_node_transport "https://github.com/fsans/fms-odata-mcp/blob/master/src/transport.ts"
click node_node_stdio_http "https://github.com/fsans/fms-odata-mcp/blob/master/src/simple-http-transport.ts"
click node_node_working_http "https://github.com/fsans/fms-odata-mcp/blob/master/src/working-http-transport.ts"
click node_node_http_server "https://github.com/fsans/fms-odata-mcp/blob/master/src/http-server.ts"
click node_node_tools_index "https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/index.ts"
click node_node_tools_config "https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/configuration.ts"
click node_node_tools_conn "https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/connection.ts"
click node_node_tools_odata "https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/odata.ts"
click node_node_config "https://github.com/fsans/fms-odata-mcp/blob/master/src/config.ts"
click node_node_connection "https://github.com/fsans/fms-odata-mcp/blob/master/src/connection.ts"
click node_node_odata_client "https://github.com/fsans/fms-odata-mcp/blob/master/src/odata-client.ts"
click node_node_parser "https://github.com/fsans/fms-odata-mcp/blob/master/src/odata-parser.ts"
click node_node_logger "https://github.com/fsans/fms-odata-mcp/blob/master/src/logger.ts"
click node_node_unit_config "https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/config.test.ts"
click node_node_unit_client "https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/odata-client.test.ts"
click node_node_unit_parser "https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/odata-parser.test.ts"
click node_node_int_tools "https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/odata.test.ts"
click node_node_int_conn "https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/connection.test.ts"
click node_node_int_config "https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/configuration.test.ts"
click node_node_dockerfile "https://github.com/fsans/fms-odata-mcp/tree/master/Dockerfile"
click node_node_compose "https://github.com/fsans/fms-odata-mcp/blob/master/docker-compose.yml"
click node_node_nginx "https://github.com/fsans/fms-odata-mcp/blob/master/nginx.conf"
click node_node_start "https://github.com/fsans/fms-odata-mcp/blob/master/start.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_node_cli,node_node_index,node_node_transport,node_node_stdio_http,node_node_working_http,node_node_http_server,node_node_tools_index,node_node_tools_config,node_node_tools_conn,node_node_tools_odata,node_node_config,node_node_connection,node_node_odata_client,node_node_parser,node_node_logger toneBlue
class node_node_unit_config,node_node_unit_client,node_node_unit_parser,node_node_int_tools,node_node_int_conn,node_node_int_config toneAmber
class node_node_dockerfile,node_node_compose,node_node_nginx,node_node_start toneMint
```

## Components

### Source

Runtime, transport, tool, and FileMaker integration code.

- [CLI](https://github.com/fsans/fms-odata-mcp/blob/master/src/bin/cli.ts): entrypoint · Command-line entrypoint for starting the server. · `src/bin/cli.ts`
- [Main](https://github.com/fsans/fms-odata-mcp/blob/master/src/index.ts): runtime bootstrap · Wires startup, transport selection, and server initialization. · `src/index.ts`
- [Transport](https://github.com/fsans/fms-odata-mcp/blob/master/src/transport.ts): boundary · Abstract transport boundary shared by stdio and HTTP modes. · `src/transport.ts`
- [StdIO HTTP](https://github.com/fsans/fms-odata-mcp/blob/master/src/simple-http-transport.ts): transport impl · HTTP transport implementation used for MCP-compatible request handling. · `src/simple-http-transport.ts`
- [Working HTTP](https://github.com/fsans/fms-odata-mcp/blob/master/src/working-http-transport.ts): transport impl · Alternative HTTP transport implementation for the MCP endpoint. · `src/working-http-transport.ts`
- [HTTP server](https://github.com/fsans/fms-odata-mcp/blob/master/src/http-server.ts): server · Hosts HTTP/HTTPS MCP endpoints and operational routes. · `src/http-server.ts`
- [Tools API](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/index.ts): mcp surface · Exports the tool set exposed to AI clients. · `src/tools/index.ts`
- [Config tools](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/configuration.ts): mcp tools · Saved configuration and connection-management tools. · `src/tools/configuration.ts`
- [Connection tools](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/connection.ts): mcp tools · Connect and inspect the active FileMaker target. · `src/tools/connection.ts`
- [OData tools](https://github.com/fsans/fms-odata-mcp/blob/master/src/tools/odata.ts): mcp tools · Query and data operation tools backed by FileMaker OData. · `src/tools/odata.ts`
- [Config](https://github.com/fsans/fms-odata-mcp/blob/master/src/config.ts): settings · Environment-driven defaults and connection settings. · `src/config.ts`
- [Connection](https://github.com/fsans/fms-odata-mcp/blob/master/src/connection.ts): state · Tracks active connection state and selected FileMaker target. · `src/connection.ts`
- [OData client](https://github.com/fsans/fms-odata-mcp/blob/master/src/odata-client.ts): integration client · Core client for FileMaker Server OData requests. · `src/odata-client.ts`
- [OData parser](https://github.com/fsans/fms-odata-mcp/blob/master/src/odata-parser.ts): translation · Interprets OData query and response semantics. · `src/odata-parser.ts`
- [Logger](https://github.com/fsans/fms-odata-mcp/blob/master/src/logger.ts): ops · Centralized logging for runtime and integrations. · `src/logger.ts`

### Tests

Unit and integration coverage for core behavior.

- [Config tests](https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/config.test.ts): unit tests · Unit coverage for configuration behavior. · `tests/unit/config.test.ts`
- [Client tests](https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/odata-client.test.ts): unit tests · Unit coverage for the OData client boundary. · `tests/unit/odata-client.test.ts`
- [Parser tests](https://github.com/fsans/fms-odata-mcp/blob/master/tests/unit/odata-parser.test.ts): unit tests · Unit coverage for OData parsing and normalization. · `tests/unit/odata-parser.test.ts`
- [Tool tests](https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/odata.test.ts): integration tests · End-to-end coverage for exposed MCP tools. · `tests/integration/tools/odata.test.ts`
- [Conn tests](https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/connection.test.ts): integration tests · Integration coverage for connection-related tools. · `tests/integration/tools/connection.test.ts`
- [Config integration](https://github.com/fsans/fms-odata-mcp/blob/master/tests/integration/tools/configuration.test.ts): integration tests · Integration coverage for configuration tools and persistence flow. · `tests/integration/tools/configuration.test.ts`

### Deployment

Container, TLS, and runtime startup assets.

- [Dockerfile](https://github.com/fsans/fms-odata-mcp/tree/master/Dockerfile): build · Container image definition for deployment. · `Dockerfile`
- [Compose](https://github.com/fsans/fms-odata-mcp/blob/master/docker-compose.yml): deployment · Local container orchestration and persistent volume setup. · `docker-compose.yml`
- [Nginx](https://github.com/fsans/fms-odata-mcp/blob/master/nginx.conf): tls proxy · Optional HTTPS termination and reverse proxy config. · `nginx.conf`
- [Start script](https://github.com/fsans/fms-odata-mcp/blob/master/start.sh): startup · Container startup helper for launching the service. · `start.sh`

## Connections

- CLI → Main: starts · CLI launches the main runtime.
- Main → Transport: selects · Runtime chooses MCP transport mode.
- Main → HTTP server: hosts · HTTP/HTTPS mode is served by the HTTP server.
- Transport → StdIO HTTP: impl · One transport implementation.
- Transport → Working HTTP: impl · Alternative transport implementation.
- HTTP server → Logger: logs · Server lifecycle and request handling are logged.
- Tools API → Config tools: exports · Tools index aggregates configuration tools.
- Tools API → Connection tools: exports · Tools index aggregates connection tools.
- Tools API → OData tools: exports · Tools index aggregates OData tools.
- Config tools → Config: reads · Configuration tools use persisted/default settings.
- Config tools → Connection: updates · Configuration tools can save or switch connection state.
- Connection tools → Connection: reads · Connection tools inspect active target state.
- Connection tools → OData client: uses · Connection tools rely on the FileMaker client.
- OData tools → OData client: uses · Query tools execute through the OData client.
- OData tools → OData parser: formats · OData tools normalize request and response semantics.
- OData client → Config: reads · Client configuration comes from environment and defaults.
- OData client → Connection: uses · Client uses the active connection target.
- OData client → Logger: logs · Client activity is centralized through logging.
- OData parser → Config: influences · Parser behavior can depend on configured limits or defaults.
- Config tests → Config: tests · Unit tests cover configuration logic.
- Client tests → OData client: tests · Unit tests cover the client boundary.
- Parser tests → OData parser: tests · Unit tests cover OData parsing.
- Tool tests → OData tools: tests · Integration tests exercise query tools.
- Conn tests → Connection tools: tests · Integration tests exercise connection tools.
- Config integration → Config tools: tests · Integration tests exercise configuration tools.
- Dockerfile → Start script: uses · Container image startup relies on the start script.
- Compose → Dockerfile: builds · Compose targets the container image.
- Compose → Nginx: proxies · Compose can pair with Nginx for HTTPS exposure.
- Start script → Main: runs · Startup script launches the Node runtime.
- Nginx → HTTP server: fronts · Nginx fronts the HTTP server in HTTPS deployments.
