Skip to main content
Glama
README.md
# `parts-mcp` - KiCAD to TME cart and InvenTree inventory 

> **Unofficial hobby project. Not affiliated with, endorsed by or supported by TME.**
> No warranty, no responsibility for how it is used. See the [Disclaimer](#disclaimer).
> **WARNING** This MCP was FULLY vibe-coded. Later tested on my own setup (with success).

A local [MCP](https://modelcontextprotocol.io) server that lets Claude (Desktop / Cowork / Claude Code)
turn a KiCad BOM into a checked, priced **TME Quick Buy file**, and keep a local **InvenTree**
inventory, so you don't buy parts you already have.

```
KiCad (.kicad_sch / .net / .csv) ──bom_read──► consolidated lines (need + spares)
                                      │
            InvenTree ◄──inv_check_bom┘   (what's already in the drawers?)
                                      │
TME API v2 ◄─tme_lookup_mpns / tme_search / tme_parameters (match each line to a TME symbol)
                                      │
            tme_quote  ── MOQ, multiples, price breaks, stock, status flags
                                      │
            tme_export_quickbuy ──► orders/<name>.csv  ──► tme.eu Quick Buy ──► cart (you check out)
                                      │
   after delivery: inv_receive ──► InvenTree (part + TME supplier part + MPN + stock item)
```

**It can't place orders.** TME's API has no basket or order endpoints, and this server doesn't
try anything else. You upload the generated file in Quick Buy, review it, and check out yourself.

## Tools

| Tool | What it does |
|---|---|
| `parts_status` | Shows config (no secrets) and tests the TME and InvenTree connections |
| `bom_read` | Reads `.kicad_sch` (via `kicad-cli`, or a direct parser for single-sheet schematics), KiCad `.net` or CSV files, several boards at once with board multipliers. Groups lines by MPN, then TME symbol, then value+package. Adds spares. Lists excluded test points, pads and DNP parts |
| `tme_lookup_mpns` | Matches MPNs to TME symbols in bulk (exact / fuzzy / not_found), with MOQ, multiples, stock and price tiers |
| `tme_search` | Catalogue search (e.g. `100k 0603 1%`, in stock only) |
| `tme_parameters` | Technical parameters, to confirm generic passives |
| `tme_products`, `tme_prices_stock`, `tme_delivery`, `tme_alternatives`, `tme_datasheets` | Details, live stock and your prices, delivery estimates, substitutes, documents |
| `tme_quote` | Prices a list the way TME will sell it: rounds to MOQ and multiples, applies price tiers, moves to the next price break when that costs no more, and flags stock shortages and statuses like `NOT_IN_OFFER` |
| `tme_export_quickbuy` | Writes `<name>.csv` for Quick Buy (`SYMBOL;QTY` per line, no header, LF, the same shape as TME's own cart export) and an optional `<name>-review.csv` for you to read. Upload only the first one. Never overwrites an existing file |
| `inv_check_bom` | Checks BOM lines against stock: exact matches by TME symbol or MPN; value+package lines only return candidates for you to confirm |
| `inv_find`, `inv_structure` | Finds parts, lists locations and categories |
| `inv_receive` | Books a delivery: creates the part, TME supplier part and manufacturer part if missing, then adds a stock item (`qty` 0 creates only the part cards, no stock). Dry run by default; `confirm=true` also needs `INVENTREE_ALLOW_WRITE=1` |

## Setup (macOS)

1. **TME API credentials.** At [developers.tme.eu](https://developers.tme.eu), sign in with your
   tme.eu account and create an application. You get an **app token** (50 chars) and an **app secret**
   (20 chars). Apps created after 14 May 2026 work only with API v2, which this server uses.

2. **Install [uv](https://docs.astral.sh/uv/)** (`brew install uv`). Note its path: `which uv`.

3. **Create the config file** `~/.config/parts-mcp/.env` and run `chmod 600` on it:

   ```bash
   mkdir -p ~/.config/parts-mcp && cp .env.example ~/.config/parts-mcp/.env
   chmod 600 ~/.config/parts-mcp/.env && open -e ~/.config/parts-mcp/.env
   ```

4. **Install the dependencies once**, so the first start in Claude isn't slow:
   `uv --directory /path/to/parts-mcp sync` (the folder you cloned this repo into)

5. **Register the server with Claude Desktop.** Go to Settings → Developer → Edit Config
   (`~/Library/Application Support/Claude/claude_desktop_config.json`):

   ```json
   {
     "mcpServers": {
       "parts": {
         "command": "/opt/homebrew/bin/uv",
         "args": ["--directory", "/path/to/parts-mcp", "run", "parts-mcp"]
       }
     }
   }
   ```

   Use the absolute path from `which uv`, and the absolute path of your clone in place of
   `/path/to/parts-mcp`, then restart Claude Desktop.

6. Ask Claude to run `parts_status`.

Claude Code alternative: `claude mcp add parts -- uv --directory /path/to/parts-mcp run parts-mcp`

## Configuration (`~/.config/parts-mcp/.env`)

| Variable | Default | |
|---|---|---|
| `TME_APP_TOKEN`, `TME_APP_SECRET` | — | Required for TME tools |
| `TME_COUNTRY` / `TME_CURRENCY` / `TME_LANGUAGE` | `PL` / `PLN` / `en` | |
| `TME_MIN_INTERVAL` | `0.25` | Seconds between API calls. TME doesn't publish a rate limit, and 429/5xx responses are retried with backoff |
| `INVENTREE_URL`, `INVENTREE_TOKEN` | — | Required for `inv_*` tools |
| `INVENTREE_ALLOW_WRITE` | `0` | Must be `1` for `inv_receive confirm=true` |
| `INVENTREE_SUPPLIER_NAME` | `TME` | Supplier company used for TME supplier parts |
| `PARTS_EXPORT_DIR` | `~/Projects/parts-orders` | Where Quick Buy files are written |
| `PARTS_ALLOWED_ROOTS` | `~/Projects` | `bom_read` only reads below these (`:`-separated) |
| `KICAD_CLI` | `/Applications/KiCad/KiCad.app/Contents/MacOS/kicad-cli` | Used for `.kicad_sch`; without it a direct single-sheet parser is used |

## KiCad conventions that make it work well

- Give every specific part an **`MPN`** field. A **`Manufacturer`** field is optional.
- To force a particular TME product, add a **`TME`** field with the TME symbol.
- Generic passives can stay as value + footprint (e.g. `100k` on `R_0603`). Claude searches TME
  and confirms with `tme_parameters`, using the rules in the skill.
- Mark unpopulated parts **DNP** or exclude them from the BOM. Test points, contact pads, solder
  wire pads and mounting holes are excluded automatically and listed under `excluded`.

## InvenTree

The `inv_*` tools are optional. They work with an InvenTree server that you run yourself; this
repo doesn't include a deployment, so install it with [InvenTree's own instructions](https://docs.inventree.org).
Then create an API token for the user that parts-mcp should act as, and put `INVENTREE_URL` and
`INVENTREE_TOKEN` in the `.env`.

That user needs roles for part, part_category, stock, stock_location and purchase_order (supplier
and manufacturer parts count as purchase_order); a user without a group gets 403 on every endpoint.
The TME supplier company is created on the first `inv_receive` if it doesn't exist yet.

## Development

```bash
uv sync --extra test
uv run pytest                          # unit + mock TME + stdio MCP round-trip
INVENTREE_TEST_URL=http://127.0.0.1:8000 INVENTREE_TEST_TOKEN=... uv run pytest tests/test_inventree_live.py
```

The TME mock follows the shapes in TME's OpenAPI v2 spec (`https://developers.tme.eu/openapi.json`).
The InvenTree tests ran against InvenTree 1.7.2 and 1.7.3 (API v570), with a token whose user has
the roles listed under [InvenTree](#inventree).

## References and prior art

- TME API v2 docs: https://developers.tme.eu/en/api-doc/v2
- [Gitii/tme-mcp](https://github.com/Gitii/tme-mcp) (MIT): a TME-only MCP server (search, prices,
  stock), Docker-first. This project adds BOM reading, quoting, Quick Buy export and inventory.
- InvenTree: https://docs.inventree.org

## Disclaimer

This is an independent hobby project, maintained on a best-effort basis. It is **not affiliated with,
endorsed by, sponsored by or supported by Transfer Multisort Elektronik Sp. z o.o. ("TME")**. TME and
tme.eu are names of their respective owner and are used here only to describe what the software
talks to.

- **Public API only.** The server calls TME's publicly documented developer API with credentials that
  you create yourself on developers.tme.eu. It does not scrape the shop, bypass any protection or
  place orders. You are responsible for reading and following the
  [TME API Terms and Conditions](https://developers.tme.eu/pdfs/en/terms_2026-07-01.pdf) (the version
  dated 2026-07-01 at the time of writing), for the use you make of the data, and for keeping your
  API token and secret private.
- **TME data.** Data powered by TME.eu Data – no guarantee of data accuracy. All intellectual property
  rights to content obtained via the API belong to TME, its subsidiaries, the manufacturers of the goods
  and/or other creators and owners. Prices, stock, MOQs and product details can be wrong or out of
  date: check the Quick Buy file and the cart on tme.eu before you pay. `inv_receive` stores this
  notice as a note on the parts and TME supplier parts it creates (existing records are not changed).
  InvenTree 1.7 keeps notes in a separate Note model (`/api/note/`) instead of a `notes` field on the
  record, and the tool uses that endpoint.
- **No warranty, no liability.** The software is provided "as is", without warranty of any kind. The
  author accepts no responsibility or liability for how you use it, including orders and purchasing
  decisions, incorrect or outdated data, suspension or blocking of your TME API access, or changes
  made to your InvenTree database (also see the [LICENSE](LICENSE)).

## License

MIT

TDQS

B3.4/5.0

Scored across 16 tools

Disambiguation4/5

Tools split cleanly along a workflow (BOM read → search/lookup → details/params/prices → quote/export → inventory check/receive), and prefixes make the TME vs InvenTree boundary obvious. There is mild overlap between tme_products (details, MOQ, status) and tme_prices_stock (stock/price tiers), and tme_products vs tme_lookup_mpns both accept MPNs, but descriptions clarify which to use when.

Naming Consistency4/5

Nearly everything is snake_case with a domain prefix (parts_, bom_, tme_, inv_) and a verb-ish second token, which reads predictably. The only deviations are noun-only names (tme_parameters, tme_datasheets, inv_structure) mixed with verb names like inv_find or tme_search, a minor irregularity rather than a real inconsistency.

Tool Count4/5

16 tools is at the upper end but each covers a distinct step: catalogue search, bulk MPN resolution, parameters, prices, datasheets, alternatives, delivery, quoting, export, plus four inventory tools. Nothing looks redundant enough to be dropped, though the catalogue-side tools could plausibly be consolidated.

Completeness3/5

The procure-to-stock lifecycle is covered end to end (read BOM, resolve MPNs, price/quote, export cart file, check stock, book goods in). Gaps remain: there is no way to adjust or consume existing stock, no order/PO tracking back from TME, and no tool to update or correct an already-created InvenTree part — only creation via inv_receive.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues