Skip to content

Releases

B280-olca-MCP 2.0.0

Choose a tag to compare

@Below280-Tom Below280-Tom released this 24 Nov 23:11
6e730d7

Release notes: v2.0.0

Prepared 12/11/2026. Not yet released.

Version 2.0 turns the package inside out. Up to 1.16 the engine that talks to openLCA lived here and olcaBASIC depended on it. Now the engine lives in olcaBASIC, and this server is a thin layer that runs olcaBASIC programs. The reason is enforcement: 1.16 shipped about 550 lines of instructions telling the assistant what not to do, and an assistant can ignore instructions. A language cannot be talked out of a refusal.

Since the first draft of this release, olcaBASIC 0.4.0 has grown to reach every method of openLCA's IPC server, 17 of its 18 entity types and every field of a process, and the remaining ways of building a model wrongly without an error have become errors. This server passes all of it through: see "What the assistant can now do" and the second half of the behaviour table.

Needs olcaBASIC 0.4.0 and Python 3.11 or later. MIGRATION.md covers the move for people who call the old tools or import LCAFunctions.

Three tools

Tool Purpose
olcabasic_run Run an olcaBASIC program (code), or check it without touching openLCA (dry_run). Returns ok, text, data (the structured result of every command, RESULT queries included, in the shape olcabasic.Session gives Python), errors, warnings
olcabasic_help The command reference: overview, a topic, or one command. Generated from the same registry as olcaBASIC's HELP
olcabasic_reset Clear the session's variables, scenarios and active EPD. The database is not touched. It does not get round a rule: a product system changed before a reset is still out of date after it, and a system that failed VALIDATE is checked again before it is calculated

One session lasts as long as the server: variables, the current folder, scenarios and the latest results carry over between calls. Calls run one at a time, so product systems are never created in parallel.

The server starts without openLCA. The first call that needs it connects, and says what to do if it cannot.

Two flags, both off by default

  • OLCA_MCP_LEGACY_TOOLS=1 brings back the 36 typed tools of version 1. They call the engine directly and skip every rule the language enforces; each tool's description now starts by saying so.
  • OLCA_MCP_ALLOW_PYTHON=1 adds python_exec, for what olcaBASIC cannot express. Reading and calculating are free, and the code can call R, Fortran or any other program. Its writes are checked: only in model folders (top folder starting 00: ), never on background data, each listed in the reply, and every product system they touch is marked out of date until it is built again and passes VALIDATE. Numbers the code works out itself are labelled as not olcaBASIC results. It runs Python in the server process with session, engine and client in scope, under the same lock, with a time limit. Every call must give a why_not_basic reason and is logged to ~/.olcabasic/python_log.jsonl.

Behaviour changes

Each of these used to pass quietly, or depended on the assistant following its instructions. Each is now an error from the language, with the line and what to type instead.

