formlab-mcp 0.6.66 → 0.6.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ Ask Claude (or another MCP client) things like:
33
33
  | `find_similar_formulations` | Find formulas using a given ingredient ≥ threshold % |
34
34
  | `compare_formulations` | Pairwise side-by-side composition diff |
35
35
  | `list_ingredients` | Filtered list of raw materials. Filters: `family`, `supplier`, `name_contains`, `in_stock_only`, `ingredient_class` (small-molecule / surfactant / polymer / extract / fragrance / pigment / sequence / mixture), `sequence_contains` (e.g. `KTTKS` → Matrixyl), `taxon_contains` (e.g. `Centella`) |
36
- | `get_ingredient` | Full record + supplier / **cost ($/kg)** / stock / chemical name / molecular weight / storage / formulations using it, plus **GHS safety** (pictograms, H/P codes, signal word), **per-jurisdiction regulatory status**, **approved sources** (the suppliers / manufacturers qualified to supply this material — ASL/AML), and **inventory lots** (balances + expiry + the source each was received from). Returns every class-specific sub-object when present: `sequence` (peptide / oligo), `taxon` (NCBI ID + scientific name), `ingredientClass`, `extractDetails`, `sequenceDetails`, `polymerDetails`, `surfactantDetails`, `pigmentDetails`, `fragranceDetails`, and its **custom fields** with units (`customFields`: protein / carb / fat in g/100g, solids %… — what theoretical parameters read) |
36
+ | `get_ingredient` | Full record + supplier / **cost ($/kg)** / stock / chemical name / molecular weight / storage / formulations using it, plus **GHS safety** (pictograms, H/P codes, signal word), **per-jurisdiction regulatory status**, **approved sources** (the suppliers / manufacturers qualified to supply this material — ASL/AML), and **inventory lots** (balances + expiry + the source each was received from). Returns every class-specific sub-object when present: `sequence` (peptide / oligo), `taxon` (NCBI ID + scientific name), `ingredientClass`, `extractDetails`, `sequenceDetails`, `polymerDetails`, `surfactantDetails`, `pigmentDetails`, `fragranceDetails`, and its **custom fields** with units (`customFields`: protein / carb / fat in g/100g, solids %… — what theoretical parameters read), and its **reactive groups** (EEW, AHEW, OH number, NCO %, acid / amine value: as entered, in the datasheet's terms and meq/g, with any row the app ignores and why) |
37
37
  | `list_lots` | Inventory lots across ingredients (each a received batch with its own remaining balance, supplier, expiry, **unit cost**, **status** — `active` / `hold` / `quarantine` / `rejected`; held lots are blocked from consumption, with a `holdReason` — and the **approved source** it was received from: `source.supplier` + `source.manufacturer`, where recalls hinge on the manufacturer). Each lot also reports its **Certificate of Analysis** (`coa`: linked, or matched by lot number) and `coaMissing` for an in-stock lot without one. Filters: `ingredient_id`, `expiring_within_days`, `status` (e.g. `hold` to find lots held for a recall), `missing_coa` |
38
38
  | `list_suppliers` | Supplier / manufacturer records with roll-ups — ingredients approved, lots received / on hand (+ value at paid cost), qualified / trial / disqualified source counts, last receipt; lots count by supplier **and** by manufacturer |
39
39
  | `get_supplier` | One supplier in full: record, every ingredient it's an approved source for, every lot from it, and the **recall trace** (batches that consumed those lots → products, shipments, samples, sub-batches; lots on hold flagged) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "formlab-mcp",
3
- "version": "0.6.66",
3
+ "version": "0.6.67",
4
4
  "mcpName": "io.github.juliu1980/formlab-mcp",
5
5
  "description": "Read-only Model Context Protocol server for FormLab. Lets Claude and other MCP clients read and analyze your FormLab data, from a local export file or your live cloud workspace.",
6
6
  "homepage": "https://formvix.com/mcp",
package/server.json CHANGED
@@ -2,13 +2,13 @@
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.juliu1980/formlab-mcp",
4
4
  "description": "Read-only MCP server for FormLab formulation data: a local export file or your live cloud workspace.",
5
- "version": "0.6.66",
5
+ "version": "0.6.67",
6
6
  "websiteUrl": "https://formvix.com/mcp",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "formlab-mcp",
11
- "version": "0.6.66",
11
+ "version": "0.6.67",
12
12
  "runtimeHint": "npx",
13
13
  "transport": {
14
14
  "type": "stdio"
package/theoretical.js CHANGED
@@ -26,7 +26,26 @@ function source() {
26
26
  // Runs inside the vm: evaluates one formulation's (or batch's) parameters and
27
27
  // returns a JSON string, so only plain text crosses back.
28
28
  const EPILOGUE = `
29
- ;function __theo(kind, id) {
29
+ ;function __rx(id) {
30
+ var ing = (db.ingredients || []).find(function (x) { return x && x.id === id; });
31
+ if (!ing) return '[]';
32
+ var meq = flRxIngMeq(ing);
33
+ var stored = ing.reactiveGroups || [];
34
+ var counted = []; // the stored row each group's value came from (the app takes the first valid one)
35
+ var out = Object.keys(meq).map(function (g) {
36
+ var e = stored.find(function (x) { return x && x.group === g && flRxMeq(x, ing.mw) != null; });
37
+ if (e) counted.push(e);
38
+ return { group: g, label: FL_RX_GROUPS[g].label, datasheet: flRxTermText(g, meq[g]), meqPerG: +meq[g].toPrecision(4),
39
+ entered: e ? { basis: FL_RX_BASES[e.basis].label, value: +e.value } : 'water, counted by its CAS number' };
40
+ });
41
+ stored.forEach(function (x) {
42
+ if (!x || counted.indexOf(x) >= 0) return;
43
+ var why = !FL_RX_GROUPS[x.group] ? 'unknown group' : !FL_RX_BASES[x.basis] ? 'unknown basis' : (x.basis === 'f' && !(+ing.mw > 0)) ? 'groups per molecule needs the MW' : !(+x.value > 0) ? 'no positive value' : 'a second row for the group (the first counts)';
44
+ out.push({ group: x.group, ignored: true, entered: { basis: (FL_RX_BASES[x.basis] || {}).label || x.basis, value: x.value }, why: why });
45
+ });
46
+ return JSON.stringify(out);
47
+ }
48
+ function __theo(kind, id) {
30
49
  var coll = kind === 'batch' ? db.batches : db.formulations;
31
50
  var e = (coll || []).find(function (x) { return x && x.id === id; });
32
51
  if (!e) return '[]';
@@ -66,6 +85,16 @@ function contextFor(db) {
66
85
  return ctx;
67
86
  }
68
87
 
88
+ // An ingredient's reactive groups as the app reads them (js/reactive.js): [{ group, label, datasheet ("AHEW 42.6
89
+ // g/eq"), meqPerG, entered: { basis, value } }], plus the rows it ignores and why (ignored: true, why).
90
+ export function reactiveGroups(db, id) {
91
+ try {
92
+ const ctx = contextFor(db);
93
+ vm.runInContext('var __rid = ' + JSON.stringify(String(id)) + ';', ctx);
94
+ return JSON.parse(vm.runInContext('__rx(__rid)', ctx, { timeout: 2000 }));
95
+ } catch (e) { return []; }
96
+ }
97
+
69
98
  // [{ name, value, unit, formula, error, warning, spec, pass, pinned, basis }] —
70
99
  // value null when it can't be computed (error says why); warning is the Params
71
100
  // tab's ⚠ note ("2 ingredients missing carb", "sugar in mixed units (…)");
@@ -6,6 +6,7 @@
6
6
 
7
7
  import { getStore, resolveById } from '../data.js';
8
8
  import { ingredientSmiles } from '../peptide.js';
9
+ import { reactiveGroups } from '../theoretical.js';
9
10
 
10
11
  // FormLab's export is the raw db, so ingredients carry the APP field shapes:
11
12
  // `cas` (not casNumber) and `cost = {value, currency, unit}` (not a flat
@@ -170,7 +171,7 @@ const list_ingredients = {
170
171
  const get_ingredient = {
171
172
  definition: {
172
173
  name: 'get_ingredient',
173
- description: 'Get full details for a single ingredient: cost ($/kg), GHS safety (pictograms / H- / P-codes / signal word), per-jurisdiction regulatory status, approved sources (the suppliers/manufacturers qualified to supply this material — ASL/AML), inventory lots (balances + expiry + the source each was received from), recent stock movements, and the formulations using it, plus its `customFields` (name, value, unit — e.g. protein / carb / fat in g/100g, solids %; what theoretical parameters read). Accepts internal id or UID (e.g. ING-001).',
174
+ description: 'Get full details for a single ingredient: cost ($/kg), GHS safety (pictograms / H- / P-codes / signal word), per-jurisdiction regulatory status, approved sources (the suppliers/manufacturers qualified to supply this material — ASL/AML), inventory lots (balances + expiry + the source each was received from), recent stock movements, and the formulations using it, plus its `customFields` (name, value, unit — e.g. protein / carb / fat in g/100g, solids %; what theoretical parameters read) and `reactiveGroups` (EEW, AHEW, OH number, NCO %, acid / amine value, Si-H, vinyl, water: the datasheet value as entered, the same in the datasheet\'s own terms, and meq/g; rows the app ignores are listed with why). Accepts internal id or UID (e.g. ING-001).',
174
175
  inputSchema: {
175
176
  type: 'object',
176
177
  properties: {
@@ -228,6 +229,9 @@ const get_ingredient = {
228
229
  // (protein / carb / fat in g/100g for nutrition, solids % for NV, …).
229
230
  // The unit is a label; a 0 is a value.
230
231
  customFields: (ing.customFields || []).filter(c => c && c.name).map(c => ({ name: c.name, value: c.value != null ? c.value : '', unit: c.unit || '', ...(c.info ? { info: c.info } : {}) })),
232
+ // Reactive groups (EEW, AHEW, OH number, NCO %, acid / amine value, Si-H, vinyl, water) as the app reads them,
233
+ // in the datasheet's terms and meq/g, with any row it ignores and why.
234
+ reactiveGroups: reactiveGroups(db, ing.id),
231
235
  safety,
232
236
  regulatory,
233
237
  lots,