Skip to main content
Glama
InvenTree MCP

InvenTree MCP

by eiaro
README.md
# InvenTree MCP

InvenTree MCP is a [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server
for [InvenTree](https://inventree.org). It lets AI assistants such as Claude search,
analyse and, when you allow it, change an existing InvenTree installation through
purpose-built tools.

InvenTree remains the single source of truth. The server talks to InvenTree's REST API
with one service account, keeps no inventory database or cache, and never exposes a
generic REST passthrough.

## What it is for

- **Find parts by what they are, not what they are called.** Search by text, IPN,
  category and InvenTree's native parameter filters with unit conversion, for example
  capacitors of at least 100 nF and 25 V in a given category.
- **Audit your part taxonomy.** Walk the category tree, see which parameter templates are
  assigned directly or inherited, and compare each part's stored values with them.
- **Understand stock and demand.** Read stock items, locations and history, part
  requirements, BOM trees, where-used relationships and material requirements, with
  InvenTree's own stock definitions and exact decimal quantities.
- **Work with suppliers and orders.** Look up manufacturers, suppliers, MPNs and SKUs,
  price breaks, purchase orders, sales orders and build orders.
- **Make controlled changes.** In write mode, the assistant prepares a plan, you review
  and approve it, and the server applies it, checks that nothing changed in the meantime
  and reports the outcome of every step.

## Example requests

These requests map directly to the server's tools:

- "Which parameter templates does the *Capacitors* category expect, and which of them is
  part 1234 missing?"
- "Find 0402 X7R capacitors of at least 100 nF rated for 25 V or more."
- "How much stock of part 1234 do we have, and where is it?"
- "Which assemblies use this resistor, and what do we need to build ten units of the
  main board?"
- "List open purchase orders from this supplier and their outstanding lines."
- With write mode: "Create these three parts in the *Resistors* category and fill in their
  resistance and tolerance parameters." The assistant presents one plan for approval.

## Capabilities

| Mode | Tools | What they do |
|---|---|---|
| Read-only (default) | 50 | Diagnostics, categories, parameters, parts, variants, stock, BOMs, companies, sourcing, pricing, purchase, sales and build orders |
| Write mode (opt-in) | +8 | Plan, apply and verify changes to the same areas |

Write mode is disabled by default. When enabled, every change follows the same steps:

1. A `plan_*` tool validates the request and reads the current state. Nothing is changed.
2. You review the plan summary and approve the whole operation once.
3. `apply_write_plan` or `apply_structure_plan` rechecks the current state, applies the
   steps in order and reports each outcome. Deletions need explicit confirmation.

InvenTree enforces the service account's permissions for every request. The complete
catalog, inputs, outputs and limitations are in the [tool reference](docs/tools.md).

## Quick start

Requirements: an InvenTree server, a service-account API token, and either
[uv](https://docs.astral.sh/uv/) 0.13 or newer, or Docker.

### 1. Create the configuration

Create an InvenTree user for the server, grant it the permissions you want the assistant
to have, and create an API token for it. Then create a dotenv file:

```sh
INVENTREE_BASE_URL=https://inventree.example.com
INVENTREE_API_TOKEN_FILE=/path/to/inventree_api_token   # a file containing only the token
```

All settings are described in the [configuration guide](docs/configuration.md).

### 2. Install

From source, with uv:

```sh
git clone https://github.com/eiaro/inventree-mcp.git
cd inventree-mcp
uv sync --locked
```

Or use the published container image `ghcr.io/eiaro/inventree-mcp:1.0.0`. See the
[deployment guide](docs/deployment.md).

### 3. Connect your MCP client

The server speaks MCP over stdio by default, so the client starts it. For Claude Code:

```sh
claude mcp add inventree -- uv run --directory /path/to/inventree-mcp inventree-mcp --env-file /path/to/.env
```

For Claude Desktop (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "inventree": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/inventree-mcp", "inventree-mcp",
               "--env-file", "/path/to/.env"]
    }
  }
}
```

Other clients, and checking the connection with `get_server_info`, are covered in the
[configuration guide](docs/configuration.md#connecting-an-mcp-client).

### 4. Optional: remote access and write mode

- **Remote access.** `inventree-mcp --transport http` serves the same tools over
  OAuth-protected Streamable HTTP for clients such as claude.ai. See
  [remote access](docs/remote-access.md).
- **Write mode.** Set `INVENTREE_MCP_WRITE_ENABLED=true` and grant the service account the
  matching InvenTree permissions. See
  [write mode](docs/configuration.md#write-mode).

## Supported versions

| Component | Supported |
|---|---|
| InvenTree | 1.7.4 and 1.7.5 (API 570). Other API versions are limited to diagnostics. |
| Python | 3.13 and newer |
| MCP transports | stdio; Streamable HTTP with OAuth 2.1 bearer tokens |

## Documentation

| Topic | Document |
|---|---|
| Configuration, clients and write mode | [docs/configuration.md](docs/configuration.md) |
| Tool reference | [docs/tools.md](docs/tools.md) |
| Container deployment | [docs/deployment.md](docs/deployment.md) |
| Remote access and OAuth | [docs/remote-access.md](docs/remote-access.md) |
| Security model | [docs/security.md](docs/security.md) |
| All documentation | [docs/README.md](docs/README.md) |

## Known limitations

- A plan with dependent steps can apply partially. Steps that succeeded remain in
  InvenTree. Inspect the per-step results and re-read InvenTree before planning again.
- Some InvenTree actions finish in the background. A pending result means the final state
  still needs to be verified with `verify_write_outcome` or a read.
- Mutations are never retried automatically.
- Stock figures carry InvenTree's own meanings. The server does not calculate "usable"
  stock.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for how to contribute and [AGENTS.md](AGENTS.md)
for the development rules. Report vulnerabilities as described in [SECURITY.md](SECURITY.md).
The developer documentation is listed in [docs/README.md](docs/README.md#developer-documentation).

## License

Distributed under the [MIT License](LICENSE). Copyright (c) 2026 Ronny Eia.