Token导航 LogoToken导航TokenDH.com
Chuk MCP Math Server logo
AI代理stdio官方级别未说明来源级核验

Chuk MCP Math Server

MCP Server

基于高性能chuk-mcp-server框架构建的可配置数学计算协议服务器,提供642种数学函数和灵活的传输选项,适用于各种数学计算场景。

工具数

29

提示词数

0

GitHub Stars

4

资源数

0
数学计算PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

IBM

提供方

IBM

最后核验

2026/5/17 20:21

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uvx chuk-mcp-math-server

详细介绍

🧮 Chuk MCP数学服务器

](https://badge.fury.io/py/chuk-mcp-math-server) ![Python 3.11+](https://www.python.org/downloads/) ![Tests](https://github.com/chuk-mcp/chuk-mcp-math-server/actions) ![Coverage](https://github.com/chuk-mcp/chuk-mcp-math-server) ![License: Apache 2.0](https://opensource.org/licenses/Apache-2.0)

高度可配置 数学计算协议(MCP)服务器 它提供了全面的数学函数和灵活的传输选项。基于高性能chuk-mcp服务器框架构建。

⚡ 演出

  • 36000+转/分 峰值吞吐量(继承自chuk mcp服务器)
  • 低于3毫秒的延迟 每次工具调用
  • 642数学函数 可用的
  • 零配置启动 -开箱即用

✨ 特性

🔢 数学能力

  • 642数学函数 跨多个域
  • 数论:素数测试、因子分解、GCD、LCM、序列(328个函数)
  • 算术:基本操作、高级计算(44个功能)
  • 三角学:综合三角运算(71个函数)
  • 线性代数:向量和矩阵运算(33个函数)
  • 统计:描述性和推理统计(15个函数)
  • 微积分:衍生工具、集成、根查找(9个功能)
  • 几何:形状、距离、交点(12个函数)
  • 概率:分配职能(10个职能)
  • 高级操作:复杂的数学运算(22个函数)
  • 序列:数学序列(12个函数)
  • 常量:数学常数(25个函数)
  • 转化:单位和类型转换(7个功能)
  • 实时计算:具有适当错误处理的异步处理
  • 功能过滤:可按域、类别或功能配置allowlists和denylists

🚀 交通与建筑

  • 双重运输:STDIO(克劳德桌面)和HTTP支持
  • 高性能:基于chuk-mcp服务器框架构建
  • 自动检测:自动选择最佳运输模式
  • 生产就绪:36000+RPS,延迟\ 💡 现在试试! 使用我们的免费公共服务器 https://math.chukai.io/mcp -无需安装!看 公用服务器 下面的部分。

安装

使用uvx(推荐-无需安装!)

使用服务器的最简单方法是 uvx,无需安装即可运行:

uvx chuk-mcp-math-server

这将自动下载并运行最新版本。非常适合克劳德桌面!

使用紫外线(建议用于开发)

# Install from PyPI
uv pip install chuk-mcp-math-server

# Or clone and install from source
git clone https://github.com/chuk-mcp/chuk-mcp-math-server.git
cd chuk-mcp-math-server
uv sync

使用pip(传统)

pip install chuk-mcp-math-server

基本用法

STDIO传输(克劳德桌面)

# Start server with STDIO transport (default)
uv run chuk-mcp-math-server

# Starts immediately with all 642 functions available

HTTP传输(Web API)

# Start HTTP server
uv run chuk-mcp-math-server --transport http --port 8000

# Server will be available at http://localhost:8000

Claude桌面集成

添加到您的Claude桌面配置(~/Library/Application Support/Claude/claude_desktop_config.json 在macOS上):

选项1:使用公共服务器(最简单)

连接到托管的公共服务器:

{
  "mcpServers": {
    "math": {
      "command": "uvx",
      "args": [
        "chuk-mcp-client",
        "https://math.chukai.io/mcp"
      ]
    }
  }
}

这不需要本地安装,并且始终是最新的!

选项2:使用uvx在本地运行

{
  "mcpServers": {
    "math": {
      "command": "uvx",
      "args": ["chuk-mcp-math-server"]
    }
  }
}

选项3:使用本地安装在本地运行

{
  "mcpServers": {
    "math": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/chuk-mcp-math-server",
        "run",
        "chuk-mcp-math-server"
      ]
    }
  }
}

