@cyanheads/calculator-mcp-server 0.1.26 → 0.3.0

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/AGENTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** calculator-mcp-server
4
- **Version:** 0.1.26
4
+ **Version:** 0.3.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.16`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` 1.29.0
@@ -20,7 +20,7 @@ A publicly-hosted calculator MCP server that lets any LLM verify mathematical co
20
20
 
21
21
  ### Security Model
22
22
 
23
- MathService wraps a **hardened math.js instance** — dangerous functions (`import`, `createUnit`, `evaluate`, `parse`, `compile`, `chain`, `config`, `resolve`, `reviver`, `parser`) are disabled in the expression scope. `simplify` and `derivative` are also disabled in expressions but called programmatically by the tool handler. Evaluation runs inside `vm.runInNewContext()` with a timeout. Input length is capped. Expression separators (semicolons and newlines) are rejected — single expression per call only. Variable scope accepts `z.record(z.number())` only with prototype-polluting keys blocked. Result types are validated (functions, parsers, and result sets rejected). Result size is capped via `CALC_MAX_RESULT_LENGTH`. The math.js `version` constant is redacted to prevent fingerprinting.
23
+ MathService wraps a **hardened math.js instance** — dangerous functions (`import`, `createUnit`, `evaluate`, `parse`, `compile`, `chain`, `config`, `resolve`, `reviver`, `parser`) are disabled in the expression scope. `simplify` and `derivative` are also disabled in expressions but called programmatically by the tool handler. Evaluation runs inside `vm.runInNewContext()` with a timeout. Input length is capped. Expression separators (semicolons and newlines) are rejected — single expression per call only (the separator scan is string-literal-aware so `;` inside `"..."` is not treated as a statement break). Variable scope accepts `z.record(z.number())` only with prototype-polluting keys blocked. Result types are validated (functions, parsers, and result sets rejected). `.toString()` / `.toLocaleString()` access on any value is rejected at parse time via an AST check — these method calls on function-valued identifiers would otherwise bypass the result-type guard by returning source as a plain string. Result size is capped via `CALC_MAX_RESULT_LENGTH`. The math.js `version` constant is redacted to prevent fingerprinting.
24
24
 
25
25
  ---
26
26
 
package/CLAUDE.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Agent Protocol
2
2
 
3
3
  **Server:** calculator-mcp-server
4
- **Version:** 0.1.26
4
+ **Version:** 0.3.0
5
5
  **Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) `^0.9.16`
6
6
  **Engines:** Bun ≥1.3.0, Node ≥24.0.0
7
7
  **MCP SDK:** `@modelcontextprotocol/sdk` 1.29.0
@@ -20,7 +20,7 @@ A publicly-hosted calculator MCP server that lets any LLM verify mathematical co
20
20
 
21
21
  ### Security Model
22
22
 
23
- MathService wraps a **hardened math.js instance** — dangerous functions (`import`, `createUnit`, `evaluate`, `parse`, `compile`, `chain`, `config`, `resolve`, `reviver`, `parser`) are disabled in the expression scope. `simplify` and `derivative` are also disabled in expressions but called programmatically by the tool handler. Evaluation runs inside `vm.runInNewContext()` with a timeout. Input length is capped. Expression separators (semicolons and newlines) are rejected — single expression per call only. Variable scope accepts `z.record(z.number())` only with prototype-polluting keys blocked. Result types are validated (functions, parsers, and result sets rejected). Result size is capped via `CALC_MAX_RESULT_LENGTH`. The math.js `version` constant is redacted to prevent fingerprinting.
23
+ MathService wraps a **hardened math.js instance** — dangerous functions (`import`, `createUnit`, `evaluate`, `parse`, `compile`, `chain`, `config`, `resolve`, `reviver`, `parser`) are disabled in the expression scope. `simplify` and `derivative` are also disabled in expressions but called programmatically by the tool handler. Evaluation runs inside `vm.runInNewContext()` with a timeout. Input length is capped. Expression separators (semicolons and newlines) are rejected — single expression per call only (the separator scan is string-literal-aware so `;` inside `"..."` is not treated as a statement break). Variable scope accepts `z.record(z.number())` only with prototype-polluting keys blocked. Result types are validated (functions, parsers, and result sets rejected). `.toString()` / `.toLocaleString()` access on any value is rejected at parse time via an AST check — these method calls on function-valued identifiers would otherwise bypass the result-type guard by returning source as a plain string. Result size is capped via `CALC_MAX_RESULT_LENGTH`. The math.js `version` constant is redacted to prevent fingerprinting.
24
24
 
