Skip to main content
Glama
ArjunKrish7356

Math MCP Server

README.md
# 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

## Requirements
- Python 3.13+
- uv (Python package/dependency manager)
- A Groq API key (for the LLM model)
- A Logfire token (for instrumentation)

## Setup
1) Clone the repository
2) Create your environment file
	 - Set these keys:
		 - `groq_key` — your Groq API key
		 - `logfire_key` — your Logfire token

## Run the agent
Run with uv so dependencies are resolved and the MCP server is launched as a toolset:

```bash
uv run agent.py
```

Notes:
- The agent is configured to use the Groq model `qwen/qwen3-32b` (see `agent.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.




TDQS

A3.7/5.0

Scored across 6 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

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.

Completeness4/5

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

ActivityInactive
ResponsivenessNo issues