math-mcp-lab
Math Lab: MCP + OpenAI Agents SDK
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 MCPLa dependencia siempre apunta hacia adentro:
CLI / MCP / OpenAI SDK → application → domainEl dominio no conoce FastMCP, OpenAI, una API key, ni print. Por eso puede probarse rápido y sin red.
Related MCP server: Explore MCP
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.pyEl 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.pyPara 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 -vCó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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA learning-focused MCP server that demonstrates how to build arithmetic tools for AI assistants, currently featuring addition functionality with structured input/output.117MIT
- FlicenseNot gradedqualityDmaintenanceA demonstration MCP server that exposes basic arithmetic tools (add, subtract, ping) through FastAPI and shows how to integrate them with OpenAI's tool-calling API for LLM orchestration.
- FlicenseNot gradedqualityDmaintenanceA simple demonstration MCP server built with FastMCP that exposes basic calculator operations (add, subtract, multiply, divide) as tools for MCP clients like GitHub Copilot Agent mode.
- FlicenseAqualityDmaintenanceA basic MCP server built with the FastMCP framework that provides fundamental mathematical operations like addition, subtraction, multiplication, and division. It serves as a demonstration for integrating math-based tools into MCP-compatible environments like Cursor IDE.4
Related MCP Connectors
MCP server exposing the Backtest360 engine API as tools for AI agents.
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
Hosted MCP server to manage a restaurant menu from AI agents - 39 tools over the DuckHub API.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/matiasn2008/math-mcp-lab'
If you have feedback or need assistance with the MCP directory API, please join our Discord server