@cyanheads/calculator-mcp-server 0.1.15 → 0.1.17
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 +1 -1
- package/CLAUDE.md +1 -1
- package/README.md +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 +28 -12
- package/dist/services/math/math-service.js.map +1 -1
- package/package.json +1 -1
- 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.17
|
|
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.
|
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.17
|
|
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.
|
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,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,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AAC,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.
|
|
@@ -29,6 +29,16 @@ const TRIG_SIMPLIFY_RULES = [
|
|
|
29
29
|
'2 * sin(n) * cos(n) -> sin(2 * n)',
|
|
30
30
|
'cos(n)^2 - sin(n)^2 -> cos(2 * n)',
|
|
31
31
|
];
|
|
32
|
+
/**
|
|
33
|
+
* Custom units registered during service init. math.js disables `createUnit`
|
|
34
|
+
* in the expression scope, so these are added programmatically before the
|
|
35
|
+
* disabling step. Definitions use exact SI-derived values where possible.
|
|
36
|
+
*/
|
|
37
|
+
const CUSTOM_UNITS = {
|
|
38
|
+
mph: '1 mile/hour',
|
|
39
|
+
knot: { definition: '1852 m/hour', aliases: ['knots', 'kt', 'kts'] },
|
|
40
|
+
lightyear: { definition: '9460730472580800 m', aliases: ['lightyears', 'ly'] },
|
|
41
|
+
};
|
|
32
42
|
/**
|
|
33
43
|
* Functions disabled in the expression scope for security.
|
|
34
44
|
* These are overridden via math.import() — expressions cannot call them.
|
|
@@ -123,6 +133,10 @@ export class MathService {
|
|
|
123
133
|
this.simplifyRules = [...math.simplify.rules, ...TRIG_SIMPLIFY_RULES];
|
|
124
134
|
this.format = math.format.bind(math);
|
|
125
135
|
this.typeOf = math.typeOf.bind(math);
|
|
136
|
+
// Register custom units and natural-language function aliases.
|
|
137
|
+
// Must run before createUnit/import are disabled below.
|
|
138
|
+
math.createUnit(CUSTOM_UNITS);
|
|
139
|
+
math.import({ average: math.mean, avg: math.mean });
|
|
126
140
|
// Disable dangerous functions in expression scope
|
|
127
141
|
const disabled = {};
|
|
128
142
|
for (const fn of DISABLED_FUNCTIONS) {
|
|
@@ -143,7 +157,7 @@ export class MathService {
|
|
|
143
157
|
this.validateScope(scope);
|
|
144
158
|
const raw = this.runWithTimeout(() => scope ? this.evaluate(expression, scope) : this.evaluate(expression));
|
|
145
159
|
if (typeof raw === 'number' && !Number.isFinite(raw)) {
|
|
146
|
-
throw
|
|
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' });
|
|
147
161
|
}
|
|
148
162
|
const resultType = this.typeOf(raw);
|
|
149
163
|
this.validateResultType(resultType);
|
|
@@ -179,33 +193,35 @@ export class MathService {
|
|
|
179
193
|
}
|
|
180
194
|
validateInput(expression) {
|
|
181
195
|
if (!expression.trim()) {
|
|
182
|
-
throw
|
|
196
|
+
throw validationError('Expression cannot be empty.', { reason: 'empty_expression' });
|
|
183
197
|
}
|
|
184
198
|
if (expression.length > this.config.maxExpressionLength) {
|
|
185
|
-
throw
|
|
199
|
+
throw validationError(`Expression exceeds maximum length of ${this.config.maxExpressionLength} characters.`, { reason: 'expression_too_long' });
|
|
186
200
|
}
|
|
187
201
|
if (hasExpressionSeparator(expression)) {
|
|
188
|
-
throw
|
|
202
|
+
throw validationError('Multiple expressions are not allowed. Submit one expression per call.', {
|
|
203
|
+
reason: 'multiple_expressions',
|
|
204
|
+
});
|
|
189
205
|
}
|
|
190
206
|
}
|
|
191
207
|
/** Reject scope keys that could pollute the object prototype chain. */
|
|
192
208
|
validateScope(scope) {
|
|
193
209
|
for (const key of Object.keys(scope)) {
|
|
194
210
|
if (BLOCKED_SCOPE_KEYS.has(key)) {
|
|
195
|
-
throw
|
|
211
|
+
throw validationError(`Scope key "${key}" is not allowed — it conflicts with a reserved property name.`, { reason: 'reserved_scope_key' });
|
|
196
212
|
}
|
|
197
213
|
}
|
|
198
214
|
}
|
|
199
215
|
/** Reject result types that leak internals (functions, parsers, multi-expression ResultSets). */
|
|
200
216
|
validateResultType(resultType) {
|
|
201
217
|
if (BLOCKED_RESULT_TYPES.has(resultType)) {
|
|
202
|
-
throw
|
|
218
|
+
throw validationError(`Expression produced a ${resultType} — only numeric, string, matrix, complex, unit, and boolean results are allowed.`, { reason: 'disallowed_result_type' });
|
|
203
219
|
}
|
|
204
220
|
}
|
|
205
221
|
/** Reject results that exceed the configured maximum size. */
|
|
206
222
|
validateResultSize(result) {
|
|
207
223
|
if (result.length > this.config.maxResultLength) {
|
|
208
|
-
throw
|
|
224
|
+
throw validationError(`Result exceeds maximum size (${this.config.maxResultLength} characters). Reduce matrix dimensions or simplify the expression.`, { reason: 'result_too_large' });
|
|
209
225
|
}
|
|
210
226
|
}
|
|
211
227
|
/** Runs a synchronous function inside a vm sandbox with timeout protection. */
|
|
@@ -218,11 +234,11 @@ export class MathService {
|
|
|
218
234
|
}
|
|
219
235
|
catch (err) {
|
|
220
236
|
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
|
|
237
|
+
throw serviceUnavailable(`Expression evaluation timed out after ${this.config.evaluationTimeoutMs / 1000} seconds. Simplify the expression or reduce matrix dimensions.`, { reason: 'evaluation_timeout' });
|
|
222
238
|
}
|
|
223
239
|
// All non-timeout errors from the VM are expression-related
|
|
224
240
|
const message = err instanceof Error ? err.message : String(err);
|
|
225
|
-
throw
|
|
241
|
+
throw validationError(`Invalid expression: ${message}`, { reason: 'parse_failed' });
|
|
226
242
|
}
|
|
227
243
|
}
|
|
228
244
|
}
|
|
@@ -275,7 +291,7 @@ abs, ceil, floor, round, sign, sqrt, cbrt, exp, expm1, log, log2, log10, log1p,
|
|
|
275
291
|
sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, tanh, asinh, acosh, atanh, sec, csc, cot, asec, acsc, acot, sech, csch, coth
|
|
276
292
|
|
|
277
293
|
### Statistics
|
|
278
|
-
mean, median, mode, std, variance, min, max, sum, prod, quantileSeq, mad, count
|
|
294
|
+
mean (aliases: average, avg), median, mode, std, variance, min, max, sum, prod, quantileSeq, mad, count
|
|
279
295
|
|
|
280
296
|
### Matrix
|
|
281
297
|
det, inv, transpose, trace, zeros, ones, identity, diag, size, reshape, flatten, concat, sort, cross, dot, eigs, expm, sqrtm, kron, pinv, range
|
|
@@ -295,7 +311,7 @@ equal, unequal, larger, largerEq, smaller, smallerEq, compare, deepEqual
|
|
|
295
311
|
### Unit Conversion
|
|
296
312
|
Syntax: \`value unit to targetUnit\`
|
|
297
313
|
|
|
298
|
-
Common units: m, cm, mm, km, inch, ft, yard, mile, kg, g, lb, oz, s, min, hour, day, celsius, fahrenheit, kelvin, liter, gallon, joule, watt, newton, pascal, bar, psi, radian, degree
|
|
314
|
+
Common units: m, cm, mm, km, inch, ft, yard, mile, lightyear (ly), kg, g, lb, oz, s, min, hour, day, mph, knot (kt), celsius, fahrenheit, kelvin, liter, gallon, joule, watt, newton, pascal, bar, psi, radian, degree
|
|
299
315
|
|
|
300
316
|
## Syntax Examples
|
|
301
317
|
|
|
@@ -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,EAA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AAM,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.17",
|
|
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",
|
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.17",
|
|
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.17",
|
|
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.17",
|
|
73
73
|
"packageArguments": [
|
|
74
74
|
{
|
|
75
75
|
"type": "positional",
|