Calculator MCP Server
Calculator MCP Server (Python)
一个功能丰富的 Model Context Protocol (MCP) 服务器,用于数学计算、科学函数、单位换算、财务指标和统计分析。
使用 Python 3.10+、官方 mcp SDK(FastMCP)和 sympy 构建。支持 stdio(Claude Desktop)和 sse(Claude Web / 远程 HTTP 连接器)两种传输模式。
🚀 功能与公开工具
evaluate_math_expression:使用 SymPy 安全地计算自定义数学表达式(例如2 * (3 + 4)、sqrt(144) + sin(pi / 2)、log(100, 10)、5^3)。perform_arithmetic:对数字数组执行基本算术运算(add、subtract、multiply、divide)。scientific_calculation:幂、根(sqrt、cbrt)、阶乘、对数(log、ln)以及三角函数(sin、cos、tan)。convert_unit:物理单位换算(长度、质量/重量、温度、体积、时间)。financial_calculator:简单利息、复利、贷款 EMI 计算和百分比。calculate_statistics:汇总统计(mean、median、mode、variance、stdev、summary)。
Related MCP server: MCP Mathematics
📦 安装与设置
安装依赖项:
pip install -r requirements.txt pip install -e .运行自动化单元测试:
pytest
💻 1. 连接 Claude Desktop(Stdio 模式)
您的 claude_desktop_config.json 已自动创建在:
C:\Users\ADMIN\AppData\Roaming\Claude\claude_desktop_config.json
{
"mcpServers": {
"calculator": {
"command": "C:\\Users\\ADMIN\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
"args": [
"-m",
"calculator_mcp.server"
],
"env": {
"PYTHONPATH": "E:/mcp tutorials"
}
}
}
}在 Claude Desktop 中使用:
完全退出并重新启动 Claude Desktop。
打开一个聊天,然后查看消息栏右下角的 🔨(锤子/工具图标)。
向 Claude 提问:"sqrt(144) + sin(pi / 2) 等于多少?" 或 "将 100 degC 转换为 degF"。
🌐 2. 连接 Claude Web 与远程 Web 客户端(SSE HTTP 模式)
要将 Calculator MCP 作为 Web HTTP 服务运行(适用于基于 Web 的平台、Web 连接器或远程 AI 代理):
启动 SSE Web 服务器:
python -m calculator_mcp.server --transport sse --port 8000Web 客户端配置:
{ "mcpServers": { "calculator-web": { "serverUrl": "http://localhost:8000/sse" } } }远程 Web 应用的公网隧道(可选): 如果您的 Web 客户端(如远程 Claude Web)托管在本地网络之外,请使用
ngrok或localtunnel暴露 8000 端口:npx localtunnel --port 8000 # Or using ngrok: ngrok http 8000然后在您的 Web MCP 连接器配置中使用生成的公共 HTTPS URL:
https://<your-subdomain>.loca.lt/sse。
🔍 通过 Web 界面进行交互式测试(MCP Inspector)
您可以在浏览器中启动官方的 Model Context Protocol 交互式 Web Inspector UI,以可视化方式测试所有工具:
mcp dev calculator_mcp/server.py或者通过 Node:
npx @modelcontextprotocol/inspector@0.4.1 python -m calculator_mcp.serverThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA comprehensive MCP server that enables file operations, mathematical calculations with unit conversions, and system information retrieval. Provides secure access to local file system, calculator functions with statistics, and system monitoring capabilities.7ISC
- AlicenseCqualityCmaintenanceA comprehensive MCP server that turns any AI assistant into a powerful mathematical computation engine, providing 52 advanced functions, 158 unit conversions, financial calculations, and secure AST-based evaluation.1813MIT
- AlicenseAqualityDmaintenanceA symbolic mathematics MCP server supporting calculus, linear algebra, number theory, statistics, and unit conversion via natural language.8MIT
- Flicense-qualityDmaintenanceA comprehensive MCP server providing basic and advanced math operations (addition, subtraction, statistics, etc.) as well as smart prompts for multiplication tables, equation solving, financial calculations, geometry, unit conversion, loan amortization, probability, and fitness analytics.1
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Educational MCP server with 17 math/stats tools, visualizations, and persistent workspace
Hosted MCP server for business-day math, deadline planning, meeting overlap, and SLA calculations.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Michaelndegwa1/mcp-tutorials'
If you have feedback or need assistance with the MCP directory API, please join our Discord server