Skip to main content
Glama
tryton-stock-mcp

tryton-stock-mcp

by SamuelBalbas

Tryton Stock MCP

Tryton Stock MCP is a read-only Model Context Protocol server for investigating product, lot, location and stock-movement history in Tryton 6.x.

It turns questions such as “audit the complete history of product X” into a structured investigation covering movement states, lots, incoming shipments, outgoing shipments, internal transfers, locations, official contextual quantities and derived diagnostic balances.

Safety model

  • The MCP tools expose no create, write, delete or workflow RPC methods.

  • Credentials are read only from environment variables.

  • Tool logs contain metadata only: tool name, status, duration and error type.

  • Record searches are restricted to product and stock-related models.

  • describe_model may inspect metadata for any model, but it does not read records.

  • Derived balances are investigative evidence, not official Tryton stock.

Use a dedicated Tryton account with read-only, least-privilege access. This project does not make a write-capable account safe. Avoid sending clinical or personal data to an MCP client unless its privacy properties are acceptable for your environment.

Related MCP server: Odoo Pulse

Requirements

  • Python 3.10 or newer

  • Tryton 6.x with JSON-RPC enabled

  • Read access to product and stock models

pipx installs the MCP in its own isolated Python environment and exposes the tryton-stock-mcp command globally.

If pipx is not installed yet:

python -m pip install --user pipx
python -m pipx ensurepath

Open a new terminal after ensurepath so the installed commands are available.

Install directly from GitHub:

pipx install "git+https://github.com/SamuelBalbas/tryton-stock-mcp.git"

Or install from a local clone while developing:

git clone <your-fork-or-repository-url> tryton-stock-mcp
cd tryton-stock-mcp
pipx install .

Run the server:

tryton-stock-mcp

Upgrade or uninstall it:

pipx upgrade tryton-stock-mcp
pipx uninstall tryton-stock-mcp

When a PyPI release becomes available, installation can be shortened to pipx install tryton-stock-mcp.

Development installation

The repository-local workflow remains available for contributors and troubleshooting:

git clone <your-fork-or-repository-url> tryton-stock-mcp
cd tryton-stock-mcp
python -m venv .venv

Windows PowerShell:

.venv\Scripts\Activate.ps1
python -m pip install -e ".[dev]"

Linux or macOS:

source .venv/bin/activate
python -m pip install -e ".[dev]"

Configure

The server reads its configuration from the process environment. .env.example is a reference file; it is not loaded automatically.

Required variables:

Variable

Purpose

TRYTON_DATABASE

Tryton database name

TRYTON_USER

Dedicated read-only user

TRYTON_PASSWORD

User password

Optional variables:

Variable

Default

Purpose

TRYTON_HOST

localhost

Tryton host

TRYTON_PORT

8000

JSON-RPC port

TRYTON_PROTOCOL

http

http or https

TRYTON_TIMEOUT

30

Request timeout in seconds

TRYTON_AUDIT_LOG_ENABLED

true

Enable metadata-only local logging

TRYTON_AUDIT_LOG

./logs/mcp_actions.jsonl

Log destination

TRYTON_ALLOW_INSECURE_REMOTE

false

Permit HTTP to a non-local host

Remote HTTP is rejected unless explicitly enabled. HTTPS is strongly recommended whenever Tryton is not running on the same machine.

Run from a development checkout

python -m tryton_stock_mcp

The server uses MCP stdio, so normal output must not be written to stdout.

MCP client configuration

With the recommended pipx installation, the client only needs the installed command and the Tryton environment variables:

{
  "mcpServers": {
    "tryton-stock": {
      "command": "tryton-stock-mcp",
      "args": [],
      "env": {
        "TRYTON_HOST": "localhost",
        "TRYTON_PORT": "8000",
        "TRYTON_DATABASE": "your_database",
        "TRYTON_USER": "readonly_auditor",
        "TRYTON_PASSWORD": "replace_me",
        "TRYTON_PROTOCOL": "http"
      }
    }
  }
}

If the MCP client does not inherit the shell PATH, use the absolute path reported by pipx environment or pipx list. For a development checkout, use the virtual environment's absolute Python path with the arguments -m tryton_stock_mcp.

Guided audit

The main tool is audit_product_history.

Inputs:

  • product_query: product name or code, or

  • product_id: exact Tryton product variant ID

  • lot_number: optional lot filter

  • include_cancelled: include cancelled movements, default true

Exactly one of product_query or product_id is required. When a query matches multiple products, the tool returns needs_product_selection with candidates; the caller must choose one before the full audit runs. Lots follow the same rule.

The successful result includes:

  • every matching movement, retrieved in bounded pages until exhaustion;

  • counts for done, draft, staging, assigned, cancelled and other states;

  • incoming, outgoing, internal and other workflow counts;

  • shipments and origins exposed by stock.move;

  • registered, missing and cross-product lot evidence;

  • pending movements and effective-date inconsistencies;

  • official product quantities for internal locations;

  • chronological derived balances and first-negative evidence;

  • a concise Markdown report plus complete JSON evidence.

Additional tools

The server also exposes focused tools for searching products, lots, locations and moves; finding pending moves; reconstructing ledgers; comparing products; querying official quantities; and generating generic product or move reports.

search_reference_globally is intentionally restricted to the approved stock models. describe_model is the only tool that accepts any Tryton model name, and it returns field metadata only.

Diagnostic limits

Tryton's official stock calculation depends on context, company, locations and date. The MCP reports official contextual quantity separately from balances it reconstructs by adding completed incoming movements and subtracting completed outgoing movements. Never use a reconstructed balance as an automatic inventory adjustment.

Development

python -m pip install -e ".[dev]"
python -m pytest

Tests use synthetic JSON-RPC responses and do not require a live database.

License

Apache License 2.0. See LICENSE.

Available Tools

23 tools
analyze_stock_move_root_causeB

Collect read-only causal context around one stock move.

Inputs: move_id (required). Returns: object

audit_product_historyB

Audit a product's complete stock history by name, code or ID.

If a name or lot matches multiple records, the result asks the caller to choose one candidate before the full audit runs.

Inputs: lot_number, product_id, product_query, include_cancelled. Returns: object

compare_products_stock_historyC

Compare movement histories for multiple product variants.

Inputs: product_ids (required), limit. Returns: object

describe_modelA

Describe fields for any model; this returns metadata, not records.

Inputs: model_name (required). Returns: object

find_negative_lot_location_balancesC

Find negative derived balances across products, lots and locations.

Inputs: product_ids (required). Returns: object

find_non_done_movesB

Find moves that are neither done nor cancelled.

Inputs: limit, lot_id, product_id. Returns: object

generate_move_root_cause_reportB

Return JSON evidence and Markdown for one stock move investigation.

Inputs: move_id (required). Returns: object

generate_product_negative_stock_reportC

Return JSON evidence and Markdown for negative derived balances.

Inputs: product_ids (required), reference. Returns: object

generate_product_stock_audit_reportC

Return a comparative stock audit as JSON and Markdown.

Inputs: product_ids (required), reference. Returns: object

get_location_detailB

Return relevant information for one stock location.

Inputs: location_id (required). Returns: object

get_lot_detailC

Return identifying information for one stock lot.

Inputs: lot_id (required). Returns: object

get_official_product_quantityC

Read Tryton's contextual product quantity for one location.

Inputs: product_id (required), location_id (required). Returns: object

get_product_detailB

Return relevant fields for one product variant.

Inputs: product_id (required). Returns: object

get_stock_move_detailB

Return principal and diagnostic fields for one stock move.

Inputs: move_id (required). Returns: object

get_tryton_contextB

Check the configured connection and required Tryton model access.

Inputs: no named parameters. Returns: object

reconstruct_product_stock_ledgerC

Reconstruct a chronological diagnostic ledger from stock moves.

Inputs: product_id (required), limit, lot_id, lot_scope, +2 more. Returns: object

search_locationsA

Search stock locations by name, code or type.

Inputs: limit, query. Returns: object

search_lotsC

Search stock lots by text and/or product.

Inputs: limit, query, product_id. Returns: object

search_productsA

Search product variants by name or code.

Inputs: query (required), limit. Returns: object

search_reference_globallyB

Search a textual reference across the approved stock-audit models.

Inputs: reference (required), limit, models. Returns: object

search_stock_movesC

Search stock moves with product, lot, state and location filters.

Inputs: limit, state, lot_id, product_id, +2 more. Returns: object

summarize_product_location_flowsC

Summarize entries, exits and internal location flows for a product.

Inputs: product_id (required), limit. Returns: object

summarize_product_movesC

Summarize a product's movement history and suspicious signals.

Inputs: product_id (required), limit. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 23 tools

    Disambiguation3/5

    Core entity tools (search/get for products, lots, locations, moves) are clearly separated, but the audit/summary/report cluster overlaps: audit_product_history, summarize_product_moves, reconstruct_product_stock_ledger, and generate_product_stock_audit_report all deal with product movement history and could be misselected. Descriptions help, but boundaries are not crisp.

    Naming Consistency4/5

    All names are snake_case verb_noun and follow a predictable pattern: search_/get_ for entity lookups, find_ for exceptions, generate_ for reports. Minor deviations like search_reference_globally and long compound names are still clear.

    Tool Count3/5

    23 tools is on the heavy side and above the typical well-scoped range. Most tools have a distinct purpose, but the many report/audit variants inflate the surface without adding entirely new capabilities.

    Completeness4/5

    The read-only audit domain is well covered: search/detail for products, lots, locations, moves, plus summaries, negative-balance checks, root-cause analysis, and reports. A few gaps remain, such as a general current-balance listing by lot/location and a way to enumerate all records without search filters.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Connects to Odoo ERP to provide comprehensive inventory analysis, including demand forecasting, ABC/XYZ classification, and stock level monitoring. It enables users to identify slow-moving items and generate turnover or aging reports through natural language queries.
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      An AI business analyst for your Odoo ERP. Ask one question, get one answer — numbers, highlights, risks, and a verdict (on-track / at-risk / off-track) — over the Model Context Protocol. CRUD bridges to Odoo already exist; this is the analytics layer that sits on top.
      31
      62 PyPI
      1
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables read-only investigation of NOVA's Dolibarr accounting and commercial data through an AI assistant, with privacy protection and deterministic accounting rules.
      -
    • F
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to securely access and perform CRUD operations on Odoo data through natural language, with granular permissions and dual REST/XML-RPC support.
      -