Math Lab
FreeNot checkedMCP server exposing pure mathematical operations (sum, subtraction, multiplication, division) as tools, with a clean layered architecture and optional OpenAI Ag
About
MCP server exposing pure mathematical operations (sum, subtraction, multiplication, division) as tools, with a clean layered architecture and optional OpenAI Agents SDK integration.
README
Este proyecto usa una misma lógica matemática desde dos adaptadores:
- Un servidor MCP para Codex, el MCP Inspector, o cualquier cliente compatible.
- Un agente construido con el OpenAI Agents SDK para conversar en lenguaje natural.
Empaquetado como paquete Python instalable (pip install -e .), con layout src/ y arquitectura limpia por capas.
Estructura
pyproject.toml # Metadata, dependencias y entry points del paquete
src/
└── math_assistant/
├── domain/ # Reglas matemáticas puras (sin dependencias externas)
├── application/ # Catálogo de capacidades públicas
├── infrastructure/ # Adaptadores para MCP (FastMCP) y OpenAI Agents SDK
└── presentation/ # Interfaz de terminal
tests/
├── unit/ # Prueban dominio y catálogo
└── integration/ # Comprueban que los adaptadores se construyen
run_cli.py # Entry point: interfaz amigable para aprender y probar
run_mcp.py # Entry point: STDIO exclusivo para el cliente MCP
La dependencia siempre apunta hacia adentro:
CLI / MCP / OpenAI SDK → application → domain
El dominio no conoce FastMCP, OpenAI, una API key, ni print. Por eso puede probarse rápido y sin red.
Instalación
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e ".[dev]"
Copia tu OPENAI_API_KEY en un archivo .env en la raíz (nunca se sube a git).
Ejecutar la interfaz amigable
.\.venv\Scripts\python.exe .\run_cli.py
El menú permite:
- Hablar con el agente de OpenAI (usa
OPENAI_API_KEYde.env). - Probar suma, resta, multiplicación y división localmente, sin costo de API.
- Ver las herramientas que el servidor MCP publica.
Ejecutar el servidor MCP
.\.venv\Scripts\python.exe .\run_mcp.py
Para inspeccionarlo con MCP Inspector:
npx @modelcontextprotocol/inspector "C:\ruta\completa\a\math-mcp-lab\.venv\Scripts\python.exe" "C:\ruta\completa\a\math-mcp-lab\run_mcp.py"
Usa rutas absolutas: el Inspector no siempre respeta el directorio de trabajo actual.
No agregues print() dentro de run_mcp.py ni del adaptador MCP: el canal estándar de salida (stdout) se reserva para los mensajes JSON-RPC del protocolo. La interfaz amigable vive en run_cli.py por esa razón.
Integración con Codex
.codex/config.toml (no versionado, es config local de máquina) apunta Codex al servidor MCP. Si usas Codex CLI, crea el tuyo:
[mcp_servers.math]
command = "C:\\ruta\\completa\\a\\math-mcp-lab\\.venv\\Scripts\\python.exe"
args = ["C:\\ruta\\completa\\a\\math-mcp-lab\\run_mcp.py"]
cwd = "C:\\ruta\\completa\\a\\math-mcp-lab"
Pruebas
.\.venv\Scripts\python.exe -m unittest discover -s tests -v
Cómo añadir una herramienta matemática
- Crea la función pura y su docstring en
src/math_assistant/domain/operations.py. - Agrégala a
MATH_OPERATIONSensrc/math_assistant/application/tool_catalog.py. - Ejecuta las pruebas.
Los dos adaptadores la expondrán automáticamente: FastMCP la convierte en una herramienta MCP y el Agents SDK en una function tool.
Install Math Lab in Claude Desktop, Claude Code & Cursor
unyly install math-mcp-labInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add math-mcp-lab -- uvx --from git+https://github.com/matiasn2008/math-mcp-lab math-assistantStep-by-step: how to install Math Lab
FAQ
Is Math Lab MCP free?
Yes, Math Lab MCP is free — one-click install via Unyly at no cost.
Does Math Lab need an API key?
No, Math Lab runs without API keys or environment variables.
Is Math Lab hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install Math Lab in Claude Desktop, Claude Code or Cursor?
Open Math Lab on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
by lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Math Lab with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
