stemseal is an MCP server whose goal is to stop small local large language models from guessing when it comes to computation, and instead have them call verified, locked, and reproducible cells.
Purpose Small models are prone to errors in arithmetic and business calculations. stemseal provides a set of small, deterministic functions (called cells, i.e., computational units) that the model finds and calls through MCP tools to obtain reliable results.
Key capabilities
- Cell admission: Every cell must pass pure-function checks (no I/O, no clock, no randomness) and have at least 20 known-answer test cases, after which it is locked with sha256. Once locked it cannot be changed, and fixes are released as new versions.
- Honest refusal when nothing matches: If no suitable cell exists, the model receives an "unavailable" response instead of fabricating an answer.
- MCP tools: Provides four tools: find_cell, call_cell, list_cells, and request_cell.
- Model adaptation: Optionally set STEMSEAL_MODEL, and find_cell will return selection guidance targeting the known weaknesses of that model family, while call_cell will fix common input errors before execution (such as too many candidates, wrapped arguments, and renamed keys).
- Language: If the request contains Korean, guidance is answered in Korean; otherwise in English. This can be fixed with STEMSEAL_LANG=ko or en.
- Demand recording: When find_cell returns empty or a nonexistent cell is called, the demand is recorded in a local ledger (~/.stemseal/ledger.jsonl), including the time, search terms, model name, and the most recent cell; demand can also be submitted proactively with request_cell. Demands for the same computation are merged and counted, and stemseal demand lists them by demand strength. stemseal demand --open <n> first shows the content of the GitHub cell request issue that will be submitted (with phone numbers, email addresses, ID numbers, and long digit strings hidden), and only opens it after consent.
- Update mechanism: stemseal update is the only networked command, and it only downloads. It accepts only numbered cell releases (tag cells-N), whose release.json must be signed by the built-in release key and must not be earlier than the last fetched version; each new cell is re-verified on the local machine for file hash, lock, checker, and all known-answer test cases before it can be used. PublishedWithdrawn computation units are no longer used. Replaced computation unit folders are kept in ~/.stemseal/replaced/ and can be deleted.
- Ledger privacy: STEMSEAL_LOG controls the level of detail recorded. full (default) keeps request sentences (up to 300 characters); minimal keeps only hashes and at most 4 computation-related words, keeps no examples, and for computation unit errors keeps only the exception type; off writes no ledger. Switching to minimal does not affect lines already written; they can be viewed with stemseal ledger and rewritten with stemseal ledger --minimize. Old lines older than 90 days or in files larger than 20MB are moved to ledger.1.jsonl when the MCP server starts.
- Token savings statistics: each computation unit call records tokens consumed and saved in the local ledger. cost is the estimated value of the call written by the model plus the reply read (1 token per 4 ASCII characters, 1 token per Korean or other character); baseline is the number of tokens for the same model to complete the same task without using a computation unit, measured separately by computation unit and model; saved = baseline − cost, negative values remain negative, rejected calls have saved = −cost, and tokens consumed by find_cell are deducted from the total. Measured and estimated values are recorded separately; models without their own measurement use the smallest baseline of other models and are marked as estimate; computation units with no measurement at all are marked as none and are not guessed.
- Isolation and limits: computation units run in a separate python -I process, have a timeout, and are executed only after passing a pure function check. This is process isolation, not an operating system sandbox. The process sets limits before receiving the computation unit: call time limits (wall clock and CPU time), 256 MB memory (not enforced on macOS, time limit only), no subprocesses (requires a normal user on Linux and macOS, root is exempt, stemseal verify will explain), no writing file contents and at most 16 open files (Linux, macOS; creating, truncating, renaming, or deleting files is blocked by the runner's audit hook, not by these limits), no core dumps, lower priority. STEMSEAL_MEM_MB can lower the memory limit, not raise it. If the limits cannot be applied, the computation unit does not run and the call returns not_available.
- Input files: call_cell's input_file only reads .json files no larger than 1MB under ~/.stemseal/inputs (or STEMSEAL_INPUT_DIR), or under the MCP server's startup folder (when that folder is not a drive root, the home directory, or a parent of either). Relative names are looked up first in the inputs folder. When a file cannot be read, the reply gives only the file name and does not expose local folders.
Usage Connect stemseal as an MCP server to any MCP client (such as LM Studio, Claude Desktop, Ollama frontends that support MCP, etc.). Optionally set STEMSEAL_MODEL and STEMSEAL_LANG. Use stemseal update to fetch new computation units, stemseal demand to view demand, stemseal verify to check that computation units are unchanged, and stemseal measure to communicate with a local Ollama for measurement.
Applicable scenarios Suitable for scenarios where a small model (2B or larger recommended) runs locally and reliable business calculations are needed, such as business hours and amount calculations. Officially measured on a 2011 laptop (2-core i5-2430M, no AVX2, no GPU) with exaone3.5:2.4b: of 20 business hours and amount questions, 4 were answered correctly on their own, and 15 were answered correctly after using computation units; all 5 questions with unknown morning/afternoon were asked back to the customer; the number of wrong figures given to customers was 0 (the remaining 5 were forwarded to staff). Each answer takes about 10–25 seconds; putting a long menu into the prompt makes each question take about 65 seconds. The 1.5B model refuses to guess (no wrong figures) but cannot repeat the customer's exact words, and forwards most questions to staff, so 2B or larger is recommended (only exaone 2.4B was actually measured).
Limitations
- The official measurement is based on a self-built test set, mainly Korean business arithmetic; user tasks may differ.
- Computation units only help when a corresponding computation unit exists; writing, translation, and judgment are still done by the model.
- The English guide is a translation and has not been re-measured.
- Process isolation is not an operating system sandbox.
- Version 0.2.3 and earlier read computation units from the main branch, so stemseal must be upgraded to fetch new computation units.
License MIT, see LICENSE.