Cover image
Try Now
2025-03-04

Un servidor de protocolo de contexto modelo (MCP) para cálculos numéricos con Numpy

3 years

Works with Finder

1

Github Watches

0

Github Forks

1

Github Stars

NumPy MCP Server

A Model Context Protocol (MCP) server for numerical computations with NumPy

MIT licensed

A Model Context Protocol (MCP) server that provides mathematical calculations and operations using NumPy. This server exposes various mathematical tools through a standardized MCP interface, making it easy to perform numerical computations directly through Claude or other MCP-compatible LLMs.

Features

  • Basic arithmetic operations (addition)
  • Linear algebra computations (matrix multiplication, eigendecomposition)
  • Statistical analysis (mean, median, standard deviation, min, max)
  • Polynomial fitting

Installation

Quick Setup with Claude Desktop

The fastest way to get started is to install this server directly in Claude Desktop:

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

Manual Installation

This project uses UV for dependency management. To install:

# 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

Usage

Development Testing

Test the server locally with the MCP Inspector:

mcp dev server.py

Claude Desktop Integration

  1. Install the server in Claude Desktop:

    mcp install server.py --name "NumPy Calculator"
    
  2. The server will now be available in Claude Desktop under "NumPy Calculator"

  3. You can use it by asking Claude to perform mathematical operations, for example:

    • "Calculate the eigenvalues of matrix [[1, 2], [3, 4]]"
    • "Find the mean and standard deviation of [1, 2, 3, 4, 5]"
    • "Multiply matrices [[1, 0], [0, 1]] and [[2, 3], [4, 5]]"

Direct Execution

For advanced usage or custom deployments:

python server.py
# or
mcp run server.py

Available Functions

The server provides the following mathematical functions through the MCP interface:

Basic Arithmetic

  • add(a: int, b: int) -> int: Add two integers together

Linear Algebra

  • matrix_multiply(matrix_a: List[List[float]], matrix_b: List[List[float]]) -> List[List[float]]: Multiply two matrices
  • eigen_decomposition(matrix: List[List[float]]) -> Tuple[List[float], List[List[float]]]: Compute eigenvalues and eigenvectors of a square matrix

Statistics

  • statistical_analysis(data: List[float]) -> dict[str, float]: Calculate basic statistics for a dataset including:
    • Mean
    • Median
    • Standard deviation
    • Minimum value
    • Maximum value

Data Analysis

  • polynomial_fit(x: List[float], y: List[float], degree: int = 2) -> List[float]: Fit a polynomial of specified degree to the given data points

Development

Project Structure

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

Code Quality

This project adheres to strict code quality standards:

  • Type hints throughout the codebase
  • Comprehensive docstrings following Google style
  • Error handling for numerical operations

Dependencies

  • NumPy: For numerical computations and linear algebra operations
  • FastMCP: For Model Context Protocol server implementation

License

This project is licensed under the MIT License.

Acknowledgments

  • NumPy team for their excellent scientific computing library
  • Model Context Protocol (MCP) for enabling standardized LLM interactions

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • OffchainLabs
  • Implementación de la prueba de estaca Ethereum

  • huahuayu
  • Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.

  • deemkeen
  • Controle su MBOT2 con un combo de potencia: MQTT+MCP+LLM

    Reviews

    4 (1)
    Avatar
    user_kZnGxc5Q
    2025-04-16

    I have been using numpy-mcp for a while now, and it has significantly enhanced my data processing workflows. The seamless integration with NumPy makes it a perfect tool for anyone working with large datasets. Great job by colesmcintosh! Highly recommended for all data scientists and analysts out there. Check it out here: https://github.com/colesmcintosh/numpy-mcp.