over-engineered-arithmetic-calculator

romgapuz/over-engineered-arithmetic-calculator

3.3

If you are the rightful owner of over-engineered-arithmetic-calculator and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Over-Engineered Arithmetic Calculator is a sophisticated system that combines a web-based frontend, a backend powered by Amazon Bedrock Foundation Models, and an MCP server to perform arithmetic calculations.

Tools
  1. add

    Performs addition of two numbers.

  2. subtract

    Performs subtraction of two numbers.

  3. multiply

    Performs multiplication of two numbers.

  4. divide

    Performs division of two numbers.

Over-Engineered Arithmetic Calculator

This project implements an arithmetic calculator with a web-based frontend and a backend powered by Amazon Bedrock Foundation Models through LangGraph. The calculator uses LangGraph to break down arithmetic expressions into step-by-step operations and uses an MCP server to perform the actual calculations.

Architecture

  • Frontend (Flask): Web interface on port 8080
  • Backend (Flask): LangGraph + Amazon Bedrock on port 5000
  • MCP Server (FastAPI + FastMCP): Arithmetic operations on port 8000
  • Tests: Unit tests for all components

Prerequisites

  • Python 3.9+
  • AWS account with Amazon Bedrock access
  • AWS CLI configured

Setup

# Linux/macOS
./setup.sh

# Windows
setup.bat

Configuration

Copy .env.example to .env and update:

# Required AWS settings
AWS_REGION=us-east-1
BEDROCK_MODEL_ID=anthropic.claude-3-sonnet-20240229-v1:0

# Optional port overrides
MCP_SERVER_PORT=8000
BACKEND_PORT=5000
FRONTEND_PORT=8080

# Optional security settings
MCP_AUTH_TOKEN=your_secret_token  # For Bearer token authentication

Run Application

# Start all services (run in separate terminals)
./run_mcp_server.sh    # or .bat on Windows
./run_backend.sh       # or .bat on Windows  
./run_frontend.sh      # or .bat on Windows

Access at http://localhost:8080

Testing

./run_tests.sh         # or .bat on Windows

Components

  • Frontend: Flask web interface with calculator UI
  • Backend: LangGraph integration with Amazon Bedrock for step-by-step evaluation
  • MCP Server: FastAPI server with FastMCP tools providing add, subtract, multiply, divide operations

Troubleshooting

  • Python not found: Ensure Python 3.9+ is in PATH
  • Permission denied: chmod +x *.sh (Linux/macOS)
  • AWS access: Verify Bedrock permissions and model access
  • Port conflicts: Check if ports 5000, 8000, 8080 are available
  • Authentication errors: Ensure MCP_AUTH_TOKEN is set consistently in both backend and MCP server

License

This project is licensed under the MIT License - see the file for details.