Math MCP Server
Uses Pydantic-AI framework to build the math agent with structured data validation and AI model integration
Implements mathematical computation tools including basic arithmetic operations (add, subtract, multiply, divide), power, and logarithm functions through MCP protocol
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 MCP Server calculate 15% of 250"
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.
MathAgent
A minimal math agent that delegates all calculations to an MCP (Model Context Protocol) server. The agent uses MCP tools for every operation—no mental math—so you get consistent, inspectable results.
What’s inside
Agent: built with pydantic-ai, connected via MCP stdio
MCP Server: powered by fastmcp, exposing math tools
Available MCP tools
add
subtract
multiply
divide
power
log
Coming soon:
modulus
Related MCP server: Calculator MCP Server
Requirements
Python 3.13+
uv (Python package/dependency manager)
A Groq API key (for the LLM model)
A Logfire token (for instrumentation)
Setup
Clone the repository
Create your environment file
Set these keys:
groq_key— your Groq API keylogfire_key— your Logfire token
Run the agent
Run with uv so dependencies are resolved and the MCP server is launched as a toolset:
uv run agent.pyNotes:
The agent is configured to use the Groq model
qwen/qwen3-32b(seeagent.py). You can swap models as needed.The agent will reject non-math questions by design.
All calculations route through the MCP tools defined in
mcp-server.py.
Contributing
Contributions are welcome—feel free to open issues or submit pull requests.
Available Tools
6 toolsaddA
Adds two integer numbers together.
Inputs: a (required), b (required). Returns: result
divideA
Divide two numbers. Raises an error if dividing by zero.
Inputs: a (required), b (required). Returns: result
logA
Calculate the logarithm of a number with the specified base (default base 10).
Args: a: The number to calculate logarithm for (must be positive) base: The base of the logarithm (must be positive and not equal to 1, default is 10)
Inputs: a (required), base. Returns: result
multiplyB
Multiply two numbers together.
Inputs: a (required), b (required). Returns: result
powerA
Raise a number to the power of another number (a^b).
Inputs: a (required), b (required). Returns: result
subtractC
subtract two integer numbers together.
Inputs: a (required), b (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 has a clearly distinct mathematical operation: addition, division, logarithm, multiplication, exponentiation, and subtraction. There is no overlap in purpose, making it easy for an agent to select the correct tool based on the desired calculation.
All tool names follow a consistent verb-only pattern (e.g., add, divide, log, multiply, power, subtract) without mixing conventions. This simplicity and uniformity make the naming highly predictable and readable.
With 6 tools, this server is well-scoped for a math utility, covering core arithmetic and basic mathematical functions. Each tool earns its place without feeling excessive or insufficient for the domain.
The tool set covers essential operations like addition, subtraction, multiplication, division, exponentiation, and logarithms, providing a solid foundation. However, minor gaps exist, such as missing trigonometric functions (e.g., sine, cosine) or advanced operations like square roots, which agents might need to work around for broader mathematical tasks.
Maintenance
Related MCP Connectors
Loan & mortgage calculator, compound interest, ROI, crypto prices, FX conversion for AI agents.
500+ deterministic tools for AI agents: math, conversion, validation, hashing, encoding, date/time.
AI-callable calculators and engineering models with real formulas. No hallucinated math.
High-precision finance & business calculations for AI agents — exact decimals, never floats.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to perform accurate mathematical calculations by evaluating expressions using mathjs. Supports basic arithmetic, functions, constants, and complex mathematical operations through natural language requests.-
- FlicenseNot gradedqualityDmaintenanceProvides mathematical operation tools including basic arithmetic (add, subtract, multiply, divide), power and square root calculations, and safe evaluation of mathematical expressions.-
- AlicenseNot gradedqualityDmaintenanceProvides a comprehensive set of mathematical functions as MCP tools, enabling language models to perform calculations including arithmetic, trigonometry, logarithms, and more.20 npm1MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to perform arithmetic operations such as addition, subtraction, multiplication, and division through standardized MCP tools.1-