25
25
  ---
26
26
 
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <div align="center">
9
9
 
10
- [![Version](https://img.shields.io/badge/Version-0.1.26-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/calculator-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-%5E1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/calculator-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/calculator-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-%5E6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
10
+ [![Version](https://img.shields.io/badge/Version-0.3.0-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/calculator-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-%5E1.29.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/calculator-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/calculator-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-%5E6.0.3-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0-blueviolet.svg?style=flat-square)](https://bun.sh/)
11
11
 
12
12
  </div>
13
13
 
@@ -19,6 +19,13 @@ export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinit
19
19
  result: z.ZodString;
20
20
  resultType: z.ZodString;
21
21
  expression: z.ZodString;
22
+ operation: z.ZodEnum<{
23
+ evaluate: "evaluate";
24
+ simplify: "simplify";
25
+ derivative: "derivative";
26
+ }>;
27
+ scopeVars: z.ZodOptional<z.ZodArray<z.ZodString>>;
28
+ precisionUsed: z.ZodOptional<z.ZodNumber>;
22
29
  }, z.core.$strip>, readonly [{
23
30
  readonly reason: "empty_expression";
24
31
  readonly code: JsonRpcErrorCode.ValidationError;
@@ -42,8 +49,8 @@ export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinit
42
49
  }, {
43
50
  readonly reason: "disallowed_result_type";
44
51
  readonly code: JsonRpcErrorCode.ValidationError;
45
- readonly when: "Result type is function, parser, or multi-expression ResultSet — security guard.";
46
- readonly recovery: "Rewrite the expression to produce a value (number, matrix, unit) instead of a function or parser.";
52
+ readonly when: "Result is a function, parser, or multi-expression ResultSet, or the expression converts a function to a string (e.g. `cos.toString()`) — security guard.";
53
+ readonly recovery: "Rewrite the expression to produce a value (number, matrix, unit) instead of a function or its source.";
47
54
  }, {
48
55
  readonly reason: "result_too_large";
49
56
  readonly code: JsonRpcErrorCode.ValidationError;
@@ -1 +1 @@
1
- {"version":3,"file":"calculate.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqKxB,CAAC"}
1
+ {"version":3,"file":"calculate.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGjE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA2MxB,CAAC"}
@@ -17,7 +17,7 @@ export const calculateTool = tool('calculate', {
17
17
  expression: z
18
18
  .string()
19
19
  .min(1)
20
- .describe(`One mathematical expression per call — neither \`;\` nor newlines separate statements. Inside matrices, \`;\` separates rows (e.g. \`[1, 2; 3, 4]\`). Supports arithmetic (+, -, *, /, ^, %), functions (sin, cos, sqrt, log, abs, round, etc.), constants (pi, e, phi, i), matrices, units (5 kg to lbs), and variables (when scope is provided).`),
20
+ .describe(`One mathematical expression per call — neither \`;\` nor newlines separate statements. Inside matrices, \`;\` separates rows (e.g. \`[1, 2; 3, 4]\`). Supports arithmetic (+, -, *, /, ^, %), functions (sin, cos, sqrt, log, abs, round, etc.), constants (pi, e, phi, i), matrices, units (5 kg to lbs), and variables (when scope is provided). Standard notation \`ln\` and \`arc*\` (e.g. \`arcsin\`, \`arctan\`) is accepted alongside the math.js names \`log\` and \`asin\`/\`atan\`.`),
21
21
  operation: z
22
22
  .enum(['evaluate', 'simplify', 'derivative'])
23
23
  .default('evaluate')
@@ -51,6 +51,17 @@ export const calculateTool = tool('calculate', {
51
51
  .string()
52
52
  .describe('Type of result as reported by math.js: number, BigNumber, Complex, DenseMatrix, Unit, string, boolean. Symbolic operations return "string".'),
53
53
  expression: z.string().describe('The original expression as received.'),
54
+ operation: z
55
+ .enum(['evaluate', 'simplify', 'derivative'])
56
+ .describe('The operation that was applied.'),
57
+ scopeVars: z
58
+ .array(z.string())
59
+ .optional()
60
+ .describe('Keys from the scope that were active during evaluation. Omitted when no scope was provided. Values are omitted to keep output compact.'),
61
+ precisionUsed: z
62
+ .number()
63
+ .optional()
64
+ .describe('Significant-digit precision applied to the result. Omitted when full precision was used or the operation is symbolic.'),
54
65
  }),
55
66
  errors: [
56
67
  {
@@ -80,8 +91,8 @@ export const calculateTool = tool('calculate', {
80
91
  {
81
92
  reason: 'disallowed_result_type',
82
93
  code: JsonRpcErrorCode.ValidationError,
83
- when: 'Result type is function, parser, or multi-expression ResultSet — security guard.',
84
- recovery: 'Rewrite the expression to produce a value (number, matrix, unit) instead of a function or parser.',
94
+ when: 'Result is a function, parser, or multi-expression ResultSet, or the expression converts a function to a string (e.g. `cos.toString()`) — security guard.',
95
+ recovery: 'Rewrite the expression to produce a value (number, matrix, unit) instead of a function or its source.',
85
96
  },
86
97
  {
87
98
  reason: 'result_too_large',
@@ -123,25 +134,47 @@ export const calculateTool = tool('calculate', {
123
134
  switch (operation) {
124
135
  case 'evaluate':
125
136
  ctx.log.info('Evaluated expression', { expression });
126
- return { ...math.evaluateExpression(expression, ctx, scope, precision), expression };
137
+ return {
138
+ ...math.evaluateExpression(expression, ctx, scope, precision),
139
+ expression,
140
+ operation,
141
+ // Omit context fields that carry no signal: scopeVars only when a scope
142
+ // was supplied, precisionUsed only when a precision was applied (#14).
143
+ ...(scope ? { scopeVars: Object.keys(scope) } : {}),
144
+ ...(precision !== undefined ? { precisionUsed: precision } : {}),
145
+ };
127
146
  case 'simplify':
128
147
  ctx.log.info('Simplified expression', { expression });
129
- return { ...math.simplifyExpression(expression, ctx), expression };
148
+ // Symbolic operations never carry scope/precision context — omit both.
149
+ return {
150
+ ...math.simplifyExpression(expression, ctx),
151
+ expression,
152
+ operation,
153
+ };
130
154
  case 'derivative':
131
155
  if (!variable) {
132
156
  throw ctx.fail('derivative_missing_variable', "The 'variable' parameter is required when operation is 'derivative'.", { ...ctx.recoveryFor('derivative_missing_variable') });
133
157
  }
134
158
  ctx.log.info('Differentiated expression', { expression, variable });
135
- return { ...math.differentiateExpression(expression, variable, ctx), expression };
159
+ // Symbolic operations never carry scope/precision context — omit both.
160
+ return {
161
+ ...math.differentiateExpression(expression, variable, ctx),
162
+ expression,
163
+ operation,
164
+ };
136
165
  default:
137
166
  throw new Error(`Unhandled operation: ${operation}`);
138
167
  }
139
168
  },
140
- format: (output) => [
141
- {
142
- type: 'text',
143
- text: `**Expression:** \`${output.expression}\`\n**Result:** ${output.result}\n**Type:** ${output.resultType}`,
144
- },
145
- ],
169
+ format: (output) => {
170
+ const scopeVars = output.scopeVars && output.scopeVars.length > 0 ? output.scopeVars.join(', ') : 'none';
171
+ const precision = output.precisionUsed ?? 'full';
172
+ return [
173
+ {
174
+ type: 'text',
175
+ text: `**Expression:** \`${output.expression}\`\n**Operation:** ${output.operation}\n**Result:** ${output.result}\n**Type:** ${output.resultType}\n**Scope variables:** ${scopeVars}\n**Precision:** ${precision}`,
176
+ },
177
+ ];
178
+ },
146
179
  });
147
180
  //# sourceMappingURL=calculate.tool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"calculate.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE;IAC7C,WAAW,EACT,0NAA0N;IAC5N,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACrB;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aAC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,EAAE,CAAC,CAAC;gBACpE,OAAO,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,CAAC;YACpF;gBACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,SAAmB,EAAE,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC;QAClB;YACE,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,qBAAqB,MAAM,CAAC,UAAU,mBAAmB,MAAM,CAAC,MAAM,eAAe,MAAM,CAAC,UAAU,EAAE;SAC/G;KACF;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"calculate.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/calculate.tool.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,EAAE;IAC7C,WAAW,EACT,0NAA0N;IAC5N,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK;KACrB;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,UAAU,EAAE,CAAC;aACV,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,+dAA+d,CAChe;QACH,SAAS,EAAE,CAAC;aACT,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;aAC5C,OAAO,CAAC,UAAU,CAAC;aACnB,QAAQ,CACP,+RAA+R,CAChS;QACH,QAAQ,EAAE,CAAC;aACR,KAAK,CAAC;YACL,CA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9,7 @@ import type { ServerConfig } from '../../config/server-config.js';
9
9
  import type { MathResult } from './types.js';
10
10
  export declare class MathService {
11
11
  private readonly evaluate;
12
+ private readonly parse;
12
13
  private readonly simplify;
13
14
  private readonly derivative;
14
15
  private readonly simplifyRules;
@@ -29,8 +30,25 @@ export declare class MathService {
29
30
  private validateScope;
30
31
  /** Reject result types that leak internals (functions, parsers, multi-expression ResultSets). */
31
32
  private validateResultType;
33
+ /** Reject results holding a non-finite value (Infinity, -Infinity, NaN), including inside matrices and complex numbers. */
34
+ private validateFinite;
32
35
  /** Reject results that exceed the configured maximum size. */
33
36
  private validateResultSize;
37
+ /**
38
+ * Reject expressions that access `.toString` / `.toLocaleString` on any value.
39
+ * math.js permits these methods on function-valued identifiers (`cos.toString()`,
40
+ * `import.toString()`), returning the function's source as a plain string — which
41
+ * slips past {@link validateResultType}, whose function defense only inspects the
42
+ * value AFTER stringification. The check is parse-time and AST-based rather than a
43
+ * runtime `Function.prototype` patch: math.js itself calls `toString` on functions
44
+ * internally while evaluating units, statistics, and complex results, so patching
45
+ * the prototype would reject legitimate expressions. No real calculator expression
46
+ * needs `.toString()`/`.toLocaleString()`, so blocking the accessor outright (dot
47
+ * or bracket form, on any operand) is both sufficient and side-effect-free. String
48
+ * literals that merely contain the text "toString" parse as ConstantNodes, not
49
+ * accessors, so they are unaffected.
50
+ */
51
+ private validateNoFunctionStringification;
34
52
  /** Runs a synchronous function inside a vm sandbox with timeout protection. */
35
53
  private runWithTimeout;
36
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"math-service.d.ts","sourceRoot":"","sources":["../../../src/services/math/math-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiH7C,qBAAa,WAAW;IACt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E,OAAO,CAAC,cAAc;CAoBvB;AAMD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,WAAW,CAG5C"}
@@ -76,6 +76,14 @@ const REDACTED_CONSTANTS = {
76
76
  * ResultSet indicates multi-expression evaluation (newline bypass).
77
77
  */
78
78
  const BLOCKED_RESULT_TYPES = new Set(['function', 'Function', 'ResultSet', 'Parser']);
79
+ /**
80
+ * Method names that coerce a value to a string. Blocked at parse time on any
81
+ * accessor: `.toString()` / `.toLocaleString()` on a function-valued identifier
82
+ * (e.g. `cos.toString()`) otherwise returns internal source as a plain string,
83
+ * slipping past {@link BLOCKED_RESULT_TYPES} (which only sees the value after
84
+ * stringification). See {@link MathService.validateNoFunctionStringification}.
85
+ */
86
+ const STRINGIFYING_METHODS = new Set(['toString', 'toLocaleString']);
79
87
  /**
80
88
  * Scope key names that could pollute the object prototype chain or shadow
81
89
  * critical Object.prototype methods. Validated before passing to math.js.
@@ -96,14 +104,35 @@ const BLOCKED_SCOPE_KEYS = new Set([
96
104
  'toLocaleString',
97
105
  ]);
98
106
  /**
99
- * Check for expression separators outside square brackets.
100
- * Semicolons inside `[...]` are valid matrix row separators.
101
- * Newlines (`\n`, `\r`) are also expression separators in math.js.
107
+ * Check for expression separators (`;` or newline) that split the input into
108
+ * multiple statements. Three contexts are NOT separators and are skipped:
109
+ * - `;` inside `[...]` a matrix row separator (`[1, 2; 3, 4]`).
110
+ * - `;` or a newline inside a double-quoted string literal — part of the data,
111
+ * not a statement break (`"a;b"`, `concat("a;b", "c")`).
112
+ * - `[` / `]` inside a string literal — they must not shift the bracket depth,
113
+ * or a string such as `"]"` would let a later top-level `;` slip past.
114
+ *
115
+ * Single quotes are NOT string delimiters in math.js — `'` is the transpose
116
+ * operator (`A'`) — so only `"` opens a string span, and a backslash escapes the
117
+ * next character within it (`"\""` stays open). The scan is intentionally
118
+ * lexical rather than a full parse: it only has to recognize quoted spans, and a
119
+ * genuine multi-statement input (`1+2; 3+4`) is still caught at depth 0.
102
120
  */
103
121
  function hasExpressionSeparator(expr) {
104
122
  let depth = 0;
105
- for (const ch of expr) {
106
- if (ch === '[')
123
+ let inString = false;
124
+ for (let i = 0; i < expr.length; i++) {
125
+ const ch = expr[i];
126
+ if (inString) {
127
+ if (ch === '\\')
128
+ i++;
129
+ else if (ch === '"')
130
+ inString = false;
131
+ continue;
132
+ }
133
+ if (ch === '"')
134
+ inString = true;
135
+ else if (ch === '[')
107
136
  depth++;
108
137
  else if (ch === ']')
109
138
  depth--;
@@ -114,8 +143,53 @@ function hasExpressionSeparator(expr) {
114
143
  }
115
144
  return false;
116
145
  }
146
+ /**
147
+ * Recursively test whether a math.js result holds any non-finite number
148
+ * (Infinity, -Infinity, NaN). The `undefined_result` guard must reach inside
149
+ * compound types: a `DenseMatrix`/`SparseMatrix` element or the real/imaginary
150
+ * part of a `Complex` can be non-finite while the outer value is an object — a
151
+ * scalar `typeof === 'number'` check would skip it and leak `Infinity` to clients.
152
+ */
153
+ function containsNonFinite(value) {
154
+ if (typeof value === 'number')
155
+ return !Number.isFinite(value);
156
+ if (value === null || typeof value !== 'object')
157
+ return false;
158
+ if (Array.isArray(value))
159
+ return value.some(containsNonFinite);
160
+ // Complex: re/im are plain numbers.
161
+ if ('re' in value && 'im' in value) {
162
+ return containsNonFinite(value.re) || containsNonFinite(value.im);
163
+ }
164
+ // DenseMatrix / SparseMatrix expose toArray() → nested JS arrays.
165
+ if (typeof value.toArray === 'function') {
166
+ return containsNonFinite(value.toArray());
167
+ }
168
+ return false;
169
+ }
170
+ /**
171
+ * Matches standard-notation function names math.js does not define — natural log
172
+ * `ln` and the inverse-trig `arc*` family — only at call sites (word boundary +
173
+ * `(` lookahead), so identifiers and scope variables are never rewritten.
174
+ */
175
+ const NOTATION_ALIAS_PATTERN = /\b(ln|arc(?:sin|cos|tan|sec|csc|cot)h?)(?=\s*\()/g;
176
+ /**
177
+ * Rewrite standard mathematical notation to math.js canonical names before
178
+ * parsing: `ln` → `log` (natural log) and `arc<fn>` → `a<fn>` for inverse trig
179
+ * (`arcsin` → `asin`, `arctanh` → `atanh`, …). All 12 `a*` targets are math.js
180
+ * builtins, so every operation resolves them.
181
+ *
182
+ * The rewrite is name-level (not a `math.import` alias) deliberately: symbolic
183
+ * `derivative` matches on builtin function names, and an imported alias is not in
184
+ * its differentiation table — so an alias would fix evaluate/simplify but leave
185
+ * `derivative('ln(x)')` throwing. A pre-parse rewrite covers all three operations.
186
+ */
187
+ function normalizeNotation(expression) {
188
+ return expression.replace(NOTATION_ALIAS_PATTERN, (name) => name === 'ln' ? 'log' : `a${name.slice(3)}`);
189
+ }
117
190
  export class MathService {
118
191
  evaluate;
192
+ parse;
119
193
  simplify;
120
194
  derivative;
121
195
  simplifyRules;
@@ -128,6 +202,7 @@ export class MathService {
128
202
  const math = create(all);
129
203
  // Save references before overriding — these bypass the expression scope restrictions
130
204
  this.evaluate = math.evaluate.bind(math);
205
+ this.parse = math.parse.bind(math);
131
206
  this.simplify = math.simplify.bind(math);
132
207
  this.derivative = math.derivative.bind(math);
133
208
  this.simplifyRules = [...math.simplify.rules, ...TRIG_SIMPLIFY_RULES];
@@ -155,12 +230,12 @@ export class MathService {
155
230
  this.validateInput(expression, ctx);
156
231
  if (scope)
157
232
  this.validateScope(scope, ctx);
158
- const raw = this.runWithTimeout(() => (scope ? this.evaluate(expression, scope) : this.evaluate(expression)), ctx);
159
- if (typeof raw === 'number' && !Number.isFinite(raw)) {
160
- throw validationError(`Expression evaluated to ${raw} this typically means the operation is mathematically undefined (e.g., division by zero, log of zero). Check the expression.`, { reason: 'undefined_result', ...ctx.recoveryFor('undefined_result') });
161
- }
233
+ const normalized = normalizeNotation(expression);
234
+ this.validateNoFunctionStringification(normalized, ctx);
235
+ const raw = this.runWithTimeout(() => (scope ? this.evaluate(normalized, scope) : this.evaluate(normalized)), ctx);
162
236
  const resultType = this.typeOf(raw);
163
237
  this.validateResultType(resultType, ctx);
238
+ this.validateFinite(raw, ctx);
164
239
  // Match JS Number.toString thresholds — math.js defaults to exp ≥ 5,
165
240
  // which would render 83810205 as "8.3810205e+7".
166
241
  const result = this.format(raw, {
@@ -174,7 +249,8 @@ export class MathService {
174
249
  /** Simplify an algebraic expression symbolically. */
175
250
  simplifyExpression(expression, ctx) {
176
251
  this.validateInput(expression, ctx);
177
- const simplified = this.runWithTimeout(() => this.simplify(expression, this.simplifyRules), ctx);
252
+ const normalized = normalizeNotation(expression);
253
+ const simplified = this.runWithTimeout(() => this.simplify(normalized, this.simplifyRules), ctx);
178
254
  const result = simplified.toString();
179
255
  this.validateResultSize(result, ctx);
180
256
  return { result, resultType: 'string' };
@@ -182,7 +258,8 @@ export class MathService {
182
258
  /** Compute the symbolic derivative of an expression with respect to a variable. */
183
259
  differentiateExpression(expression, variable, ctx) {
184
260
  this.validateInput(expression, ctx);
185
- const derived = this.runWithTimeout(() => this.derivative(expression, variable), ctx);
261
+ const normalized = normalizeNotation(expression);
262
+ const derived = this.runWithTimeout(() => this.derivative(normalized, variable), ctx);
186
263
  const result = derived.toString();
187
264
  this.validateResultSize(result, ctx);
188
265
  return { result, resultType: 'string' };
@@ -219,12 +296,51 @@ export class MathService {
219
296
  throw validationError(`Expression produced a ${resultType} — only numeric, string, matrix, complex, unit, and boolean results are allowed.`, { reason: 'disallowed_result_type', ...ctx.recoveryFor('disallowed_result_type') });
220
297
  }
221
298
  }
299
+ /** Reject results holding a non-finite value (Infinity, -Infinity, NaN), including inside matrices and complex numbers. */
300
+ validateFinite(raw, ctx) {
301
+ if (containsNonFinite(raw)) {
302
+ throw validationError('Expression evaluated to a non-finite result (Infinity, -Infinity, or NaN) — this typically means the operation is mathematically undefined (e.g., division by zero, log of zero). Check the expression.', { reason: 'undefined_result', ...ctx.recoveryFor('undefined_result') });
303
+ }
304
+ }
222
305
  /** Reject results that exceed the configured maximum size. */
223
306
  validateResultSize(result, ctx) {
224
307
  if (result.length > this.config.maxResultLength) {
225
308
  throw validationError(`Result exceeds maximum size (${this.config.maxResultLength} characters). Reduce matrix dimensions or simplify the expression.`, { reason: 'result_too_large', ...ctx.recoveryFor('result_too_large') });
226
309
  }
227
310
  }
311
+ /**
312
+ * Reject expressions that access `.toString` / `.toLocaleString` on any value.
313
+ * math.js permits these methods on function-valued identifiers (`cos.toString()`,
314
+ * `import.toString()`), returning the function's source as a plain string — which
315
+ * slips past {@link validateResultType}, whose function defense only inspects the
316
+ * value AFTER stringification. The check is parse-time and AST-based rather than a
317
+ * runtime `Function.prototype` patch: math.js itself calls `toString` on functions
318
+ * internally while evaluating units, statistics, and complex results, so patching
319
+ * the prototype would reject legitimate expressions. No real calculator expression
320
+ * needs `.toString()`/`.toLocaleString()`, so blocking the accessor outright (dot
321
+ * or bracket form, on any operand) is both sufficient and side-effect-free. String
322
+ * literals that merely contain the text "toString" parse as ConstantNodes, not
323
+ * accessors, so they are unaffected.
324
+ */
325
+ validateNoFunctionStringification(expr, ctx) {
326
+ let ast;
327
+ try {
328
+ ast = this.parse(expr);
329
+ }
330
+ catch {
331
+ // Let the evaluate path surface parse errors with full mathjs context.
332
+ return;
333
+ }
334
+ const accessesStringifier = ast.filter((node) => {
335
+ if (node.type !== 'IndexNode')
336
+ return false;
337
+ const { dimensions } = node;
338
+ return dimensions.some((dim) => dim.type === 'ConstantNode' && STRINGIFYING_METHODS.has(String(dim.value)));
339
+ });
340
+ if (accessesStringifier.length > 0) {
341
+ throw validationError('Converting a function to a string is not allowed — it would expose internal source. Only numeric, string, matrix, complex, unit, and boolean results are allowed.', { reason: 'disallowed_result_type', ...ctx.recoveryFor('disallowed_result_type') });
342
+ }
343
+ }
228
344
  /** Runs a synchronous function inside a vm sandbox with timeout protection. */
229
345
  runWithTimeout(fn, ctx) {
230
346
  const sandbox = { fn, result: undefined };
@@ -287,11 +403,13 @@ const HELP_CONTENT = `# Calculator Help
287
403
 
288
404
  ## Functions
289
405
 
406
+ > **Standard notation accepted:** \`ln\` works as natural log (canonical \`log\`), and the \`arc*\` inverse-trig names (\`arcsin\`, \`arccos\`, \`arctan\`, \`arcsinh\`, …) work as their \`a*\` equivalents (\`asin\`, \`acos\`, \`atan\`, …). Both forms are valid across evaluate, simplify, and derivative.
407
+
290
408
  ### Arithmetic
291
- abs, ceil, floor, round, sign, sqrt, cbrt, exp, expm1, log, log2, log10, log1p, pow, mod, gcd, lcm, nthRoot, hypot, fix, cube, square, unaryMinus, unaryPlus
409
+ abs, ceil, floor, round, sign, sqrt, cbrt, exp, expm1, log (also: ln), log2, log10, log1p, pow, mod, gcd, lcm, nthRoot, hypot, fix, cube, square, unaryMinus, unaryPlus
292
410
 
293
411
  ### Trigonometry
294
- sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, sec, csc, cot, asec, acsc, acot, sech, csch, coth
412
+ sin, cos, tan, asin (arcsin), acos (arccos), atan (arctan), atan2, sinh, cosh, tanh, asinh (arcsinh), acosh (arccosh), atanh (arctanh), sec, csc, cot, asec (arcsec), acsc (arccsc), acot (arccot), sech (arcsech), csch (arccsch), coth (arccoth)
295
413
 
296
414
  ### Statistics
297
415
  mean (aliases: average, avg), median, mode, std, variance, min, max, sum, prod, quantileSeq, mad, count
@@ -1 +1 @@
1
- {"version":3,"file":"math-service.js","sourceRoot":"","sources":["../../../src/services/math/math-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,EAA0C,MAAM,QAAQ,CAAC;AAI7E;;;;GAIG;AACH,MAAM,mBAAmB,GAAmB;IAC1C,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,sCAAsC;IACtC,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BA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G,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,uBAAuB;AAEvB,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGpB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanheads/calculator-mcp-server",
3
- "version": "0.1.26",
3
+ "version": "0.3.0",
4
4
  "description": "Evaluate, simplify, and differentiate mathematical expressions via MCP. STDIO or Streamable HTTP.",
5
5
  "mcpName": "io.github.cyanheads/calculator-mcp-server",
6
6
  "type": "module",
package/server.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "url": "https://github.com/cyanheads/calculator-mcp-server",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.1.26",
9
+ "version": "0.3.0",
10
10
  "remotes": [
11
11
  {
12
12
  "type": "streamable-http",
@@ -19,7 +19,7 @@
19
19
  "registryBaseUrl": "https://registry.npmjs.org",
20
20
  "identifier": "@cyanheads/calculator-mcp-server",
21
21
  "runtimeHint": "bun",
22
- "version": "0.1.26",
22
+ "version": "0.3.0",
23
23
  "packageArguments": [
24
24
  {
25
25
  "type": "positional",
@@ -69,7 +69,7 @@
69
69
  "registryBaseUrl": "https://registry.npmjs.org",
70
70
  "identifier": "@cyanheads/calculator-mcp-server",
71
71
  "runtimeHint": "bun",
72
- "version": "0.1.26",
72
+ "version": "0.3.0",
73
73
  "packageArguments": [
74
74
  {
75
75
  "type": "positional",