重要提示: 使用绝对路径,而不是相对路径或 ~ 路径。

重新启动Claude Desktop并问:“你能检查97是否是素数吗?”-Claude将使用数学服务器!

HTTP API使用示例

# Test the server
curl http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/list"
  }'

# Call a mathematical function
curl http://localhost:8000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "is_prime",
      "arguments": {"n": 97}
    }
  }'

📖 文档

可用功能

服务器提供 642数学函数 跨越这些领域:

函数示例
算术与数论 (420)基本运算、素数、序列、可分性add, multiply, modulo, is_prime, fibonacci, gcd
三角学 (71)三角函数,双曲线,转换sin, cos, tan, sinh, radians_to_degrees
线性代数 (33)向量和矩阵运算dot_product, cross_product, matrix_multiply
统计 (15)描述性统计mean, median, std_dev, variance
微积分 (9)衍生品、整合、根查找derivative, integrate, newton_raphson
几何 (12)形状、距离、交点circle_area, distance, triangle_area
概率 (10)分配功能normal_pdf, binomial_pmf
其他 (17)高级操作、序列、常量、转换factorial, combinations, pi_digits

功能过滤

控制暴露的功能:

# Only expose specific functions
chuk-mcp-math-server --functions add subtract multiply divide

# Expose only arithmetic domain
chuk-mcp-math-server --domains arithmetic

# Exclude specific functions
chuk-mcp-math-server --exclude-functions slow_function

# Combine filters
chuk-mcp-math-server --domains arithmetic number_theory --categories core primes

配置选项

命令行

# Basic configuration
chuk-mcp-math-server --transport http --port 8080 --host 0.0.0.0

# Function filtering
chuk-mcp-math-server --domains arithmetic --functions is_prime add

# Performance tuning
chuk-mcp-math-server --cache-strategy smart --timeout 60

# Logging
chuk-mcp-math-server --verbose  # Debug logging
chuk-mcp-math-server --quiet    # Minimal logging

配置文件

# config.yaml
transport: "http"
port: 8000
host: "0.0.0.0"
log_level: "INFO"

# Function filtering (allowlist: only these are enabled, denylist: these are excluded)
domain_allowlist: ["arithmetic", "number_theory"]
function_allowlist: ["is_prime", "fibonacci", "add", "multiply"]
function_denylist: ["deprecated_function"]  # Exclude specific functions

# Performance
cache_strategy: "smart"
cache_size: 1000
computation_timeout: 30.0
max_concurrent_calls: 10
# Use configuration file
chuk-mcp-math-server --config config.yaml

# Save current config
chuk-mcp-math-server --domains arithmetic --save-config my-config.yaml

# Show current config
chuk-mcp-math-server --show-config

MCP资源

服务器提供了用于自检的内置资源:

# List available functions (via MCP resource)
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "resources/read",
  "params": {
    "uri": "math://available-functions"
  }
}

# Get function statistics
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "resources/read",
  "params": {
    "uri": "math://function-stats"
  }
}

# Get server configuration
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "resources/read",
  "params": {
    "uri": "math://server-config"
  }
}

🛠️ 发展

项目结构

chuk-mcp-math-server/
├── src/chuk_mcp_math_server/
│   ├── __init__.py              # Package initialization
│   ├── cli.py                   # CLI implementation
│   ├── config.py                # Base configuration (Pydantic)
│   ├── math_config.py           # Math-specific configuration
│   ├── function_filter.py       # Function filtering logic
│   └── math_server.py           # Main server (uses chuk-mcp-server)
├── tests/                       # Test suite (97% coverage, 114 tests)
├── pyproject.toml              # Project configuration
└── README.md                   # This file

开发设置

# Clone the repository
git clone https://github.com/chuk-mcp/chuk-mcp-math-server.git
cd chuk-mcp-math-server

# Install development dependencies
uv sync

# Install in editable mode
uv pip install -e ".[dev]"

运行测试

# Run tests
make test

# Run tests with coverage
make test-cov

# Run specific test file
uv run pytest tests/test_config.py -v

代码质量

