Skip to main content
Glama
cyanheads

calculator-mcp-server

by cyanheads

Version License Docker MCP SDK npm TypeScript Bun

Install in Claude Desktop Install in Cursor Install in VS Code

Framework

公開ホスト型サーバー: https://calculator.caseyjhand.com/mcp


ツール

すべての数学演算をカバーする 1 つのツール:

ツール名

説明

calculate

数式の評価、代数式の簡約、または記号微分の計算を実行します。

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: math-mcp

リソース

URI パターン

説明

calculator://help

利用可能な関数、演算子、定数、および構文リファレンス。


機能

@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"
      ]
    }
  }
}

前提条件

インストール

  1. リポジトリをクローン:

git clone https://github.com/cyanheads/calculator-mcp-server.git
  1. ディレクトリに移動:

cd calculator-mcp-server
  1. 依存関係をインストール:

bun install

設定

変数

説明

デフォルト

CALC_MAX_EXPRESSION_LENGTH

許可される式の最大文字列長(10〜10,000)。

1000

CALC_EVALUATION_TIMEOUT_MS

最大評価時間(ミリ秒)(100〜30,000)。

5000

CALC_MAX_RESULT_LENGTH

結果の最大文字列長(文字数)(1,000〜1,000,000)。

100000

MCP_TRANSPORT_TYPE

トランスポート: stdio または http

stdio

MCP_HTTP_HOST

HTTP サーバーのホスト名。

localhost

MCP_HTTP_PORT

HTTP サーバーのポート。

3010

MCP_HTTP_ENDPOINT_PATH

HTTP MCP エンドポイントのパス。

/mcp

MCP_HTTP_MAX_BODY_BYTES

受信 HTTP リクエストの最大サイズ。0 で制限を無効化。

1048576

MCP_AUTH_MODE

認証モード: nonejwt、または oauth

none

MCP_LOG_LEVEL

ログレベル(RFC 5424)。

info

オプションのセッション、再開可能性、ロギング、およびテレメトリ設定については .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 へのログ出力を使用します。


プロジェクト構造

ディレクトリ

目的

src/mcp-server/tools/

ツール定義(*.tool.ts)。

src/mcp-server/resources/

リソース定義(*.resource.ts)。

src/services/

ドメインサービス統合(MathService)。

src/config/

Zod による環境変数の解析と検証。

docs/

生成されたディレクトリツリー。


開発ガイド

開発ガイドラインとアーキテクチャルールについては AGENTS.md または CLAUDE.md を参照してください。要点:

  • ハンドラーは例外をスローし、フレームワークがキャッチ — ツールロジックに try/catch は不要

  • ロギングには ctx.log を使用

  • 新しいツールとリソースは src/index.ts に登録


コントリビューション

Issue とプルリクエストを歓迎します。提出前にチェックを実行してください:

bun run devcheck
bun run test

ライセンス

Apache-2.0 — 詳細は LICENSE を参照してください。

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessResponsive

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    A
    maintenance
    Provides secure mathematical computation capabilities including expression evaluation, symbolic math (derivatives, simplification), matrix operations, statistics, and unit conversion, with multi-tier acceleration through WebAssembly and WebWorkers for high-performance calculations.
    7
    178
    ISC
  • A
    license
    A
    quality
    C
    maintenance
    A secure MCP server for evaluating mathematical expressions with grammar validation, function whitelisting, and sandboxed execution. It provides tools for expression evaluation, variable management, and resources for grammar and function documentation.
    6
    37
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    High-precision mathematics server for MCP clients, providing exact integer arithmetic, symbolic derivatives, and numerical calculus via LaTeX-style input.
    6
    17
    2
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Provides 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.
    4
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/cyanheads/calculator-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server