Repository navigation
B280-olca-MCP 2.0.0 #2
Below280-Tom
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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
olcabasic_runcode), or check it without touching openLCA (dry_run). Returnsok,text,data(the structured result of every command,RESULTqueries included, in the shapeolcabasic.Sessiongives Python),errors,warningsolcabasic_helpHELPolcabasic_resetVALIDATEis checked again before it is calculatedOne 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=1brings 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=1addspython_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 starting00:), 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 passesVALIDATE. Numbers the code works out itself are labelled as not olcaBASIC results. It runs Python in the server process withsession,engineandclientin scope, under the same lock, with a time limit. Every call must give awhy_not_basicreason 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.
olcabasic_run,olcabasic_help,olcabasic_resetOLCA_MCP_LEGACY_TOOLS=1, or move toolcabasic_run(MIGRATION.md)LOCATION "code"to the line, orPROVIDER "uuid""EF v3.1", not"EF").FIND METHOD "text"lists themDATABASE FAMILY "ecoinvent"or"flcac"(normally detected on connect)VALIDATEpassesVALIDATEBY 10%PARAMETERISE PROCESS "name" CONFIRM: refused withoutCONFIRM, and the refusal says how many amounts would change and to back up firstCONFIRM.ALL(elementary flows too) asks twice at the olcaBASIC terminal and is refused through the MCPBRIDGE "Cement", kg/PROVIDER "name" LOCATION "code"/END BRIDGE, thenINPUT USE PROCESS "BRIDGE | Cement | kg", ...MAKE PROCESSblock sent again after it was changedEDIT PROCESS "name" ... END EDIT, orDELETE PROCESSand build againVALIDATEDELETE SYSTEM,SYSTEM,VALIDATEOUTPUT "name"that matches no flowOUTPUT MAKE FLOW "name", ...CALCULATE ... IGNORE FACTORS "flow"once the user agreesUNCERTAINTY ...on the uncertain linesALLOCATE PHYSICALorECONOMICwith no factors on a multi-product processALLOCATION ... END ALLOCATIONin the process, orALLOCATE NONEMAKE METHODrows_omitted); the data is only dropped if that is not enoughTOP n, aCATEGORY, orSAVE "file.csv"from b280_olca_mcp.functions import LCAFunctionsDeprecationWarningfrom olcabasic.engine import Enginemcp,olca-ipcmcp,olcabasic(which bringsolca-ipc)pip install --upgrade b280-olca-mcpThe 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:CALCULATEleaves its result open andRESULTqueries 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 onolcabasic_reset.FIND,SHOW(also as JSON-LD and with where it is used),DELETEandMOVEfor actors, sources, currencies, locations, unit groups, flow properties, social indicators, data quality systems, impact methods, projects, stored results and EPDs, andMAKEblocks for most of them.EPD SAVE, representativeness ratings and the data quality register and table, biogenic carbon balances, group sensitivity, the model written out for a verifier.olcabasic_helpcovers 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. WithPROGRAMME "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, the electricity hierarchy, sub-national grids, cut-off limits, proxy data limits and data age.What stays a conversation is deciding which item of the inventory belongs in which module. The instructions keep that step and nothing else of the old workflow.
Smaller things
tests/: 152 offline tests, including the version 1 server tests run with the legacy flag on and the shortcut suite (tests/test_shortcuts.py): 27 programs that each try one way round a rule, sent througholcabasic_run, each refused with a line and a hint and the database unchanged. They run against a fake openLCA client, so no database is needed.This discussion was created from the release B280-olca-MCP 2.0.0.
All reactions