Change 1.16 2.0 What to do
Tools 36 typed tools olcabasic_run, olcabasic_help, olcabasic_reset Nothing if you chat with an assistant. For clients written against the old tools: OLCA_MCP_LEGACY_TOOLS=1, or move to olcabasic_run (MIGRATION.md)
A process name that matches several processes The instructions asked the assistant not to choose; the tool took the first Error listing the location and UUID of each Add LOCATION "code" to the line, or PROVIDER "uuid"
Impact method names Part of a name was enough if it matched one method The full name is required; a near miss lists the close matches Use the full name ("EF v3.1", not "EF"). FIND METHOD "text" lists them
Building before the database family is known Went ahead with ecoinvent flow property names Refused DATABASE FAMILY "ecoinvent" or "flcac" (normally detected on connect)
Calculating a system that failed validation Allowed Refused for the rest of the session, until VALIDATE passes Fix the links, or delete and rebuild the system, then VALIDATE
Sensitivity without a range Varied by 20% Parse error Say the range: BY 10%
Tier 1 model check The instructions asked the assistant not to present it as proof The output always ends by saying it checked structure only Nothing
Defaults (allocation, linking, top n, runs) Applied silently Stated in the output the first time each is used Nothing
Parameterising a database process The instructions asked the assistant to warn about backups first PARAMETERISE PROCESS "name" CONFIRM: refused without CONFIRM, and the refusal says how many amounts would change and to back up first Back up the database, then add CONFIRM. ALL (elementary flows too) asks twice at the olcaBASIC terminal and is refused through the MCP
EPD modelling Seven steps of advice in the instructions Commands that refuse a wrong module set, a wrong method, a background process used directly, and a programme rule that is broken See "EPDs" below
A background process used straight in a process The instructions asked for bridges in EPD models Error everywhere, with the bridge to write. No opt-out BRIDGE "Cement", kg / PROVIDER "name" LOCATION "code" / END BRIDGE, then INPUT USE PROCESS "BRIDGE | Cement | kg", ...
A MAKE PROCESS block sent again after it was changed The old process stayed, with a warning the assistant could miss Error listing the differences. An identical block is still a quiet no-op EDIT PROCESS "name" ... END EDIT, or DELETE PROCESS and build again
Calculating after a process was edited, linked, moved or parameterised Allowed: the product system kept its old links Refused until the system is built again and passes VALIDATE DELETE SYSTEM, SYSTEM, VALIDATE
One EPD module using another module's process Warning; counted twice Error Give the module its own input
OUTPUT "name" that matches no flow Created the flow, with a note Error OUTPUT MAKE FLOW "name", ...
A new emission the method has no factor for Added zero without a word Every calculation refused, naming the flow Use a flow the method knows, or CALCULATE ... IGNORE FACTORS "flow" once the user agrees
Monte Carlo on a model with no uncertainty Ran, and said every run was the same Error before the runs start UNCERTAINTY ... on the uncertain lines
ALLOCATE PHYSICAL or ECONOMIC with no factors on a multi-product process Calculated without sharing anything out Error naming the process ALLOCATION ... END ALLOCATION in the process, or ALLOCATE NONE
Changing an impact method olcaBASIC did not make Possible through the typed tools Refused through the MCP: it needs a person at the olcaBASIC terminal Make a method of your own with MAKE METHOD
A reply that is too long The structured data was dropped Tables are cut to their first 50 rows first (rows_omitted); the data is only dropped if that is not enough Ask for less: TOP n, a CATEGORY, or SAVE "file.csv"
from b280_olca_mcp.functions import LCAFunctions The engine A shim: works, with a DeprecationWarning from olcabasic.engine import Engine
Dependencies mcp, olca-ipc mcp, olcabasic (which brings olca-ipc) pip install --upgrade b280-olca-mcp
Python 3.10 declared (3.11 needed in practice) 3.11 declared Use 3.11 or later
Instructions resource About 550 lines 144 lines: how to talk to the user and present results. The rules are in the language, and the instructions say there is no way round a refusal Nothing

The legacy tools, when switched on, behave as they did in 1.16: none of the changes in this table applies to them.

What the assistant can now do

Everything olcaBASIC 0.4.0 can, through olcabasic_run:

  • Read more from a result. CALCULATE leaves its result open and RESULT queries it: contributions by process and by elementary flow, where one emission comes from, characterisation factors, intensities, scaling factors, total requirements, upstream trees, costs, normalised and weighted results, results by analysis group, Sankey data. Each query comes back as structured data. A result stays open between calls and is disposed on olcabasic_reset.
  • Write every field of a process. Uncertainty distributions, avoided products, costs, allocation factors, the 26 documentation fields, social aspects, process type; parameter sets and analysis groups on product systems.
  • Work with every entity type. FIND, SHOW (also as JSON-LD and with where it is used), DELETE and MOVE for actors, sources, currencies, locations, unit groups, flow properties, social indicators, data quality systems, impact methods, projects, stored results and EPDs, and MAKE blocks for most of them.
  • Finish an EPD in openLCA. EPD SAVE, representativeness ratings and the data quality register and table, biogenic carbon balances, group sensitivity, the model written out for a verifier.

olcabasic_help covers all of it from olcaBASIC's command registry (133 commands); the overview is about 1,050 tokens.

EPDs

EPDs to EN 15804+A2 are now olcaBASIC commands (olcaBASIC 0.4.0): EPD ... END EPD, MODULE ... TOTAL ... END MODULE, EPD SYSTEMS, EPD CHECK, EPD CALCULATE, EPD DATA QUALITY, EPD REPORT. The standard's module rules are checked as the EPD block is read. With PROGRAMME "IES" the rules of the International EPD System (General Programme Instructions 5.1.0, Annex A) apply as errors with no override: data declarations on every process and bridge, ...

Read more

