@cyanheads/calculator-mcp-server 0.1.14 → 0.1.16
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 +28 -9
- package/CLAUDE.md +28 -9
- package/README.md +1 -1
- package/dist/mcp-server/resources/definitions/help.resource.d.ts +1 -1
- package/dist/mcp-server/resources/definitions/help.resource.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/calculate.tool.d.ts +43 -1
- package/dist/mcp-server/tools/definitions/calculate.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/calculate.tool.js +55 -2
- package/dist/mcp-server/tools/definitions/calculate.tool.js.map +1 -1
- package/dist/services/math/math-service.d.ts.map +1 -1
- package/dist/services/math/math-service.js +12 -10
- package/dist/services/math/math-service.js.map +1 -1
- package/package.json +2 -2
- package/server.json +3 -3
package/AGENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** calculator-mcp-server
|
|
4
|
-
**Version:** 0.1.
|
|
4
|
+
**Version:** 0.1.16
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
6
|
|
|
7
7
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -158,24 +158,41 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
158
158
|
|
|
159
159
|
## Errors
|
|
160
160
|
|
|
161
|
-
Handlers throw — the framework catches, classifies, and formats.
|
|
161
|
+
Handlers throw — the framework catches, classifies, and formats.
|
|
162
|
+
|
|
163
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, retryable? }]` on `tool()` / `resource()` to advertise the failure surface in `tools/list` (under `_meta['mcp-ts-core/errors']`) and receive a typed `ctx.fail(reason, …)` keyed by the declared reason union. TypeScript catches `ctx.fail('typo')` at compile time, `data.reason` is auto-populated for observability, and the linter enforces conformance against the handler body. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
162
164
|
|
|
163
165
|
```ts
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
errors: [
|
|
167
|
+
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound, when: 'No item matched the query' },
|
|
168
|
+
],
|
|
169
|
+
async handler(input, ctx) {
|
|
170
|
+
const item = await db.find(input.id);
|
|
171
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
|
|
172
|
+
return item;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Fallback (no contract entry fits, prototype tools, service-layer code):** throw via factories or plain `Error`.
|
|
167
177
|
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
```ts
|
|
179
|
+
// Error factories — explicit code, concise
|
|
180
|
+
import { notFound, validationError, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
|
|
170
181
|
throw notFound('Item not found', { itemId });
|
|
171
182
|
throw serviceUnavailable('API unavailable', { url }, { cause: err });
|
|
172
183
|
|
|
173
|
-
//
|
|
184
|
+
// Plain Error — framework auto-classifies from message patterns
|
|
185
|
+
throw new Error('Item not found'); // → NotFound
|
|
186
|
+
throw new Error('Invalid query format'); // → ValidationError
|
|
187
|
+
|
|
188
|
+
// McpError — when no factory exists for the code
|
|
174
189
|
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
175
190
|
throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
|
|
176
191
|
```
|
|
177
192
|
|
|
178
|
-
|
|
193
|
+
Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`. For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils`.
|
|
194
|
+
|
|
195
|
+
See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table and contract reference.
|
|
179
196
|
|
|
180
197
|
---
|
|
181
198
|
|
|
@@ -225,6 +242,7 @@ Available skills:
|
|
|
225
242
|
| `setup` | Post-init project orientation |
|
|
226
243
|
| `design-mcp-server` | Design tool surface, resources, and services for a new server |
|
|
227
244
|
| `add-tool` | Scaffold a new tool definition |
|
|
245
|
+
| `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
|
|
228
246
|
| `add-resource` | Scaffold a new resource definition |
|
|
229
247
|
| `add-prompt` | Scaffold a new prompt definition |
|
|
230
248
|
| `add-service` | Scaffold a new service integration |
|
|
@@ -322,6 +340,7 @@ import { getServerConfig } from '@/config/server-config.js';
|
|
|
322
340
|
## Checklist
|
|
323
341
|
|
|
324
342
|
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, etc.)
|
|
343
|
+
- [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
|
|
325
344
|
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
326
345
|
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
327
346
|
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** calculator-mcp-server
|
|
4
|
-
**Version:** 0.1.
|
|
4
|
+
**Version:** 0.1.16
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
6
|
|
|
7
7
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -158,24 +158,41 @@ Handlers receive a unified `ctx` object. Key properties:
|
|
|
158
158
|
|
|
159
159
|
## Errors
|
|
160
160
|
|
|
161
|
-
Handlers throw — the framework catches, classifies, and formats.
|
|
161
|
+
Handlers throw — the framework catches, classifies, and formats.
|
|
162
|
+
|
|
163
|
+
**Recommended: typed error contract.** Declare `errors: [{ reason, code, when, retryable? }]` on `tool()` / `resource()` to advertise the failure surface in `tools/list` (under `_meta['mcp-ts-core/errors']`) and receive a typed `ctx.fail(reason, …)` keyed by the declared reason union. TypeScript catches `ctx.fail('typo')` at compile time, `data.reason` is auto-populated for observability, and the linter enforces conformance against the handler body. Baseline codes (`InternalError`, `ServiceUnavailable`, `Timeout`, `ValidationError`, `SerializationError`) bubble freely and don't need declaring.
|
|
162
164
|
|
|
163
165
|
```ts
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
166
|
+
errors: [
|
|
167
|
+
{ reason: 'no_match', code: JsonRpcErrorCode.NotFound, when: 'No item matched the query' },
|
|
168
|
+
],
|
|
169
|
+
async handler(input, ctx) {
|
|
170
|
+
const item = await db.find(input.id);
|
|
171
|
+
if (!item) throw ctx.fail('no_match', `No item ${input.id}`);
|
|
172
|
+
return item;
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Fallback (no contract entry fits, prototype tools, service-layer code):** throw via factories or plain `Error`.
|
|
167
177
|
|
|
168
|
-
|
|
169
|
-
|
|
178
|
+
```ts
|
|
179
|
+
// Error factories — explicit code, concise
|
|
180
|
+
import { notFound, validationError, serviceUnavailable } from '@cyanheads/mcp-ts-core/errors';
|
|
170
181
|
throw notFound('Item not found', { itemId });
|
|
171
182
|
throw serviceUnavailable('API unavailable', { url }, { cause: err });
|
|
172
183
|
|
|
173
|
-
//
|
|
184
|
+
// Plain Error — framework auto-classifies from message patterns
|
|
185
|
+
throw new Error('Item not found'); // → NotFound
|
|
186
|
+
throw new Error('Invalid query format'); // → ValidationError
|
|
187
|
+
|
|
188
|
+
// McpError — when no factory exists for the code
|
|
174
189
|
import { McpError, JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
175
190
|
throw new McpError(JsonRpcErrorCode.DatabaseError, 'Connection failed', { pool: 'primary' });
|
|
176
191
|
```
|
|
177
192
|
|
|
178
|
-
|
|
193
|
+
Available factories: `invalidParams`, `invalidRequest`, `notFound`, `forbidden`, `unauthorized`, `validationError`, `conflict`, `rateLimited`, `timeout`, `serviceUnavailable`, `configurationError`, `internalError`, `serializationError`, `databaseError`. For HTTP responses from upstream APIs, use `httpErrorFromResponse(response, { service, data })` from `/utils`.
|
|
194
|
+
|
|
195
|
+
See framework CLAUDE.md and the `api-errors` skill for the full auto-classification table and contract reference.
|
|
179
196
|
|
|
180
197
|
---
|
|
181
198
|
|
|
@@ -225,6 +242,7 @@ Available skills:
|
|
|
225
242
|
| `setup` | Post-init project orientation |
|
|
226
243
|
| `design-mcp-server` | Design tool surface, resources, and services for a new server |
|
|
227
244
|
| `add-tool` | Scaffold a new tool definition |
|
|
245
|
+
| `add-app-tool` | Scaffold an MCP App tool + paired UI resource |
|
|
228
246
|
| `add-resource` | Scaffold a new resource definition |
|
|
229
247
|
| `add-prompt` | Scaffold a new prompt definition |
|
|
230
248
|
| `add-service` | Scaffold a new service integration |
|
|
@@ -322,6 +340,7 @@ import { getServerConfig } from '@/config/server-config.js';
|
|
|
322
340
|
## Checklist
|
|
323
341
|
|
|
324
342
|
- [ ] Zod schemas: all fields have `.describe()`, only JSON-Schema-serializable types (no `z.custom()`, `z.date()`, `z.transform()`, etc.)
|
|
343
|
+
- [ ] Optional nested objects: handler guards for empty inner values from form-based clients (`if (input.obj?.field && ...)`, not just `if (input.obj)`). When regex/length constraints matter, use `z.union([z.literal(''), z.string().regex(...).describe(...)])` — literal variants are exempt from `describe-on-fields`.
|
|
325
344
|
- [ ] JSDoc `@fileoverview` + `@module` on every file
|
|
326
345
|
- [ ] `ctx.log` for logging, `ctx.state` for storage
|
|
327
346
|
- [ ] Handlers throw on failure — error factories or plain `Error`, no try/catch
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@cyanheads/calculator-mcp-server)
|
|
10
10
|
[](https://github.com/users/cyanheads/packages/container/package/calculator-mcp-server)
|
|
11
|
-
[](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
12
12
|
|
|
13
13
|
[](https://modelcontextprotocol.io/) [](./LICENSE) [](https://www.typescriptlang.org/)
|
|
14
14
|
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const helpResource: import("@cyanheads/mcp-ts-core").ResourceDefinition<import("zod").ZodObject<Readonly<{
|
|
6
6
|
[k: string]: import("zod/v4/core").$ZodType<unknown, unknown, import("zod/v4/core").$ZodTypeInternals<unknown, unknown>>;
|
|
7
|
-
}>, import("zod/v4/core").$strip>, undefined>;
|
|
7
|
+
}>, import("zod/v4/core").$strip>, undefined, undefined>;
|
|
8
8
|
//# sourceMappingURL=help.resource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,YAAY;;
|
|
1
|
+
{"version":3,"file":"help.resource.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/resources/definitions/help.resource.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,eAAO,MAAM,YAAY;;wDAOvB,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @module mcp-server/tools/definitions/calculate.tool
|
|
5
5
|
*/
|
|
6
6
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
7
8
|
export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
8
9
|
expression: z.ZodString;
|
|
9
10
|
operation: z.ZodDefault<z.ZodEnum<{
|
|
@@ -18,5 +19,46 @@ export declare const calculateTool: import("@cyanheads/mcp-ts-core").ToolDefinit
|
|
|
18
19
|
result: z.ZodString;
|
|
19
20
|
resultType: z.ZodString;
|
|
20
21
|
expression: z.ZodString;
|
|
21
|
-
}, z.core.$strip
|
|
22
|
+
}, z.core.$strip>, readonly [{
|
|
23
|
+
readonly reason: "empty_expression";
|
|
24
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
25
|
+
readonly when: "Expression is empty or whitespace-only.";
|
|
26
|
+
}, {
|
|
27
|
+
readonly reason: "expression_too_long";
|
|
28
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
29
|
+
readonly when: "Expression exceeds the configured max length (CALC_MAX_EXPRESSION_LENGTH).";
|
|
30
|
+
}, {
|
|
31
|
+
readonly reason: "multiple_expressions";
|
|
32
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
33
|
+
readonly when: "Expression contains a separator (`;` or newline) outside matrix brackets.";
|
|
34
|
+
}, {
|
|
35
|
+
readonly reason: "reserved_scope_key";
|
|
36
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
37
|
+
readonly when: "Scope contains a reserved JS property name (`__proto__`, `constructor`, etc.).";
|
|
38
|
+
}, {
|
|
39
|
+
readonly reason: "disallowed_result_type";
|
|
40
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
41
|
+
readonly when: "Result type is function, parser, or multi-expression ResultSet — security guard.";
|
|
42
|
+
}, {
|
|
43
|
+
readonly reason: "result_too_large";
|
|
44
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
45
|
+
readonly when: "Stringified result exceeds the configured max size (CALC_MAX_RESULT_LENGTH).";
|
|
46
|
+
}, {
|
|
47
|
+
readonly reason: "undefined_result";
|
|
48
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
49
|
+
readonly when: "Expression evaluated to Infinity, -Infinity, or NaN (e.g., division by zero).";
|
|
50
|
+
}, {
|
|
51
|
+
readonly reason: "parse_failed";
|
|
52
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
53
|
+
readonly when: "mathjs could not parse the expression.";
|
|
54
|
+
}, {
|
|
55
|
+
readonly reason: "derivative_missing_variable";
|
|
56
|
+
readonly code: JsonRpcErrorCode.ValidationError;
|
|
57
|
+
readonly when: "`operation` is `derivative` but `variable` was not provided.";
|
|
58
|
+
}, {
|
|
59
|
+
readonly reason: "evaluation_timeout";
|
|
60
|
+
readonly code: JsonRpcErrorCode.ServiceUnavailable;
|
|
61
|
+
readonly when: "Expression evaluation exceeded the configured timeout (CALC_EVALUATION_TIMEOUT_MS).";
|
|
62
|
+
readonly retryable: false;
|
|
63
|
+
}]>;
|
|
22
64
|
//# sourceMappingURL=calculate.tool.d.ts.map
|
|
@@ -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;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmJxB,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @module mcp-server/tools/definitions/calculate.tool
|
|
5
5
|
*/
|
|
6
6
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
7
|
-
import {
|
|
7
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
8
8
|
import { getMathService } from '../../../services/math/math-service.js';
|
|
9
9
|
export const calculateTool = tool('calculate', {
|
|
10
10
|
description: 'Evaluate math expressions, simplify algebraic expressions, or compute symbolic derivatives. One expression per call. Supports arithmetic, trigonometry, statistics, matrices, complex numbers, units, and combinatorics.',
|
|
@@ -52,6 +52,59 @@ export const calculateTool = tool('calculate', {
|
|
|
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
54
|
}),
|
|
55
|
+
errors: [
|
|
56
|
+
{
|
|
57
|
+
reason: 'empty_expression',
|
|
58
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
59
|
+
when: 'Expression is empty or whitespace-only.',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
reason: 'expression_too_long',
|
|
63
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
64
|
+
when: 'Expression exceeds the configured max length (CALC_MAX_EXPRESSION_LENGTH).',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
reason: 'multiple_expressions',
|
|
68
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
69
|
+
when: 'Expression contains a separator (`;` or newline) outside matrix brackets.',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
reason: 'reserved_scope_key',
|
|
73
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
74
|
+
when: 'Scope contains a reserved JS property name (`__proto__`, `constructor`, etc.).',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
reason: 'disallowed_result_type',
|
|
78
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
79
|
+
when: 'Result type is function, parser, or multi-expression ResultSet — security guard.',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
reason: 'result_too_large',
|
|
83
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
84
|
+
when: 'Stringified result exceeds the configured max size (CALC_MAX_RESULT_LENGTH).',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
reason: 'undefined_result',
|
|
88
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
89
|
+
when: 'Expression evaluated to Infinity, -Infinity, or NaN (e.g., division by zero).',
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
reason: 'parse_failed',
|
|
93
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
94
|
+
when: 'mathjs could not parse the expression.',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
reason: 'derivative_missing_variable',
|
|
98
|
+
code: JsonRpcErrorCode.ValidationError,
|
|
99
|
+
when: '`operation` is `derivative` but `variable` was not provided.',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
reason: 'evaluation_timeout',
|
|
103
|
+
code: JsonRpcErrorCode.ServiceUnavailable,
|
|
104
|
+
when: 'Expression evaluation exceeded the configured timeout (CALC_EVALUATION_TIMEOUT_MS).',
|
|
105
|
+
retryable: false,
|
|
106
|
+
},
|
|
107
|
+
],
|
|
55
108
|
handler(input, ctx) {
|
|
56
109
|
const math = getMathService();
|
|
57
110
|
const { expression, operation, scope } = input;
|
|
@@ -66,7 +119,7 @@ export const calculateTool = tool('calculate', {
|
|
|
66
119
|
return { ...math.simplifyExpression(expression), expression };
|
|
67
120
|
case 'derivative':
|
|
68
121
|
if (!variable) {
|
|
69
|
-
throw
|
|
122
|
+
throw ctx.fail('derivative_missing_variable', "The 'variable' parameter is required when operation is 'derivative'.");
|
|
70
123
|
}
|
|
71
124
|
ctx.log.info('Differentiated expression', { expression, variable });
|
|
72
125
|
return { ...math.differentiateExpression(expression, variable), expression };
|
|
@@ -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,
|
|
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,oVAAoV,CACrV;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,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,oCAAoC,CAAC;YAC5D,CAAC;iBACE,MAAM,EAAE;iBACR,GAAG,CAAC,EAAE,CAAC;iBACP,KAAK,CACJ,0BAA0B,EAC1B,wDAAwD,CACzD;iBACA,QAAQ,CAAC,mEAAmE,CAAC;SACjF,CAAC;aACD,QAAQ,EAAE;aACV,QAAQ,CACP,uIAAuI,CACxI;QACH,KAAK,EAA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WrB,iGAAiG;IACjG,OAAO,CAAC,kBAAkB;IAS1B,8DAA8D;IAC9D,OAAO,CAAC,kBAAkB;IAS1B,+EAA+E;IAC/E,OAAO,CAAC,cAAc;CAkBvB;AAMD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,iDAAiD;AACjD,wBAAgB,cAAc,IAAI,WAAW,CAG5C"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @module services/math/math-service
|
|
6
6
|
*/
|
|
7
7
|
import vm from 'node:vm';
|
|
8
|
-
import {
|
|
8
|
+
import { serviceUnavailable, validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
9
9
|
import { all, create } from 'mathjs';
|
|
10
10
|
/**
|
|
11
11
|
* Custom simplification rules extending math.js defaults.
|
|
@@ -143,7 +143,7 @@ export class MathService {
|
|
|
143
143
|
this.validateScope(scope);
|
|
144
144
|
const raw = this.runWithTimeout(() => scope ? this.evaluate(expression, scope) : this.evaluate(expression));
|
|
145
145
|
if (typeof raw === 'number' && !Number.isFinite(raw)) {
|
|
146
|
-
throw
|
|
146
|
+
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' });
|
|
147
147
|
}
|
|
148
148
|
const resultType = this.typeOf(raw);
|
|
149
149
|
this.validateResultType(resultType);
|
|
@@ -179,33 +179,35 @@ export class MathService {
|
|
|
179
179
|
}
|
|
180
180
|
validateInput(expression) {
|
|
181
181
|
if (!expression.trim()) {
|
|
182
|
-
throw
|
|
182
|
+
throw validationError('Expression cannot be empty.', { reason: 'empty_expression' });
|
|
183
183
|
}
|
|
184
184
|
if (expression.length > this.config.maxExpressionLength) {
|
|
185
|
-
throw
|
|
185
|
+
throw validationError(`Expression exceeds maximum length of ${this.config.maxExpressionLength} characters.`, { reason: 'expression_too_long' });
|
|
186
186
|
}
|
|
187
187
|
if (hasExpressionSeparator(expression)) {
|
|
188
|
-
throw
|
|
188
|
+
throw validationError('Multiple expressions are not allowed. Submit one expression per call.', {
|
|
189
|
+
reason: 'multiple_expressions',
|
|
190
|
+
});
|
|
189
191
|
}
|
|
190
192
|
}
|
|
191
193
|
/** Reject scope keys that could pollute the object prototype chain. */
|
|
192
194
|
validateScope(scope) {
|
|
193
195
|
for (const key of Object.keys(scope)) {
|
|
194
196
|
if (BLOCKED_SCOPE_KEYS.has(key)) {
|
|
195
|
-
throw
|
|
197
|
+
throw validationError(`Scope key "${key}" is not allowed — it conflicts with a reserved property name.`, { reason: 'reserved_scope_key' });
|
|
196
198
|
}
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
201
|
/** Reject result types that leak internals (functions, parsers, multi-expression ResultSets). */
|
|
200
202
|
validateResultType(resultType) {
|
|
201
203
|
if (BLOCKED_RESULT_TYPES.has(resultType)) {
|
|
202
|
-
throw
|
|
204
|
+
throw validationError(`Expression produced a ${resultType} — only numeric, string, matrix, complex, unit, and boolean results are allowed.`, { reason: 'disallowed_result_type' });
|
|
203
205
|
}
|
|
204
206
|
}
|
|
205
207
|
/** Reject results that exceed the configured maximum size. */
|
|
206
208
|
validateResultSize(result) {
|
|
207
209
|
if (result.length > this.config.maxResultLength) {
|
|
208
|
-
throw
|
|
210
|
+
throw validationError(`Result exceeds maximum size (${this.config.maxResultLength} characters). Reduce matrix dimensions or simplify the expression.`, { reason: 'result_too_large' });
|
|
209
211
|
}
|
|
210
212
|
}
|
|
211
213
|
/** Runs a synchronous function inside a vm sandbox with timeout protection. */
|
|
@@ -218,11 +220,11 @@ export class MathService {
|
|
|
218
220
|
}
|
|
219
221
|
catch (err) {
|
|
220
222
|
if (err instanceof Error && 'code' in err && err.code === 'ERR_SCRIPT_EXECUTION_TIMEOUT') {
|
|
221
|
-
throw serviceUnavailable(`Expression evaluation timed out after ${this.config.evaluationTimeoutMs / 1000} seconds. Simplify the expression or reduce matrix dimensions
|
|
223
|
+
throw serviceUnavailable(`Expression evaluation timed out after ${this.config.evaluationTimeoutMs / 1000} seconds. Simplify the expression or reduce matrix dimensions.`, { reason: 'evaluation_timeout' });
|
|
222
224
|
}
|
|
223
225
|
// All non-timeout errors from the VM are expression-related
|
|
224
226
|
const message = err instanceof Error ? err.message : String(err);
|
|
225
|
-
throw
|
|
227
|
+
throw validationError(`Invalid expression: ${message}`, { reason: 'parse_failed' });
|
|
226
228
|
}
|
|
227
229
|
}
|
|
228
230
|
}
|
|
@@ -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;AACzB,OAAO,EAAE,
|
|
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;AACzB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,GAAG,EAAE,MAAM,EAAqB,MAAM,QAAQ,CAAC;AAIxD;;;;GAIG;AACH,MAAM,mBAAmB,GAAmB;IAC1C,yBAAyB;IACzB,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,sCAAsC;IACtC,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,0BAA0B;IAC1B,mCAAmC;IACnC,mCAAmC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,kBAAkB,GAAG;IACzB,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,OAAO;IACP,UAAU;IACV,YAAY;IACZ,SAAS;IACT,SAAS;IACT,SAAS;IACT,OAAO;IACP,QAAQ;IACR,QAAQ;CACA,CAAC;AAEX;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,kB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CAAC;YACD,4DAA4D;YAC5D,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACjE,MAAM,eAAe,CAAC,uBAAuB,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC,CAAC;QACtF,CAAC;IACH,CAAC;CACF;AAED,gCAAgC;AAEhC,IAAI,QAAiC,CAAC;AAEtC,qEAAqE;AACrE,MAAM,UAAU,eAAe,CAAC,MAAoB;IAClD,QAAQ,GAAG,IAAI,WAAW,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,cAAc;IAC5B,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IAClG,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,uBAAuB;AAEvB,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/calculator-mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "Calculator MCP server — evaluate, simplify, and differentiate math expressions.",
|
|
5
5
|
"mcpName": "io.github.cyanheads/calculator-mcp-server",
|
|
6
6
|
"type": "module",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
|
-
"@cyanheads/mcp-ts-core": "^0.
|
|
68
|
+
"@cyanheads/mcp-ts-core": "^0.8.0",
|
|
69
69
|
"mathjs": "^15.2.0",
|
|
70
70
|
"pino-pretty": "^13.1.3"
|
|
71
71
|
},
|
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.
|
|
9
|
+
"version": "0.1.16",
|
|
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.
|
|
22
|
+
"version": "0.1.16",
|
|
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.
|
|
72
|
+
"version": "0.1.16",
|
|
73
73
|
"packageArguments": [
|
|
74
74
|
{
|
|
75
75
|
"type": "positional",
|