formlab-mcp 0.7.13 → 0.7.14
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/package.json +1 -1
- package/server.json +2 -2
- package/tools/lab.js +1 -1
- package/vendor/nutrition-label.js +3 -1
- package/vendor/reactive.js +9 -3
- package/vendor/theoretical-params.js +32 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formlab-mcp",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
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.7.
|
|
5
|
+
"version": "0.7.14",
|
|
6
6
|
"websiteUrl": "https://formvix.com/mcp",
|
|
7
7
|
"packages": [
|
|
8
8
|
{
|
|
9
9
|
"registryType": "npm",
|
|
10
10
|
"identifier": "formlab-mcp",
|
|
11
|
-
"version": "0.7.
|
|
11
|
+
"version": "0.7.14",
|
|
12
12
|
"runtimeHint": "npx",
|
|
13
13
|
"transport": {
|
|
14
14
|
"type": "stdio"
|
package/tools/lab.js
CHANGED
|
@@ -457,7 +457,7 @@ const get_batch = {
|
|
|
457
457
|
number: c.n ?? null, issuedAt: c.issuedAt || null, issuedBy: c.issuedBy || '', product: c.product || '', customer: c.customer || '', po: c.po || '',
|
|
458
458
|
resultsUpTo: c.upTo || null, verdict: c.conforms === false ? 'does not conform' : c.untested ? 'not tested (override)' : c.conforms === true ? 'conforms' : 'reported',
|
|
459
459
|
...(c.override ? { overrideReason: c.override } : {}),
|
|
460
|
-
// 0.7.
|
|
460
|
+
// 0.7.14: a voided certificate stays, marked (never deleted).
|
|
461
461
|
...(c.voidedAt ? { voided: true, voidedAt: c.voidedAt, voidedBy: c.voidedBy || '', voidReason: c.voidReason || '' } : {}), ...(Array.isArray(c.notTested) && c.notTested.length ? { notTested: c.notTested } : {}),
|
|
462
462
|
results: (c.rows || []).map(r => ({ parameter: r.name, ...(r.cond ? { conditions: r.cond } : {}), value: r.value, unit: r.unit || '', spec: r.spec || null, status: r.status || 'reported', testReport: r.testUid || null, testDate: r.testDate || null, ...(r.doubt ? { inDoubt: r.doubt } : {}) })),
|
|
463
463
|
sourceReports: c.sources || [],
|
|
@@ -681,7 +681,9 @@ function flNlTabHtml(f) {
|
|
|
681
681
|
const c = flNlCompute(f);
|
|
682
682
|
if (!c.ok) {
|
|
683
683
|
const who = (c.needsDensity || []).slice(0, 6).join(', ');
|
|
684
|
-
|
|
684
|
+
// Pieces (12-04): a weight per piece, or Not mixed in for a part outside the food.
|
|
685
|
+
const pcs = typeof flNeedsPieceText === 'function' && flNeedsPieceText(c.needsDensity);
|
|
686
|
+
return `<div class="card"><div class="card-body"><div class="nl-note warn nl-keep">No label yet. ${pcs ? `Can't weigh ${esc(who)}: set a weight per piece, or tick Not mixed in.` : `Add a density to ${esc(who) || 'the rows measured by volume'}.`}</div></div></div>`;
|
|
685
687
|
}
|
|
686
688
|
const st = _nlSettings(f);
|
|
687
689
|
const lines = flNlLines(f, c);
|
package/vendor/reactive.js
CHANGED
|
@@ -286,11 +286,17 @@ function _flRxUnitBasis(u) { u = String(u || '').trim().toLowerCase(); return /^
|
|
|
286
286
|
// Two checks: the rows as typed (% beside g, which _tpBuildRows turns into one wt% set), and as built (mL it couldn't
|
|
287
287
|
// convert for want of a density). A row with no unit takes any.
|
|
288
288
|
function flRxMixedUnits(comp) {
|
|
289
|
-
|
|
290
|
-
|
|
289
|
+
// A part Not mixed in (a wick) is outside the mix; a piece counts by its weight like grams (12-04). _tpBuildRows
|
|
290
|
+
// names a piece it can't weigh (needsDensity), and that is a mixed set too.
|
|
291
|
+
const pc = u => typeof flIsPieceUnit === 'function' && flIsPieceUnit(u);
|
|
292
|
+
const abs = u => (typeof isMassUnit === 'function' && isMassUnit(u)) || (typeof isVolUnit === 'function' && isVolUnit(u)) || pc(u);
|
|
293
|
+
const mix = typeof flMixRows === 'function' ? flMixRows(comp || []) : (comp || []);
|
|
294
|
+
const typed = new Set(mix.filter(c => c && (c.ingredientId || c.formulationId) && _flRxNum(c.amount) > 0)
|
|
291
295
|
.map(c => (abs(c.unit) ? 'abs' : _flRxUnitBasis(c.unit))).filter(Boolean));
|
|
292
296
|
if (typed.size > 1) return true;
|
|
293
|
-
const
|
|
297
|
+
const all = _flRxRows(comp);
|
|
298
|
+
if (all.needsDensity && all.needsDensity.length && typeof flNeedsPieceText === 'function' && flNeedsPieceText(all.needsDensity)) return true;
|
|
299
|
+
const built = all.filter(r => r && r.amount > 0);
|
|
294
300
|
// A row still in mL once built had no density, so none were made masses: an all-mL recipe multiplied millilitres
|
|
295
301
|
// by meq per gram (QA sweep, Jun 1 Nov: 100 mL of a 1.16 g/mL epoxy counted as 100 g).
|
|
296
302
|
if (typeof isVolUnit === 'function' && built.some(r => isVolUnit(r.unit))) return true;
|
|
@@ -558,6 +558,9 @@ function _tpEvaluateAll(params, rows) {
|
|
|
558
558
|
// standard fields, with numeric coercion when the string parses.
|
|
559
559
|
function _tpBuildRows(composition) {
|
|
560
560
|
const rows = [];
|
|
561
|
+
// A part marked Not mixed in (a wick, a jar) is no share of the mix in any unit (27f), so no expression, label
|
|
562
|
+
// or reactive sum reads it (12-04). A kit where every row is marked keeps them all.
|
|
563
|
+
if (typeof flMixRows === 'function') composition = flMixRows(composition || []);
|
|
561
564
|
(composition || []).forEach(c => {
|
|
562
565
|
if (!c) return;
|
|
563
566
|
const amount = parseFloat(c.amount);
|
|
@@ -575,7 +578,10 @@ function _tpBuildRows(composition) {
|
|
|
575
578
|
// math never reads it; _tpMissingInputs uses it to flag mixed units.
|
|
576
579
|
const _cfUnits = {};
|
|
577
580
|
((ing && ing.customFields) || []).forEach(f => { if (f && f.name && f.unit) _cfUnits[String(f.name).trim().toLowerCase()] = String(f.unit).trim(); });
|
|
578
|
-
|
|
581
|
+
// Counted in pieces (2 eggs): weighed through the ingredient's weight per piece, like grams (12-04).
|
|
582
|
+
const pc = typeof flIsPieceUnit === 'function' && flIsPieceUnit(c.unit);
|
|
583
|
+
const pieceKg = pc && typeof flPieceRowKg === 'function' ? flPieceRowKg(c) : null;
|
|
584
|
+
rows.push({ ...base, ing: _tpIngredientView(ing), _srcIng: ing || null, _cfUnits, ...(pc ? { _piece: true, _pieceKg: pieceKg } : {}) });
|
|
579
585
|
} else if (c.formulationId) {
|
|
580
586
|
// Sub-formula row: amount/role still meaningful, but no ing.* props.
|
|
581
587
|
// For chemistry-aware aggregations (NV, OHV, PVC), treat as opaque
|
|
@@ -601,10 +607,25 @@ function _tpBuildRows(composition) {
|
|
|
601
607
|
// and any set where one absolute row can't resolve, are left untouched.
|
|
602
608
|
const isM = u => (typeof isMassUnit === 'function') && isMassUnit(u);
|
|
603
609
|
const isV = u => (typeof isVolUnit === 'function') && isVolUnit(u);
|
|
604
|
-
|
|
605
|
-
|
|
610
|
+
// Pieces: weighed ones join the absolute rows. One that can't be weighed (no weight per piece), or any piece in a
|
|
611
|
+
// % recipe (mixed basis), gives the expressions no value and is named, never read as 2 wt% (12-04). A set of
|
|
612
|
+
// nothing but unweighed pieces stays as typed.
|
|
613
|
+
const pieces = rows.filter(r => r._piece);
|
|
614
|
+
const unweighed = [];
|
|
615
|
+
if (pieces.length && pieces.length < rows.length) {
|
|
616
|
+
const pct = rows.some(r => !r._piece && /^(wt\s*%|%|w\/w|vol\s*%)/i.test(String(r.unit || 'wt%').trim()));
|
|
617
|
+
pieces.forEach(r => {
|
|
618
|
+
if (pct) unweighed.push((r.ing && r.ing.name || '(unnamed)') + _TP_PIECE_PCT);
|
|
619
|
+
else if (r._pieceKg == null) unweighed.push((r.ing && r.ing.name || '(unnamed)') + _TP_PIECE_NOWT);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
const abs = rows.filter(r => isM(r.unit) || isV(r.unit) || (r._piece && r._pieceKg != null && !unweighed.length));
|
|
623
|
+
if (unweighed.length) {
|
|
624
|
+
Object.defineProperty(rows, 'needsDensity', { value: unweighed, enumerable: false });
|
|
625
|
+
} else if (abs.length && typeof massToKg === 'function' && typeof volToL === 'function') {
|
|
606
626
|
const noDensity = [];
|
|
607
627
|
const grams = abs.map(r => {
|
|
628
|
+
if (r._piece) return r._pieceKg * 1000;
|
|
608
629
|
if (isM(r.unit)) { const f = massToKg(r.unit); return (f != null) ? r.amount * f * 1000 : null; }
|
|
609
630
|
const L = volToL(r.unit);
|
|
610
631
|
let d = null;
|
|
@@ -624,7 +645,7 @@ function _tpBuildRows(composition) {
|
|
|
624
645
|
}
|
|
625
646
|
}
|
|
626
647
|
_tpHarmonizeUnits(rows);
|
|
627
|
-
rows.forEach(r => { delete r._srcIng; delete r._srcSub; });
|
|
648
|
+
rows.forEach(r => { delete r._srcIng; delete r._srcSub; delete r._piece; delete r._pieceKg; });
|
|
628
649
|
return rows;
|
|
629
650
|
}
|
|
630
651
|
|
|
@@ -1270,9 +1291,16 @@ function _tpMissingInputs(formula, rows) {
|
|
|
1270
1291
|
// The line for a parameter left without a value: mL rows need a density to count by mass.
|
|
1271
1292
|
function _tpNeedsDensityNote(names) {
|
|
1272
1293
|
const n = names.length;
|
|
1294
|
+
if (flNeedsPieceText(names)) return { text: `${flNeedsLead(names)}: ${names.slice(0, 2).join(', ')}${n > 2 ? ` +${n - 2} more` : ''}`,
|
|
1295
|
+
tip: `Pieces count by their weight per piece, in a recipe by weight. A part outside the mix: tick Not mixed in on the ingredient. ${names.join(', ')}.` };
|
|
1273
1296
|
return { text: `Needs a density: ${names.slice(0, 2).join(', ')}${n > 2 ? ` +${n - 2} more` : ''}`,
|
|
1274
1297
|
tip: `Rows in mL count by mass. Give ${n === 1 ? 'it' : 'these'} a density, or enter the recipe in g or %: ${names.join(', ')}.` };
|
|
1275
1298
|
}
|
|
1299
|
+
// Rows _tpBuildRows can't weigh: mL with no density (a bare name), or pieces (tagged with the reason, 12-04).
|
|
1300
|
+
const _TP_PIECE_NOWT = ' (no weight per piece)';
|
|
1301
|
+
const _TP_PIECE_PCT = ' (pieces in a % recipe)';
|
|
1302
|
+
function flNeedsPieceText(names) { return (names || []).some(n => String(n).endsWith(_TP_PIECE_NOWT) || String(n).endsWith(_TP_PIECE_PCT)); }
|
|
1303
|
+
function flNeedsLead(names) { return flNeedsPieceText(names) ? "Can't weigh" : 'Needs a density'; }
|
|
1276
1304
|
// One short line for the table (and its tooltip), '' when nothing is missing.
|
|
1277
1305
|
function _tpMissingNote(miss) {
|
|
1278
1306
|
if (!miss) return null;
|