Skip to main content

python License AI--Assisted

Math AI Agent

A prompt chat webapp that drives an LLM call inside an agentic loop using the calculator_mcp MCP server for arithmetic operations. The key constraint is that the LLM is given explicit system instructions to use the calculator_mcp for any arithmetic operations.

Features

  • FastAPI web UI — simple form-based interface for submitting prompts
  • MCP client — connects to a remote calculator MCP server with optional OAuth authentication
  • Configurable — MCP server URL, OAuth settings, LLM endpoint and model, and logging are all driven by config.yaml
  • Plain-text answers — the model is instructed to reply without LaTeX or Markdown, since the web UI renders answers in a plain <textarea>

Non-Supported Features

  • Server-sent events (SSE) are not supported for either LLM or MCP communication.
  • Streaming communication channels, such as HTTP Streamable, are not supported. In other words, both the LLM model and the MCP server are expected to generate the entire output before sending it.
  • Stateful Responses API communication may not be supported, depending on the LLM model selected in the configuration.
  • Input types such as images and videos are not supported. Only text input is supported.
  • Tools available to the LLM are limited to the Calculator MCP only. Other tool types, such as built-in tools (for example, web search and file search) and function calls, are not supported.

Bear in mind that support for the features listed above also depends on the capabilities of the selected LLM model. For example, the default configurable model, NVIDIA Nemotron 3 Super, does not support storing conversation history and supports only text input.

AI Disclaimer

This project includes code and documentation created with the assistance of AI tools. For details on usage, limits, and review practices, please see the AI Disclaimer.

Installation

Prerequisites

  • UNIX OS (e.g., macOS, Linux)
  • curl 8.7+
  • pip 26.2+
  • poetry 2.4+
  • python 3.14+

PyPI Package Installation

IMPORTANT: release versioning was recently reset to start again at version 0.0.1. Uninstall any previously installed version first.

  1. Uninstall any previously installed release
pip uninstall math-ai-agent
# purging the cache is recommended as well
pip cache purge
  1. Install into the user's home environment
# install "math-ai-agent" and dependencies into user local pip environment
# NOTE: use --no-cache-dir to avoid issues with an earlier cached version
pip --no-cache-dir install -U --user math-ai-agent --verbose
  1. Confirm the installed version matches the latest GitHub release at math-ai-agent/releases
# show the installed version
pip show math-ai-agent

Git Clone Installation

  1. git clone and install local project package using poetry
# use local `dev` folder to install the project
mkdir -p ~/dev || exit; cd ~/dev
git clone https://github.com/rubensgomes-org/math-ai-agent.git
# change to project git local directory
cd math-ai-agent
# ensure we are at the project git local root folder
cd $(git rev-parse --show-toplevel) || exit
poetry install

Usage

Configuration

The server ships with a default config.yaml bundled inside the PyPI package. To override it, set the MATHAIAGENT_CONFIG environment variable to the absolute path of your custom configuration file:

# assuming config_local.yaml placed in my home folder
export MATHAIAGENT_CONFIG="${HOME}/cfg/math-ai-agent/config_local.yaml"

Running Using PyPI Package

NOTE: requires prior installation using pip install -U --user math-ai-agent.

  1. Make a copy of config_local.yaml to a local home directory (e.g., ${HOME}/cfg/math-ai-agent/config_local.yaml).

  2. Launch the PyPI-installed math-ai-agent package:

# config_local.yaml placed in my home folder
export MATHAIAGENT_CONFIG="${HOME}/cfg/math-ai-agent/config_local.yaml"
# using installed package from PyPI:
math-ai-agent
  1. Health check
# port is set by web.port in config_local.yaml
curl -v http://localhost:9090/health
# Expect: OK
  1. To stop, go to the running terminal and press Ctrl+C

Running Using Git Cloned Project - MCP Server Running Locally

NOTE: requires the calculator_mcp running locally as per instructions at calculator-mcp

  1. Make a copy of config_local.yaml to a local home directory (e.g., ${HOME}/cfg/math-ai-agent/config_local.yaml).

  2. Launch math-ai-agent from the local Git repo folder

# On my machine the project is installed here:
pushd ~/github/rubens/dev/python/math-ai-agent/
# ensure we are at the project git local root folder
cd $(git rev-parse --show-toplevel) || exit
# config_local.yaml placed in my home folder
export MATHAIAGENT_CONFIG="${HOME}/cfg/math-ai-agent/config_local.yaml"
# ensure below port does not conflict with locally running MCP server.
poetry run math-ai-agent
  1. Health check
curl -v http://localhost:9090/health
# Expect: OK
  1. To stop, go to the running terminal and press Ctrl+C

Calculator MCP Server Running Remotely - OAuth Authentication

NOTE: requires OAuth authentication which currently only Rubens is able to authorize using his personal GitHub account.

  1. Make a copy of config_remote.yaml to a local home directory (e.g., ${HOME}/cfg/math-ai-agent/config_remote.yaml).

  2. Launch math-ai-agent from the local Git repo folder

# On my machine the project is installed here:
pushd ~/github/rubens/dev/python/math-ai-agent/
# ensure we are at the project git local root folder
cd $(git rev-parse --show-toplevel) || exit
# config_remote.yaml placed in my home folder
export MATHAIAGENT_CONFIG="${HOME}/cfg/math-ai-agent/config_remote.yaml"
# clean up previously created OAuth tokens
rm -fr ~/.calc-mcp-token
poetry run math-ai-agent
  1. Health check
curl -v http://localhost:9090/health
# Expect: OK
  1. To stop, go to the running terminal and press Ctrl+C

License

The project is licensed under MIT License.


Author: Rubens Gomes

Metadata

Release files for math-ai-agent 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for math-ai-agent 0.0.6
File Size Uploaded
math_ai_agent-0.0.6.tar.gz 24.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for math-ai-agent 0.0.6
File Interpreter ABI Platform
math_ai_agent-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 59.5 kB

Release files / math_ai_agent-0.0.6.tar.gz

Download URL math_ai_agent-0.0.6.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d96e2bb36a355e6c0db0a67af981115d0c2944e39107d83367a573b5253bbada
BLAKE2b-256 checksum
How to use checksums
ad300162883b1121d3219db14c9c66f83fcbdba886d42ed28a099412c815a71d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.7 Linux/6.17.0-1022-azure

Release files / math_ai_agent-0.0.6-py3-none-any.whl

Download URL math_ai_agent-0.0.6-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c643a66e3dfc6c0ce8298c7651628656c4a27a4ca5af095f822bd753fdeb4d88
BLAKE2b-256 checksum
How to use checksums
710b3d68d0261c14393872768d82d660024cba3b60098a0504e3911332749269
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.3 CPython/3.14.7 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

0.0.49

2 release files

0.0.48

2 release files

0.0.47

2 release files

0.0.46

2 release files

0.0.45

2 release files

0.0.44

2 release files

0.0.43

2 release files

0.0.42

2 release files

0.0.41

2 release files

0.0.40

2 release files

0.0.39

2 release files

0.0.38

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page