# Run all quality checks (lint, typecheck, security, tests)
make check

# Format code
make format

# Run linting
make lint

# Run type checking
make typecheck

# Run security checks
make security

建筑

# Build distribution packages
make build

# This creates wheel and source distributions in dist/

本地运行

# Run with verbose logging
uv run chuk-mcp-math-server --verbose

# Run HTTP server
make run-http

# Run STDIO server (default)
make run

自定义服务器

from chuk_mcp_math_server import create_math_server

# Create server with custom configuration
server = create_math_server(
    transport="http",
    port=9000,
    domain_allowlist=["arithmetic"],  # Only arithmetic functions
    function_denylist=["deprecated_func"],  # Exclude specific functions
    log_level="DEBUG"
)

# Run the server
server.run()

🚀 部署

码头工人

使用Docker构建和运行:

# Build the Docker image
make docker-build

# Run the container
make docker-run

# Or manually:
docker build -t chuk-mcp-math-server .
docker run -p 8000:8000 chuk-mcp-math-server

服务器将在以下时间可用 http://localhost:8000.

Fly.io

部署到公共服务器的Fly.io:

# Install flyctl if you haven't already
curl -L https://fly.io/install.sh | sh

# Login to Fly.io
flyctl auth login

# Deploy (first time)
flyctl launch

# Or deploy updates
flyctl deploy

# Check status
flyctl status

# View logs
flyctl logs

fly.toml 端口8000上的HTTP模式配置已设置。服务器将根据流量自动缩放(最小0,自动启动/停止)。

环境变量

通过Fly.io secrets进行配置:

# Set environment variables
flyctl secrets set MCP_SERVER_LOG_LEVEL=INFO
flyctl secrets set MCP_MATH_CACHE_STRATEGY=smart

# View secrets
flyctl secrets list

GitHub操作

该存储库包括自动化工作流:

  • 测试:在所有PR和提交上运行(Ubuntu、Windows、macOS)
  • 发布:推送标签时创建GitHub版本
  • 发布:在发布时自动发布到PyPI
  • 飞行部署:在主分支推送时自动部署到Fly.io

要创建版本,请执行以下操作:

# Bump version in pyproject.toml
make bump-patch  # or bump-minor, bump-major

# Commit the version change
git add pyproject.toml uv.lock
git commit -m "Bump version to 0.2.1"
git push

# Create and push a tag to trigger release
make publish

这将自动:

  1. 使用changelog创建GitHub版本
  2. 在所有平台上运行测试
  3. 构建并发布到PyPI
  4. 部署到Fly.io(如果已配置)

📊 演出

基准测试

  • 峰值吞吐量:36000+请求/秒
  • 平均延迟:每次工具调用\= 0.6` (提供高性能MCP框架)
  • chuk-mcp-math >= 0.1.0 (提供数学函数)
  • pyyaml >= 6.0.2 (用于YAML配置)

通过chuk mcp服务器包含什么

  • 高性能HTTP/STDIO传输
  • 自动类型推断和验证
  • 内置日志记录和错误处理
  • 零配置启动功能
  • 生产级性能(36K+RPS)

可选依赖关系

  • 开发工具: pytest, pytest-asyncio
  • 全部可选: pip install -e .[dev]

🏗️ 建筑

建立在 chuk mcp服务器 框架:

  • chuk mcp服务器:高性能MCP服务器框架(36K+RPS)
  • 丘数学:数学函数库(642个函数)
  • 此服务器:通过过滤和配置将两者连接起来

重构后的架构更简单,性能更高:

  • 删除了自定义基础服务器实现
  • 使用chuk-mcp-server的基于装饰器的API
  • 维护所有过滤和配置功能
  • 获得自动性能优化

📝 许可证

此项目根据Apache许可证2.0获得许可-请参阅 许可证 文件以获取详细信息。

🙏 致谢

🔗 链接

  • chuk mcp服务器:高性能MCP框架
  • 丘数学:
  • MCP协议: 官方规范
  • 问题:

______________________________________________________________________

*模型上下文协议生态系统的高性能数学计算*

目录标签

目录标签

数学计算PythonClaude本地部署高性能服务器科学计算函数库协议服务

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

29

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP