Skip to main content
Glama
Michaelndegwa1

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:对数字数组执行基本算术运算(addsubtractmultiplydivide)。

  • scientific_calculation:幂、根(sqrtcbrt)、阶乘、对数(logln)以及三角函数(sincostan)。

  • convert_unit:物理单位换算(长度、质量/重量、温度、体积、时间)。

  • financial_calculator:简单利息、复利、贷款 EMI 计算和百分比。

  • calculate_statistics:汇总统计(meanmedianmodevariancestdevsummary)。


Related MCP server: MCP Mathematics

📦 安装与设置

  1. 安装依赖项

    pip install -r requirements.txt
    pip install -e .
  2. 运行自动化单元测试

    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 中使用:

  1. 完全退出并重新启动 Claude Desktop

  2. 打开一个聊天,然后查看消息栏右下角的 🔨(锤子/工具图标)

  3. 向 Claude 提问:"sqrt(144) + sin(pi / 2) 等于多少?""将 100 degC 转换为 degF"


🌐 2. 连接 Claude Web 与远程 Web 客户端(SSE HTTP 模式)

要将 Calculator MCP 作为 Web HTTP 服务运行(适用于基于 Web 的平台、Web 连接器或远程 AI 代理):

  1. 启动 SSE Web 服务器

    python -m calculator_mcp.server --transport sse --port 8000
  2. Web 客户端配置

    {
      "mcpServers": {
        "calculator-web": {
          "serverUrl": "http://localhost:8000/sse"
        }
      }
    }
  3. 远程 Web 应用的公网隧道(可选): 如果您的 Web 客户端(如远程 Claude Web)托管在本地网络之外,请使用 ngroklocaltunnel 暴露 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.server
F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    -
    quality
    D
    maintenance
    A 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.
    7
    ISC
  • A
    license
    C
    quality
    C
    maintenance
    A 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.
    18
    13
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    A 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

View all related MCP servers

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.

View all MCP Connectors

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/Michaelndegwa1/mcp-tutorials'

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