HC

huhabla/calculator-mcp-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

63 stars 35 forks 质量 64 趋势 13MIT

huhabla/calculator-mcp-server 是从 https://github.com/huhabla/calculator-mcp-server. 导入的 MCP 服务器候选

概览

huhabla/calculator-mcp-server 是从 https://github.com/huhabla/calculator-mcp-server. 导入的 MCP 服务器候选

概述(AI 翻译)

这是一个模型上下文协议(MCP)服务器,为Claude提供先进的数学计算能力,包括符号数学、统计分析和矩阵运算。

特色

数学计算器MCP服务器提供以下工具:

  • 基础计算:安全评估数学表达式
  • 符号数学:
  • 求解方程(线性、二次、多项式等)
  • 计算表达式的导数
  • 计算表达式的积分
  • 统计分析:
  • 均值、中位数、模数
  • 方差,标准差
  • 相关系数
  • 线性回归
  • 置信区间
  • 矩阵运算:
  • 矩阵加法
  • 矩阵乘法
  • 矩阵换位

安装

先决条件

  • Python 3.10+(推荐:Python 3.11+)
  • UV(推荐)或PIP
  • Claude 桌面应用(用于与 Claude 一起使用 MCP 服务器)

安装步骤

  1. 克隆仓库:

  2. (选项1)使用提供的脚本进行设置:

(选项二)或者手动搭建虚拟环境:

  1. 运行文档测试以验证所有功能:

与 Claude Desktop 的集成

方法1:在Claude桌面中配置

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Mathematical Calculator MCP Server

This is a Model Context Protocol (MCP) server that provides Claude with advanced mathematical calculation capabilities, including symbolic math, statistical analysis, and matrix operations.

Features

The Mathematical Calculator MCP Server provides the following tools:

  • Basic Calculations: Evaluate mathematical expressions safely
  • Symbolic Mathematics:
    • Solve equations (linear, quadratic, polynomial, etc.)
    • Calculate derivatives of expressions
    • Compute integrals of expressions
  • Statistical Analysis:
    • Mean, median, mode
    • Variance, standard deviation
    • Correlation coefficient
    • Linear regression
    • Confidence intervals
  • Matrix Operations:
    • Matrix addition
    • Matrix multiplication
    • Matrix transposition

Installation

Prerequisites

  • Python 3.10+ (recommended: Python 3.11+)
  • uv (recommended) or pip
  • Claude Desktop app (to use the MCP server with Claude)

Installation Steps

  1. Clone the repository:

    git clone https://github.com/huhabla/calculator-mcp-server.git
    cd calculator-mcp-server
    
  2. (Option 1) Setup with the provided script:

    chmod +x setup_venv.sh
    ./setup_venv.sh
    

    (Option 2) Or manually set up the virtual environment:

    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    
  3. Run doc-tests to verify everything works:

    bash run_doctests.sh
    

Integration with Claude Desktop

Method 1: Configure in Claude Desktop

Add the server to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json

Add the following to the mcpServers section:

{
  "mcpServers": {
    "calculator": {
      "command": "uvx",
      "args": [
        "--from",
        "calculator-mcp-server@git+https://github.com/huhabla/calculator-mcp-server.git",
        "--",
        "calculator-mcp-server",
        "--stdio"
      ]
    }
  }
}

Note: The --stdio flag is required for proper integration with Claude Desktop. The -- separates uvx arguments from the calculator server arguments.

Method 2: Install with FastMCP

  1. Make sure you have uv installed (Installation Guide)

  2. Install the MCP server in Claude Desktop:

    fastmcp install calculator_server.py
    

    Or with a custom name:

    fastmcp install calculator_server.py --name "Math Calculator"
    
  3. Once installed, Claude will automatically have access to all the mathematical tools and functions.

Usage Examples

After integrating with Claude Desktop, you can ask Claude to perform various mathematical operations. Here are some examples:

Basic Calculations

Can you calculate 3.5^2 * sin(pi/4)?

Solving Equations

在 GitHub 查看完整 README

安装

uvx --from calculator-mcp-server@git+https://github.com/huhabla/calculator-mcp-server.git -- calculator-mcp-server --stdio
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "calculator": { "command": "uvx", "args": [ "--from", "calculator-mcp-server@git+https://github.com/huhabla/calculator-mcp-server.git", "--", "calculator-mcp-server", "--stdio" ] } } }