calculator-mcp-server
公開ホスト型サーバー: https://calculator.caseyjhand.com/mcp
ツール
すべての数学演算をカバーする 1 つのツール:
ツール名 | 説明 |
| 数式の評価、代数式の簡約、または記号微分の計算を実行します。 |
calculate
サーバーの目的の 100% をカバーする単一のツールです。operation パラメータはデフォルトで evaluate になるため、一般的なケースでは { expression: "..." } だけで済みます。
Evaluate(評価) — 算術、三角関数、対数、統計、行列、複素数、単位変換、組合せ論
Simplify(簡約) — 代数式を記号的(シンボリック)に簡約します(例:
2x + 3x->5 * x)。代数恒等式と三角関数の恒等式に対応Derivative(微分) — 記号的微分を計算します(例:
3x^2 + 2x + 1->6 * x + 2)scopeパラメータによる変数スコープ:{ "x": 5, "y": 3 }数値結果の精度を設定可能
フォームベースの MCP クライアントからの空のオプション
variableおよびprecision値は、省略されたものとして扱われます
Related MCP server: pycodemath
リソース
URI パターン | 説明 |
| 利用可能な関数、演算子、定数、および構文リファレンス。 |
機能
@cyanheads/mcp-ts-core をベースに構築:
宣言型ツール定義 — ツールごとに 1 ファイル、フレームワークが登録と検証を処理
全ツールにわたる統一エラー処理
オプションの OpenTelemetry トレーシングを備えた構造化ロギング
ローカル(stdio/HTTP)または Docker で実行
電卓固有の機能:
強化された math.js v15 インスタンス — 危険な関数は無効化、評価は
vm.runInNewContext()によるタイムアウト付きサンドボックスで実行認証不要 — すべての操作は読み取り専用かつステートレス
入力検証: 式の長さ制限、式セパレータの拒否(セミコロンと改行)、数値のみのスコープ値
結果検証: ブロックされた結果タイプ(関数、パーサー、結果セット)、設定可能な最大結果サイズ
スコープのサニタイズ: 数値のみの値、プロトタイプ汚染の防止(
__proto__、constructorなどをブロック)
はじめに
公開ホスト型インスタンス
公開インスタンスは https://calculator.caseyjhand.com/mcp で利用可能です — インストールは不要です。Streamable HTTP 経由で任意の MCP クライアントから接続できます:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "streamable-http",
"url": "https://calculator.caseyjhand.com/mcp"
}
}
}セルフホスト / ローカル
以下のいずれかを MCP クライアントの設定ファイルに追加してください:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": ["@cyanheads/calculator-mcp-server@latest"]
}
}
}または npx を使用(Bun 不要):
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@cyanheads/calculator-mcp-server@latest"]
}
}
}または Docker を使用:
{
"mcpServers": {
"calculator-mcp-server": {
"type": "stdio",
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "MCP_TRANSPORT_TYPE=stdio",
"ghcr.io/cyanheads/calculator-mcp-server:latest"
]
}
}
}前提条件
Bun v1.3.0 以上
インストール
リポジトリをクローン:
git clone https://github.com/cyanheads/calculator-mcp-server.gitディレクトリに移動:
cd calculator-mcp-server依存関係をインストール:
bun install設定
変数 | 説明 | デフォルト |
| 許可される式の最大文字列長(10〜10,000)。 |
|
| 最大評価時間(ミリ秒)(100〜30,000)。 |
|
| 結果の最大文字列長(文字数)(1,000〜1,000,000)。 |
|
| トランスポート: |
|
| HTTP サーバーのホスト名。 |
|
| HTTP サーバーのポート。 |
|
| HTTP MCP エンドポイントのパス。 |
|
| 受信 HTTP リクエストの最大サイズ。 |
|
| 認証モード: |
|
| ログレベル(RFC 5424)。 |
|
オプションのセッション、再開可能性、ロギング、およびテレメトリ設定については .env.example を参照してください。
サーバーの実行
ローカル開発
本番バージョンのビルドと実行:
bun run build bun run start:http # or start:stdioチェックとテストの実行:
bun run devcheck # Lints, formats, type-checks bun run test # Runs test suite
Docker
docker build -t calculator-mcp-server .
docker run -p 3010:3010 calculator-mcp-serverこのイメージはデフォルトでポート 3010 の Streamable HTTP、ステートレスセッション、および /var/log/calculator-mcp-server へのログ出力を使用します。
プロジェクト構造
ディレクトリ | 目的 |
| ツール定義( |
| リソース定義( |
| ドメインサービス統合(MathService)。 |
| Zod による環境変数の解析と検証。 |
| 生成されたディレクトリツリー。 |
開発ガイド
開発ガイドラインとアーキテクチャルールについては AGENTS.md または CLAUDE.md を参照してください。要点:
ハンドラーは例外をスローし、フレームワークがキャッチ — ツールロジックに
try/catchは不要ロギングには
ctx.logを使用新しいツールとリソースは
src/index.tsに登録
コントリビューション
Issue とプルリクエストを歓迎します。提出前にチェックを実行してください:
bun run devcheck
bun run testライセンス
Apache-2.0 — 詳細は LICENSE を参照してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Math.js MCP — wraps the mathjs.org API (free, no auth)
Safe scientific calculator MCP for numeric expressions
Newton MCP — wraps the Newton math solver API (free, no auth)
Find and call the right MCP server for any task - pay per use, no install.
Related MCP Servers
- AlicenseBqualityDmaintenanceHigh-precision mathematics server for MCP clients, providing exact integer arithmetic, symbolic derivatives, and numerical calculus via LaTeX-style input.65 npm2MIT
- AlicenseNot gradedqualityBmaintenanceProvides a token-efficient exact math engine for AI agents, enabling computation of derivatives, integrals, equations, and optimized Python/NumPy code via a single MCP tool.8MIT
- AlicenseAqualityDmaintenanceSafe MCP server for math operations: evaluate, simplify, and differentiate expressions with configurable precision, using a sandboxed worker thread and strict AST allowlist to block dangerous input.3MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI agents to perform safe sandboxed expression evaluation, symbolic calculus such as derivatives, simplification, equation solving and integration, statistical analysis, and JSON-native matrix operations. Everything is computed statelessly through the Model Context Protocol over stdio, HTTP, or SSE.118 npmMIT