v1.14.0

Choose a tag to compare

@Below280-Tom Below280-Tom released this 06 Sep 23:54

What's in this release

Input validation hardening and two bug fixes. No new features, no breaking changes. Every previously valid call behaves identically, the only difference is that malformed inputs now get a clear error instead of silently creating bad data.

Bug fixes

  • Waste bridges were silently broken. create_bridge with waste=True was passing the value to the wrong parameter (provider_flow_id instead of waste), so waste bridges were always created as product bridges. If you've already built waste treatment bridges through the MCP, please check them, they're wired as products.
  • edit_process could remove the quantitative reference exchange, leaving a process that openLCA can't calculate. Now blocked unless a replacement qref is added in the same call.

Input validation

  • Category path traversal (HIGH): ../../etc/passwd and similar strings rejected in all category fields across create_flow, create_bridge, create_process, edit_process, extract_model, create_product_system.
  • Parameter name validation (MEDIUM): empty names and non-alphanumeric names (e.g. import os; os.system('rm -rf /')) now rejected in create_process and edit_process.
  • Negative qref amounts (MEDIUM): create_process now rejects negative amounts on quantitative reference exchanges.
  • Formula validation (MEDIUM): formulas are now checked against openLCA's expression grammar. Code-like strings such as import('os').system('whoami') are rejected.
  • UUID validation (MEDIUM): provider_id on create_bridge now requires valid UUID format.
  • Limit bounds (LOW): search_processes and search_flows return an error for limit <= 0 instead of silently defaulting to 20.
  • Monte Carlo iterations (LOW): monte_carlo rejects iterations <= 0.
  • Empty scenarios (LOW): run_scenarios rejects an empty scenarios dict.

Schema fix

  • provider_flow_id added to the create_bridge tool schema (was supported by the function but missing from the MCP tool definition).

Upgrade

pip install --upgrade b280-olca-mcp

v1.13.2

Choose a tag to compare

@Below280-Tom Below280-Tom released this 06 Sep 11:41

v1.13.2

Everything that's changed since v1.11. This is a significant structural release.

MCP resources

