formlab-mcp 0.6.76 → 0.6.77
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/vendor/cost.js +5 -3
- package/vendor/nesting.js +26 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "formlab-mcp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.77",
|
|
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.
|
|
5
|
+
"version": "0.6.77",
|
|
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.
|
|
11
|
+
"version": "0.6.77",
|
|
12
12
|
"runtimeHint": "npx",
|
|
13
13
|
"transport": {
|
|
14
14
|
"type": "stdio"
|
package/vendor/cost.js
CHANGED
|
@@ -1127,7 +1127,7 @@ function computeFormulationCost(formulation, displayCcy, basisUnit, _seen) {
|
|
|
1127
1127
|
d = ing ? _densityToKgPerL(ing.density, ing.densityUnit) : null;
|
|
1128
1128
|
}
|
|
1129
1129
|
const amt = parseFloat(c.amount);
|
|
1130
|
-
if (!d || !isFinite(amt)) { ok = false; break; }
|
|
1130
|
+
if (!d || !isFinite(amt) || flBadAmount(c.amount, c.unit)) { ok = false; break; }
|
|
1131
1131
|
sumKg += (amt / 100) * d;
|
|
1132
1132
|
}
|
|
1133
1133
|
formulationKgPerL = ok ? sumKg : null;
|
|
@@ -1155,7 +1155,7 @@ function computeFormulationCost(formulation, displayCcy, basisUnit, _seen) {
|
|
|
1155
1155
|
if (!ing) continue;
|
|
1156
1156
|
d = _densityToKgPerL(ing.density, ing.densityUnit);
|
|
1157
1157
|
}
|
|
1158
|
-
if (!isFinite(amt)) continue;
|
|
1158
|
+
if (!isFinite(amt) || flBadAmount(c.amount, c.unit)) continue;
|
|
1159
1159
|
if (u in MASS_TO_KG) {
|
|
1160
1160
|
const m = amt * MASS_TO_KG[u];
|
|
1161
1161
|
massKgPerRow.set(c, m);
|
|
@@ -1221,6 +1221,7 @@ function computeFormulationCost(formulation, displayCcy, basisUnit, _seen) {
|
|
|
1221
1221
|
const sub = subResolve.get(c);
|
|
1222
1222
|
if (!sub) continue; // 'sub-formula deleted' / 'cycle detected' already in missing[]
|
|
1223
1223
|
const amount = parseFloat(c.amount);
|
|
1224
|
+
if (flBadAmount(c.amount, c.unit)) { missing.push({ reason: `bad amount (${flBadAmount(c.amount, c.unit)})`, subFormula: sub.subFormula }); continue; }
|
|
1224
1225
|
if (!isFinite(amount)) { missing.push({ reason: 'no amount', subFormula: sub.subFormula }); continue; }
|
|
1225
1226
|
const kind = classifyUnit((c.unit || 'wt%').toLowerCase());
|
|
1226
1227
|
if (kind === 'unknown') { missing.push({ reason: `unsupported composition unit "${c.unit}"`, subFormula: sub.subFormula }); continue; }
|
|
@@ -1278,6 +1279,7 @@ function computeFormulationCost(formulation, displayCcy, basisUnit, _seen) {
|
|
|
1278
1279
|
if (!ing) { missing.push({ reason: 'ingredient deleted', row: c }); continue; }
|
|
1279
1280
|
const unit = (c.unit || 'wt%').toLowerCase();
|
|
1280
1281
|
const amount = parseFloat(c.amount);
|
|
1282
|
+
if (flBadAmount(c.amount, c.unit)) { missing.push({ reason: `bad amount (${flBadAmount(c.amount, c.unit)})`, ingredient: ing }); continue; }
|
|
1281
1283
|
if (!isFinite(amount)) { missing.push({ reason: 'no amount', ingredient: ing }); continue; }
|
|
1282
1284
|
|
|
1283
1285
|
const kind = classifyUnit(unit);
|
|
@@ -1478,7 +1480,7 @@ function computeCompositionFractions(formulation) {
|
|
|
1478
1480
|
}
|
|
1479
1481
|
const out = { composition: c, ingredient: ing, subFormula, amount, unit: rawU, density: d };
|
|
1480
1482
|
const resolved = !!(ing || subFormula);
|
|
1481
|
-
if (!isFinite(amount) || !resolved) { out.kind = 'invalid'; return out; }
|
|
1483
|
+
if (!isFinite(amount) || !resolved || flBadAmount(c.amount, c.unit)) { out.kind = 'invalid'; return out; }
|
|
1482
1484
|
if (u.startsWith('wt') || u === '%') { out.kind = 'wt-frac'; return out; }
|
|
1483
1485
|
if (u.startsWith('vol')) { out.kind = 'vol-frac'; return out; }
|
|
1484
1486
|
const cu = canonUnit(rawU);
|
package/vendor/nesting.js
CHANGED
|
@@ -10,6 +10,30 @@
|
|
|
10
10
|
// ============================================================
|
|
11
11
|
|
|
12
12
|
const MAX_NESTING_DEPTH = 5;
|
|
13
|
+
// A composition amount past this is a typo or a bad import, not a recipe (the same ceiling as stock, STOCK_QTY_MAX). A
|
|
14
|
+
// percentage has a far lower one: cost reads wt% as a share, so 1e9 wt% priced at $8,000,000/kg. 1000 matches the save check.
|
|
15
|
+
const COMPOSITION_AMOUNT_MAX = 1e9, COMPOSITION_PERCENT_MAX = 1000;
|
|
16
|
+
// Why an amount can't be used, or null. Blank is not bad: a row still being filled in. Without this, "Infinity" dropped its
|
|
17
|
+
// row with no word, 1e308 reduced every other row to nothing, and -20 lowered a cost.
|
|
18
|
+
function flBadAmount(raw, unit) {
|
|
19
|
+
if (raw == null || String(raw).trim() === '') return null;
|
|
20
|
+
const n = parseFloat(raw);
|
|
21
|
+
if (!Number.isFinite(n)) return 'not a number';
|
|
22
|
+
if (n < 0) return 'negative';
|
|
23
|
+
const u = String(unit == null ? 'wt%' : unit).trim().toLowerCase();
|
|
24
|
+
const percent = u === '' || u === '%' || u.startsWith('wt') || u.startsWith('vol');
|
|
25
|
+
if (n > (percent ? COMPOSITION_PERCENT_MAX : COMPOSITION_AMOUNT_MAX)) return 'too large';
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
// A row's amount for the fractions: a bad one counts for nothing, and is reported.
|
|
29
|
+
function _usableAmount(c, unresolved) {
|
|
30
|
+
const why = flBadAmount(c.amount, c.unit);
|
|
31
|
+
if (why) {
|
|
32
|
+
unresolved && unresolved.push({ reason: 'bad-amount', detail: why, amount: c.amount, ingredientId: c.ingredientId || null, formulationId: c.formulationId || null });
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
return Math.max(0, parseFloat(c.amount) || 0);
|
|
36
|
+
}
|
|
13
37
|
|
|
14
38
|
// True if the composition row points at another formulation.
|
|
15
39
|
function isSubFormulaRow(c) {
|
|
@@ -274,7 +298,7 @@ function _rowWtFractionsWithin(f, unresolved) {
|
|
|
274
298
|
|
|
275
299
|
const allWt = kinds.every(k => k === 'wt');
|
|
276
300
|
if (allWt) {
|
|
277
|
-
const nums = comp.map(c =>
|
|
301
|
+
const nums = comp.map(c => _usableAmount(c, unresolved));
|
|
278
302
|
const sum = nums.reduce((a, b) => a + b, 0);
|
|
279
303
|
if (sum <= 0) return nums.map(_ => 0);
|
|
280
304
|
return nums.map(n => n / sum);
|
|
@@ -285,7 +309,7 @@ function _rowWtFractionsWithin(f, unresolved) {
|
|
|
285
309
|
// for now — milestone 3 will refine with rollup density).
|
|
286
310
|
const kgPerRow = comp.map((c, i) => {
|
|
287
311
|
const u = String(c.unit || '').trim();
|
|
288
|
-
const amt =
|
|
312
|
+
const amt = _usableAmount(c, unresolved);
|
|
289
313
|
if (!amt) return 0;
|
|
290
314
|
if (kinds[i] === 'mass') return amt * MASS_TO_KG[u];
|
|
291
315
|
if (kinds[i] === 'volabs') {
|