ETK-MCP
# ETK-MCP
MCP server that gives Claude (or any MCP client) RealOEM-style lookups against a **local copy of BMW's
ETK parts catalog**, so nothing has to be scraped from RealOEM.
You bring your own ETK Lokal installation (copy its `BMWgroup` folder into this directory); the catalog is
exported once into SQLite (`data/etk.sqlite`, ~3.3 GB) plus the diagram drawings (`data/images/`, ~1.4 GB).
After that the server only reads those files; ETK's Transbase database server is not needed.
Developed against ETK Lokal 3.2.20 with catalog data 01/2020 (Transbase 6.1). Other versions may need
changes to table or column names.
> **Disclaimer.** This project is not affiliated with, endorsed by, or connected to BMW AG. It contains
> no ETK software, catalog data, images or credentials — only code that reads an ETK installation you
> already have. BMW, MINI, Rolls-Royce and ETK are trademarks of BMW AG. Make sure your use of your ETK
> copy complies with the terms under which you obtained it, and do not publish the exported data.
## Tools
| tool | what it does |
|---|---|
| `decode_vin` | VIN (17 chars or last 7) → model, mospid, type code, production month, plant |
| `find_models` / `list_series` | find a model's `mospid` by series / name / type code / engine / body / market |
| `list_groups` | main groups of a model, or subgroups + diagrams (`btnr`) of one main group |
| `get_diagram` | parts list of a diagram: callout no., part number, name, qty for the model, dates, conditions, notes |
| `get_diagram_image` | the exploded-view drawing (JPG, or TIFF converted to PNG) |
| `part_info` | name, weight, orderable/discontinued, supersessions, kit contents, other numbers, usage summary |
| `where_used` | models and diagrams that use a part, with callout no. and qty |
| `search_parts` | find parts by name (any of the 19 languages), optionally within one model |
| `fluid_capacities` | oil / gearbox / axle / coolant / brake fluid capacities |
| `sql_query` / `describe_schema` | read-only SQL over the raw ETK tables |
Texts come in 19 languages (`lang`: `ja`, `en`, `de`, `enUS`, `zh`, `zhTW`, ...). The default is `en`;
set `ETK_LANG=ja` in the server's environment to change it.
## Setup
Requirements: Windows (Transbase 6.1 is a Win32 build), Java 11+ (`java` on PATH), [uv](https://docs.astral.sh/uv/),
and an ETK Lokal install copied to `BMWgroup\ETKLokal` in this folder (or set `ETK_ROOT`). The folder path must
not contain spaces.
```powershell
uv sync
python tools\relocate_transbase.py # point the copied ETK configs at this folder (backups: *.orig)
uv run etk-build # ~15 min: tables -> data\etk.sqlite, drawings -> data\images
uv run python tools\smoke_test.py # optional: run every query once
claude mcp add etk --scope user -- uv run --directory C:\path\to\ETK-MCP etk-mcp
```
`etk-build` starts Transbase itself (`tbmux32.exe noservice`, port 2024) when nothing is listening and
stops it afterwards. To keep it running for ad-hoc queries, use `tools\start_transbase.ps1` and
`tools\tbtool.ps1 query "SELECT ..."`. The DB password is read from ETK's own classes at runtime and is
not stored in this repo.
`etk-build` is resumable (finished tables are skipped). `--tables w_teil ...` reloads specific tables,
`--no-images` / `--images-only` split the two phases.
## Layout
```
exporter/TbTool.java JDBC bridge to Transbase: tables | schema | query | stream | images
src/etk_mcp/build_db.py Transbase -> SQLite (+ indexes, + image export)
src/etk_mcp/catalog.py all queries (usable without MCP)
src/etk_mcp/server.py MCP tool definitions (stdio)
tools/ relocation, Transbase launcher, smoke test, MCP client test
```
To see every ETK table with its row count, primary key and columns, start Transbase
(`tools\start_transbase.ps1`) and run `tools\tbtool.ps1 schema 'w_%' > docs\etk_publ_schema.tsv`
(git-ignored, since it describes BMW's database).
## Notes on the data
* `mospid` = model id (series + model + body + market). One mospid has several 4-char type codes
(VIN positions 4–7), typically LHD/RHD variants.
* Diagram numbers (`btnr`) look like `11_2166`; the first two digits are the main group.
* Per-model rows and quantities come from `w_btzeilen_verbauung`; conditions (`if L807 National version Japan`)
from `w_bte_bed*`; production-date limits from the diagram rows (`from` / `up to`).
* `BMWgroup/` and `data/` hold BMW's catalog data and are git-ignored; keep them private.
TDQS
Scored across 12 tools
Each tool targets a distinct resource+action: series listing, model lookup, VIN decode, catalog browsing, diagram content, diagram image, part details, usage lookup, name search, fluid capacities, schema introspection, and ad-hoc SQL. The nearest overlaps (find_models vs decode_vin, search_parts vs part_info, list_groups vs get_diagram) are clearly differentiated by the descriptions' stated inputs and outputs. An agent should reliably pick the right tool.
Names are uniformly snake_case and mostly follow verb_noun (list_series, find_models, decode_vin, get_diagram, search_parts, describe_schema). A few deviate to noun phrases (part_info, fluid_capacities, sql_query) and get_diagram_image nests a noun, but the overall convention is readable and predictable.
Twelve tools is well within the sweet spot and each maps to a real step in the parts-catalog workflow (identify vehicle → browse groups → diagram → part lookup → usage). The two generic SQL tools act as a deliberate escape hatch rather than bloat.
The surface covers the full lifecycle from series/VIN identification through diagrams, part details, supersessions, and where-used, plus a SQL fallback for anything missed. Minor gaps remain—no dedicated part-number-first lookup distinct from part_info, no explicit diagram search by name, and no structured filtering by production date outside of SQL—but these are workable.