MCP Calculate Server
MCP 計算サーバー
MCPプロトコルとSymPyライブラリに基づいた数学計算サービスであり、強力な記号計算機能を提供します。
セキュリティ
バージョン 0.1.1 時点で、このサーバーは制限されたSymPy専用の評価器を通じて式を解析します。任意のPythonコードを実行することはなく、厳選された数学記号、関数、および行列メソッドのみがサポートされています。
また、このリリースでは、高コストな記号計算によるサービス拒否(DoS)リスクを軽減するため、過大な式や巨大な結果に対する検証機能が追加されました。
Related MCP server: mcp-sympy
主な機能
基本演算: 加算、減算、乗算、除算、べき乗
代数演算: 式の展開、因数分解、簡略化
微積分: 微分、積分(定積分/不定積分)、極限計算
方程式の解法: 代数方程式、連立方程式
行列演算: 行列の逆行列、固有値/固有ベクトルの計算
級数展開: テイラー級数展開
特殊関数: 三角関数、対数関数、指数関数
使用例
# Basic operations
"2 + 3*5" → 17
# Algebraic operations
"expand((x + 1)**2)" → x² + 2x + 1
"factor(x**2 - 2*x - 15)" → (x - 5)(x + 3)
# Calculus
"diff(sin(x), x)" → cos(x)
"integrate(exp(x), (x, 0, 1))" → E - 1
"integrate(exp(-x**2)*sin(x), (x, -oo, oo))" → 0
"limit(tan(x)/x, x, 0)" → 1
# Equation solving
"solve(x**2 - 4, x)" → [-2, 2]
"solve([x**2 + y**2 - 1, x + y - 1], [x, y])" → [(0, 1), (1, 0)]
# Matrix operations
"Matrix([[1, 2], [3, 4]]).inv()" → [[-2, 1], [3/2, -1/2]]
"Matrix([[1, 2, 3], [4, 5, 6]]).eigenvals()" → {9/2 - sqrt(33)/2: 1, 9/2 + sqrt(33)/2: 1}
"Sum(k, (k, 1, 10)).doit()" → 55
"series(cos(x), x, 0, 4)" → 1 - x²/2 + O(x⁴)インストール
Smithery経由でのインストール
Smithery を使用してClaude Desktop用のCalculate Serverを自動的にインストールするには:
npx -y @smithery/cli install @611711Dark/mcp_sympy_calculate_server --client claudeローカルインストール
リポジトリをクローンします:
git clone https://github.com/611711Dark/mcp_calculate_server.git cd mcp_calculate_server仮想環境を作成し、依存関係をインストールします:
uv venv source .venv/bin/activate uv pip install -e .設定:
"calculate_expression1": { "isActive": false, "command": "python", "args": [ "server.py" ], "cwd": "/path/to/mcp_calculate_server" }
APIの使用方法
数学的な式文字列を渡すことで、MCPプロトコル経由で calculate_expression ツールを呼び出します。パーサーは、算術演算、expand、factor、simplify、diff、integrate、limit、series、solve、Matrix(...).det()/inv()/eigenvals()/eigenvects()、および Sum(...).doit() といった制限されたSymPy式のセットを受け入れます。
サポートされている名前
記号:
x、y、z、kなどの小文字の変数定数:
pi、E、oo、I関数:
Abs、sin、cos、tan、log、exp、sqrt、expand、factor、simplify、diff、integrate、limit、series、solve、Sum、Matrix行列メソッド:
.det()、.inv()、.eigenvals()、.eigenvects()SymPyメソッド:
Sum(...)などのサポート対象オブジェクトに対する.doit()
検証ルール
任意のPython機能、インポート、ファイルシステムアクセス、またはその他の数学的でない構成要素に依存する式は、意図的に拒否されます。 非常に大きな展開、複雑度の高い解法、および過大な結果も、サービス拒否リスクを軽減するために拒否される場合があります。 キーワード引数、プライベート属性、サポートされていない行列メソッド、不正な形式の行列、およびサポートされていない名前は、エラーメッセージとともに拒否されます。
依存関係
mcp>=1.5.0
sympy>=1.13.3
謝辞
導入にあたり こちらのブログ記事 に感謝します。また、Stefano 氏の協力と責任ある開示に感謝します。
ライセンス
このプロジェクトはMITライセンスの下でライセンスされています。LICENSE ファイルを参照してください。
Available Tools
1 toolcalculate_expressionA
calculate mathematical expressions using the sympify function from sympy, parse and compute the input mathematical expression string, supports direct calls to SymPy functions (automatically recognizes x, y, z as symbolic variables)
Parameters:
expression (str): Mathematical expression, e.g., "223 - 344 * 6" or "sin(pi/2) + log(10)".Replace special symbols with approximate values, e.g., pi → 3.1415"
Example expressions:
"2 + 3*5" # Basic arithmetic → 17
"expand((x + 1)2)" # Expand → x² + 2x + 1
"diff(sin(x), x)" # Derivative → cos(x)
"integrate(exp(x), (x, 0, 1))" # Definite integral → E - 1
"solve(x2 - 4, x)" # Solve equation → [-2, 2]
"limit(tan(x)/x, x, 0)" # Limit → 1
"Sum(k, (k, 1, 10)).doit()" # Summation → 55
"Matrix([[1, 2], [3, 4]]).inv()" # Matrix inverse → [[-2, 1], [3/2, -1/2]]
"simplify((x2 - 1)/(x + 1))" # Simplify → x - 1
"factor(x2 - 2*x - 15)" # Factorize → (x - 5)(x + 3)
"series(cos(x), x, 0, 4)" # Taylor series → 1 - x²/2 + x⁴/24 + O(x⁴)
"integrate(exp(-x*2)*sin(x), (x, -oo, oo))" # Complex integral
"solve([x**2 + y*2 - 1, x + y - 1], [x, y])" # Solve system of equations
"Matrix([[1, 2, 3], [4, 5, 6], [7, 8, 9]]).eigenvals()" # Matrix eigenvalues
Returns:
str: Calculation result. If the expression cannot be parsed or computed, returns an error message (str).
Inputs: expression (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
With only one tool, there is no possibility of ambiguity or confusion between tools. The single tool 'calculate_expression' has a clearly defined purpose that cannot be mistaken for any other tool in this server.
The single tool name 'calculate_expression' follows a clear verb_noun pattern. With only one tool, naming consistency is inherently perfect as there are no other tools to compare against or create inconsistencies with.
A single tool server is generally too minimal for most practical purposes, even for a focused domain like mathematical calculation. While the tool is powerful, having only one tool feels thin and limiting for what appears to be a comprehensive mathematical computation server.
The single tool covers a wide range of mathematical operations through expression parsing, but there are notable gaps in the surface area. For a calculation server, one might expect separate tools for different mathematical domains (algebra, calculus, matrix operations) or at least tools for common specific operations beyond general expression evaluation.
Maintenance
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Unofficial Math.js MCP — wraps the mathjs.org API (free, no auth)
Exact arithmetic, algebra, calculus, physics, chemistry and finance with a checkable formula.
Calculators accessible via MCP with real-time collaborative sessions and shareable URLs.
Related MCP Servers
- AlicenseCqualityFmaintenanceA Mathematical Computation Protocol server providing 286 mathematical functions across multiple domains with flexible transport options (STDIO/HTTP) and streaming capabilities.1004Apache 2.0
- AlicenseCqualityDmaintenanceAn MCP server that provides access to SymPy's symbolic mathematics library for advanced algebraic computations. It enables users to perform complex tasks such as symbolic simplification, calculus, equation solving, matrix operations, and number theory.10050 PyPI1MIT
- AlicenseAqualityDmaintenanceA symbolic mathematics MCP server supporting calculus, linear algebra, number theory, statistics, and unit conversion via natural language.8MIT
- AlicenseBqualityDmaintenanceHigh-precision mathematics server for MCP clients, providing exact integer arithmetic, symbolic derivatives, and numerical calculus via LaTeX-style input.65 npm2MIT