math-logic-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@math-logic-mcp solve x^2 - 4 = 0"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
math-logic-mcp
MCP server that gives small LLMs verified symbolic-math & logic tools.
Small language models (Mistral, Llama, Phi, Gemma) struggle with multi-step math and formal logic. Instead of fine-tuning, give them tools. This project exposes a set of verified math and logic solvers via the Model Context Protocol (MCP), so any MCP-compatible LLM can call them as functions.
Features
Tool | What it does | Backend |
| Safe arithmetic evaluation | Python stdlib (zero deps) |
| Symbolic equation solving | SymPy (optional) |
| Simplify / factor / expand | SymPy (optional) |
| Differentiation | SymPy (optional) |
| Integration | SymPy (optional) |
| SAT / tautology / truth tables | Z3 (optional) |
Every result includes proof steps and verification — the LLM gets a machine-checked answer, not a guess.
Related MCP server: Chiasmus
Quick Start
Install from PyPI
pip install math-logic-mcpInstall (full — all solvers)
pip install "math-logic-mcp[full]"Run the MCP server
# stdio transport (for Claude Desktop, Cursor, etc.)
math-logic-mcp
# HTTP/SSE transport (for remote clients)
math-logic-mcp --httpConfigure in Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"math-logic": {
"command": "math-logic-mcp"
}
}
}Configure in Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"math-logic": {
"command": "math-logic-mcp"
}
}
}Use as a Python Library
from math_logic import MathLogicEngine
engine = MathLogicEngine()
# Arithmetic (always available)
result = engine.solve("compute 2 + 3 * 4")
print(result.solutions) # ['14']
# Algebra (requires sympy)
result = engine.solve("Solve x^2 - 4 = 0")
print(result.solutions) # ['x = -2', 'x = 2']
# Logic (requires z3-solver)
result = engine.solve('Check satisfiability of "p and q"')
print(result.solutions) # ['Satisfiable: p=True, q=True']Architecture
LLM ─── MCP Protocol ──▶ mcp_server.py
│
engine.py (router → solver → result)
│
┌───────────────┼───────────────┐
▼ ▼ ▼
ArithmeticSolver SymPySolver Z3Solver
(zero deps) (pip: sympy) (pip: z3-solver)The router classifies each problem by regex patterns and routes to the best available solver. Solvers are loaded lazily — if SymPy isn't installed, algebra problems gracefully report the missing dependency.
Installation Extras
Extra | What it adds | Install size |
(none) | Arithmetic only | ~1 MB |
| + algebra, calculus, simplification | ~50 MB |
| + propositional logic, SAT | ~30 MB |
| Everything | ~80 MB |
| + pytest, ruff | ~85 MB |
pip install "math-logic-mcp[sympy]" # algebra + calculus
pip install "math-logic-mcp[z3]" # logic
pip install "math-logic-mcp[full]" # everything
pip install "math-logic-mcp[full,dev]" # everything + dev toolsDevelopment
git clone https://github.com/ismailkerimov/math-logic-mcp.git
cd math-logic-mcp
pip install -e ".[full,dev]"
pytest tests/ -vDocker
docker build -t math-logic-mcp .
docker run -p 8080:8080 math-logic-mcpLicense
Apache 2.0 — see LICENSE.
Available Tools
6 toolscheck_logicCheck LogicARead-onlyIdempotent
Check a propositional logic formula for satisfiability, tautology, or generate a truth table.
Inputs: formula (required), check_type. Returns: result
compute_derivativeCompute DerivativeARead-onlyIdempotent
Compute the derivative of a mathematical expression with proof steps.
Inputs: expression (required), variable. Returns: result
compute_integralCompute IntegralARead-onlyIdempotent
Compute the indefinite integral of a mathematical expression with proof steps.
Inputs: expression (required), variable. Returns: result
simplify_expressionSimplify ExpressionARead-onlyIdempotent
Simplify, factor, or expand a mathematical expression with proof steps.
Inputs: expression (required). Returns: result
solve_equationSolve EquationARead-onlyIdempotent
Solve an algebraic equation symbolically and return solutions with proof steps.
Inputs: equation (required). Returns: result
verify_arithmeticVerify ArithmeticBRead-onlyIdempotent
Safely evaluate an arithmetic expression using only whitelisted operators and functions.
Inputs: expression (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool targets a distinct operation: propositional logic, derivatives, integrals, algebraic simplification, equation solving, and safe arithmetic evaluation. No two tools have overlapping purposes, making selection straightforward.
All tool names follow a consistent verb_noun pattern with underscores, such as check_logic, compute_derivative, and solve_equation. The style is uniform and predictable.
With 6 tools, the set is well-scoped for a general math and logic server. It covers core areas without being bloated, balancing comprehensiveness and manageability.
While fundamental operations are present, notable gaps exist: no predicate logic, no limits or series, no linear algebra or matrix operations, and no statistical functions. This leaves several common math tasks unsupported.
Maintenance
Related MCP Connectors
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Hosted MCP server for live public-data APIs and Skills for AI agents.
Related MCP Servers
- AlicenseBqualityNot gradedmaintenanceMCP server for structured reasoning with cognitive trap detection, verification, and context compression541 npm1-
- AlicenseNot gradedqualityBmaintenanceMCP server that gives LLMs access to formal verification via Z3 and SWI-Prolog, plus tree-sitter-based source code analysis. Translates natural language problems into formal logic using a template-based pipeline, verifies results with mathematical certainty, and analyzes call graphs for reachability, dead code, and impact analysis.137 npm218Apache 2.0
- AlicenseBqualityBmaintenanceMCP server for symbolic computation that enables AI agents to perform step-by-step derivations, transform formulas, and verify results with full provenance, combining natural language with formal mathematical operations.4113Apache 2.0
- AlicenseNot gradedqualityDmaintenanceMCP server exposing SLAC (Simple Logic & Arithmetic Compiler) as tools for LLM agents, enabling evaluation of expressions and retrieval of syntax reference.Apache 2.0