abhishek

Menu

Close

Fermat MCP - Mathematical Computation Server
A FastMCP server for advanced mathematical computations with numerical/symbolic processing and visualization
Python
Mathematics
Data Visualization
NumPy
SymPy
Matplotlib
Scientific Computing
Image of Fermat MCP - Mathematical Computation Server

#Overview

Fermat MCP is a powerful mathematical computation server that provides advanced numerical and symbolic processing capabilities with integrated visualization. It's designed to handle complex mathematical operations and generate insightful visualizations through a simple interface.

Fermat MCP Interface Fermat MCP's intuitive interface for mathematical computations and visualizations

#Key Features

  • Comprehensive Mathematical Operations: 50+ operations across calculus, algebra, linear algebra, and statistics
  • Advanced Visualization: Support for multiple chart types including line, scatter, bar, stem, and stack plots
  • Symbolic Computation: Full integration with SymPy for symbolic mathematics
  • High-performance Computing: Leverages NumPy for efficient numerical operations
  • Interactive Data Analysis: Built-in plotting capabilities for immediate visual feedback

#Core Modules

#1. Matplotlib Integration (mpl_mcp)

FunctionDescription
plot_barchartCreates bar charts from data values
plot_scatterGenerates scatter plots from data points
plot_chartPlots line, scatter, or bar charts
plot_stemCreates stem plots for discrete data
plot_stackGenerates stacked area/bar charts
eqn_chartPlots mathematical equations

#2. NumPy Integration (numpy_mcp)

#Basic Math

  • Arithmetic: add, sub, mul, div, power, abs, exp, log, sqrt
  • Trigonometric: sin, cos, tan

#Statistics

  • mean, median, std, var, min, max, argmin, argmax, percentile

#Linear Algebra

  • dot, matmul, inv, det, eig, solve, svd

#Matrix Operations

  • create, zeros, ones, full, arange, linspace
  • reshape, flatten, concatenate, transpose, stack

#3. SymPy Integration (sympy_mcp)

#Algebra

  • simplify, expand, factor, collect

#Calculus

  • diff, integrate, limit, series

#Equations

  • solve, solveset, linsolve, nonlinsolve

#Matrix Operations

  • create, det, inv, rref, eigenvals

#Getting Started

#Prerequisites

  • Python 3.12 or higher
  • uv package manager

#Installation

  1. Clone the repository:

    git clone https://github.com/abhiphile/fermat-mcp
  2. Install using uv:

    uv pip install -r requirements.txt

#Configuration

Add the following to your MCP configuration (mcp.json):

{
  "mcpServers": {
    "fmcp": {
      "command": "bash",
      "args": ["MCP_SERVER_ABSOLUTE_PATH/setup.sh"],
      "description": "fmcp server for mathematical computations and plotting."
    }
  }
}

For Visual Studio Code or Windsurf, update the path to your local clone:

{
  "mcpServers": {
    "fmcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/fermat-mcp",
        "run",
        "server.py"
      ]
    }
  }
}

#Example Usage

#Eigenvalue Calculation

Calculate eigenvalues of an 8×8 matrix:

import numpy as np
 
matrix = [
    [2, 1, 3, 1, 1, 8, 4, 2],
    [6, 6, 0, 7, 1, 4, 6, 1],
    [9, 2, 1, 8, 7, 9, 9, 0],
    [2, 5, 6, 6, 9, 8, 0, 1],
    [1, 3, 6, 2, 3, 8, 8, 1],
    [9, 4, 2, 2, 1, 2, 2, 9],
    [8, 6, 4, 4, 2, 0, 2, 8],
    [0, 0, 0, 6, 6, 7, 5, 6]
]
 
eigenvalues = np.linalg.eigvals(matrix)
print("Eigenvalues:", eigenvalues)

#Plotting Example

Plot multiple functions in the same figure:

import numpy as np
import matplotlib.pyplot as plt
 
x = np.linspace(-5, 5, 100)
y1 = x**2
y2 = np.sin(x)
 
plt.figure(figsize=(10, 6))
plt.plot(x, y1, label='y = x²')
plt.plot(x, y2, label='y = sin(x)')
plt.title('Function Comparison')
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.grid(True)
plt.show()

#Installation via Smithery

For quick setup with Gemini CLI:

npx -y @smithery/cli install @abhiphile/fermat-mcp --client gemini

#License

This project is licensed under the MIT License. See the LICENSE file for details.