Skip to main content
Glama

NumPy MCP 服务器

用于使用 NumPy 进行数值计算的模型上下文协议 (MCP) 服务器

麻省理工学院许可

模型上下文协议 (MCP) 服务器,使用 NumPy 提供数学计算和运算。该服务器通过标准化的 MCP 接口提供各种数学工具,方便用户直接通过 Claude 或其他兼容 MCP 的 LLM 进行数值计算。

特征

  • 基本算术运算(加法)

  • 线性代数计算(矩阵乘法、特征分解)

  • 统计分析(平均值、中位数、标准差、最小值、最大值)

  • 多项式拟合

安装

使用 Claude Desktop 快速设置

最快的入门方式是直接在 Claude Desktop 中安装此服务器:

# Install the server in Claude Desktop mcp install server.py --name "NumPy Calculator"

手动安装

本项目使用 UV 进行依赖管理。安装方法:

# Install UV if you haven't already curl -LsSf https://astral.sh/uv/install.sh | sh # Clone the repository git clone https://github.com/yourusername/math-mcp.git cd math-mcp # Create virtual environment and install dependencies uv venv source .venv/bin/activate # On Unix/macOS # or # .venv\Scripts\activate # On Windows uv pip install -r requirements.txt

用法

开发测试

使用 MCP Inspector 在本地测试服务器:

mcp dev server.py

Claude 桌面集成

  1. 在 Claude Desktop 中安装服务器:

    mcp install server.py --name "NumPy Calculator"
  2. 该服务器现在可在 Claude Desktop 的“NumPy 计算器”下使用

  3. 您可以通过要求 Claude 执行数学运算来使用它,例如:

    • “计算矩阵 [[1, 2], [3, 4]] 的特征值”

    • “求 [1, 2, 3, 4, 5] 的平均值和标准差”

    • “将矩阵 [[1, 0], [0, 1]] 和 [[2, 3], [4, 5]] 相乘”

直接执行

对于高级用法或自定义部署:

python server.py # or mcp run server.py

可用函数

服务器通过MCP接口提供以下数学函数:

基本算术

  • add(a: int, b: int) -> int :将两个整数相加

线性代数

  • matrix_multiply(matrix_a: List[List[float]], matrix_b: List[List[float]]) -> List[List[float]] :将两个矩阵相乘

  • eigen_decomposition(matrix: List[List[float]]) -> Tuple[List[float], List[List[float]]] :计算方阵的特征值和特征向量

统计数据

  • statistical_analysis(data: List[float]) -> dict[str, float] :计算数据集的基本统计数据,包括:

    • 意思是

    • 中位数

    • 标准差

    • 最小值

    • 最大值

数据分析

  • polynomial_fit(x: List[float], y: List[float], degree: int = 2) -> List[float] :将指定次数的多项式拟合到给定的数据点

发展

项目结构

math-mcp/ ├── requirements.txt ├── README.md └── server.py

代码质量

该项目遵守严格的代码质量标准:

  • 整个代码库中的类型提示

  • 遵循 Google 风格的综合文档字符串

  • 数值运算的错误处理

依赖项

  • NumPy:用于数值计算和线性代数运算

  • FastMCP:用于模型上下文协议服务器实现

执照

该项目已获得 MIT 许可。

致谢

  • NumPy 团队提供出色的科学计算库

  • 用于实现标准化 LLM 交互的模型上下文协议 (MCP)

-
security - not tested
-
license - not tested
-
quality - not tested

Related MCP Servers

  • -
    security
    -
    license
    -
    quality
    A Python-based server that implements the Model Context Protocol to interface with Claude Desktop as an MCP client, supporting interaction through efficient memory management.
    Last updated -
    1
    MIT License
  • -
    security
    -
    license
    -
    quality
    A Model Context Protocol server built with mcp-framework that allows users to create and manage custom tools for processing data, integrating with the Claude Desktop via CLI.
    Last updated -
    32
    5
    • Apple
  • A
    security
    -
    license
    A
    quality
    A Model Context Protocol (MCP) server that allows Claude AI to interact with custom tools, enabling extension of Claude's capabilities through the MCP framework.
    Last updated -
    • Apple
  • -
    security
    -
    license
    -
    quality
    A Model Context Protocol (MCP) server that demonstrates mathematical capabilities through a LangChain integration, allowing clients to perform math operations via the MCP protocol.
    Last updated -
    • Apple
    • Linux

View all related MCP servers

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/colesmcintosh/numpy-mcp'

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