The server now exposes four MCP resources that AI clients can read on demand:

  • Assistant instructions (lca://knowledge/instructions) — operational rules, workflows, EPD building guidance, and conventions. This is the knowledge base that shapes how the AI assistant behaves.
  • IPC protocol reference (lca://knowledge/ipc-protocol) — complete JSON-RPC spec for all 60 openLCA IPC methods, with parameter formats, response structures, and curl examples. Enables the assistant to generate working client code for any programming language.
  • openLCA resources (lca://knowledge/openlca-resources) — curated links to databases, documentation, forums, tutorials, and training. The assistant draws on this when users ask where to learn or find data.
  • Database info (lca://database/info) — live database overview.

EPD model building workflow

The assistant instructions now include a full guided workflow for building EN15804 EPD models from LCI data. The AI maps LCI items to lifecycle modules (A1–D), creates the folder structure, bridge processes, module processes, and product systems. Triggered by asking 'build an EPD from this LCI'.

Standalone script generation

After running scenario or sensitivity calculations, the server now instructs the assistant to offer standalone Python scripts that do the same analysis without AI tokens. It generates the CSV input file and links to the tested scripts in the openLCA-IPC-tools-python repository. For heavy database operations (batch creates, mass renames, database parameterisation), the assistant offers to generate a custom Python script rather than chaining dozens of MCP tool calls.

Integration with Below280 repositories

The server now formalises links to the other Below280 openLCA repositories. The assistant instructions reference tested implementations for Python, R, and Fortran, and can direct users to the right repo for their language or workflow. For languages without a tested client, the assistant generates experimental code from the embedded IPC protocol spec.

IPC protocol reference

A new embedded reference (ipc_reference.py) documents all 60 openLCA JSON-RPC IPC methods with parameter formats, response structures, and curl examples. This serves two purposes: it enables the assistant to generate client code for any language, and it acts as a single-file connector to the upstream openLCA API so the assistant knows the full set of IPC capabilities available, including any that the MCP server doesn't yet wrap as tools.

Database family auto-detection

database_info now auto-detects whether the connected database is ecoinvent-family (ecoinvent, EN15804GD, HiQLCD, BAFU) or FLCAC-family (LCA Commons, US LCI, USEEIO) by checking which flow property names are present. Users no longer need to specify the family manually unless auto-detection is inconclusive. Once set, the mapping drives unit and flow property resolution for all model building tools.

openLCA resources reference

A new separate module (openlca_resources.py) serves a curated, maintained link list covering databases (Nexus, ecoinvent, LCA Commons, GLAD, Tian Gong, BAFU), documentation (openLCA manual, API docs), forums (ask.openlca.org, Reddit), tutorials, case studies, and training courses. The assistant draws on this when users ask where to learn openLCA, find LCA data, or get help, rather than relying on training data that may be out of date.

Auto-parametrisation naming convention

create_process auto-parametrises every bare exchange amount using a double-underscore naming convention:

NN_processname__flowname_unit

The double underscore between process name and flow name keeps the boundary visually distinct. Each segment is truncated to 10 characters, with spaces and commas normalised to underscores. The two-digit index prefix guarantees uniqueness within a process.

Tool annotations

Every tool now carries MCP ToolAnnotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so clients can auto-approve safe operations and prompt for destructive ones. Six annotation presets: READONLY, WRITE, DESTRUCTIVE, CALCULATE, FILE_WRITE, EXTERNAL.

Help tool

New help tool with optional topic filter (explore, build, audit, calculate, scripting, epd, connect). Gives users a structured overview of what the server can do without reading the full documentation.

Structural changes

  • MCP 2.x handler API: migrated from @self.server.list_tools() decorators to add_request_handler().
  • Tool count: 30 → 31.
  • get_system_links moved from Build to Audit.
  • Documentation (tools.md, README) restructured to match: Explore (11), Build (6), Audit (5), Calculate (8), Meta (1).
  • pyproject.toml now derives its version dynamically from b280_olca_mcp/__init__.py.

Security fix

The CSV tools (scenarios_csv, sensitivity_csv) now validate all file paths through validate_file_path, which resolves the path and blocks directory traversal attempts. Previously, file paths from tool arguments were passed through without validation.

Bug fix

Fixed a duplicate annotations= keyword on the set_database_family tool definition that caused a SyntaxError on startup with some Python versions.

Tested with openLCA 2.6

All calculation patterns retested against openLCA 2.6 with ecoinvent databases.

Install

pip install --upgrade b280-olca-mcp

PyPI · MCP Registry · Tool reference

v1.11

Choose a tag to compare

@Below280-Tom Below280-Tom released this 03 Sep 12:05

Addition of CONTRIBUTING and SECURITY to all repos
Minor accuracy improvements to README files
Fixed minor typos in filenames

v1.1: Bug fixes, PubChem synonyms, bridge fix

Choose a tag to compare

@Below280-Tom Below280-Tom released this 03 Sep 08:18

v1.1: Bug fixes from testing, PubChem synonyms, bridge fix

Critical fixes:
Fixed bridge processes: now creates two exchanges (background input + bridge output) instead of one dead-end exchange
Fixed duplication: create_flow, create_process, create_bridge return existing entity if same name/category already exists
Fixed monte_carlo: constructor arg fix, variable shadowing in dispose(), zero-variance detection with warning
Fixed get_system_links: search_term filter, connection error handling for large systems
Fixed orphaned parameter false positive: now checks parameter-to-parameter formula chains
Fixed delete_entity: client.delete() takes entity object not type+id
Fixed CSV output path: results now written next to input file, not Claude Desktop's working directory

New features:
Added chemical_synonyms tool (PubChem lookup, 30 tools total)
Added edit_process: update/remove exchanges, location, provider changes
Added location and exchange comments to create_process
Added location_filter to search_processes
Added database family detection (ecoinvent vs FLCAC)

Improvements:
Hardened CSV parsing for European locale decimal separators
Descriptor cache now per-key expiry, cleared after create/delete operations
Response wrapper de-branded (no directive language in tool output)
validate_system lightweight by default (test calculation opt-in)
Audit findings include flow_id and amounts for diagnostics
Duplicate exchange and description warning detection in audit_model
Three-tier model checking guidance in instructions
Updated README and docs for 30 tools, multi-client setup (Claude Desktop, Cursor, VS Code)

Tested against ecoinvent 3.11, EN15804GD, and US Federal LCA Commons (FLCAC).
All bugs from testing resolved and independently verified.
Testers: Gladys Castillo and Tom Bradley