MCP Hub
Back to servers

ReasonForge

Provides a suite of deterministic math tools powered by SymPy to handle algebra, calculus, linear algebra, and statistics via the Model Context Protocol. It enables smaller language models to delegate complex computations to a verified symbolic backend for accurate and reliable results.

Updated
Feb 28, 2026

ReasonForge

Deterministic math tools for small language models.

ReasonForge gives small LLMs (8B–32B) access to a verified SymPy computation backend via tool calling. Instead of relying on the model to compute, all math is delegated to deterministic tools — the model only reasons about what to compute and how to present results.

Architecture

User Question → LLM (Qwen3) → Tool Calls → SymPy Backend → Verified Results → LLM → Final Answer

Two-phase response pipeline:

  1. Compute (/no_think): Model calls tools with thinking disabled — forced delegation
  2. Present (thinking ON): Model reasons about verified results, composes the answer

Tools

ToolOperationsBackend
math_toolcompute, solve, simplify, factor, expand, gcd, lcm, prime_factors, divisors, mod_inverse, nsolve, crt + SymPy builtins (totient, fibonacci, isprime...)SymPy
calculus_tooldifferentiate, integrate, limit, series, summation, partial_fraction, trigsimp, ode_solve, laplaceSymPy
matrix_tooldeterminant, inverse, eigenvalues, eigenvectors, rank, rref, transpose, multiply, add, trace, nullspace, columnspace, charpoly, norm, adjugate, solve (Ax=b)SymPy
statistics_tooldescribe, mean, median, mode, std, variance, correlation, regression, percentile, zscore, skewness, kurtosis, geometric_mean, harmonic_meanPython stdlib

Project Structure

MCP/
├── experts/math/
│   ├── server.py              # MCP server entry point
│   └── tools/
│       ├── preprocess.py      # Expression parser (^ → **, implicit multiplication, infinity handling)
│       ├── algebra.py         # math_tool — algebra + number theory
│       ├── calculus.py        # calculus_tool — derivatives, integrals, ODEs, etc.
│       ├── matrix.py          # matrix_tool — linear algebra
│       └── statistics.py      # statistics_tool — descriptive & inferential stats
├── tests/
│   └── test_math_tools.py     # Unit tests for all tools
├── ui/
│   ├── app.py                 # Gradio chat interface with two-phase pipeline
│   └── style.css              # Custom UI styles (dark mode, input pill, etc.)
├── ReasonForge_Colab.ipynb    # One-click Colab deployment notebook
├── pyproject.toml
└── run_ui.bat                 # Local launcher (Windows)

Quick Start (Local)

# Requires: Ollama running with qwen3:8b
uv sync
uv run python -m ui.app
# Opens at http://localhost:7861

Colab Deployment (GPU)

Open ReasonForge_Colab.ipynb in Google Colab Pro with an A100 GPU. It clones this repo, installs Ollama + qwen3:32b, and launches the UI with a public Gradio link.

Running Tests

uv run python -m tests.test_math_tools

Tech Stack

  • LLM Backend: Ollama (local) or any OpenAI-compatible API
  • Math Engine: SymPy — symbolic computation
  • UI: Gradio — chat interface with LaTeX rendering
  • Protocol: MCP (Model Context Protocol) compatible

Reviews

No reviews yet

Sign in to write a review