- Calculator Server: HTTP-based MCP server with math operations.
- Flow Client: Client that combines AI understanding with MCP functions.
- Python 3.10+
- OpenAI API key (set as OPENAI_API_KEY environment variable)
- Packages:
mcp,intelli,httpx
-
Start the server
python http_mcp_calculator_server.py
This runs an MCP calculator server at http://localhost:8000/mcp
-
Run the client
python http_math_flow_client.py
Try changing the query in the script to test different operations!
Server (http_mcp_calculator_server.py)
- Creates an MCP server with math tools
- Tools: add, subtract, multiply
- Uses streamable HTTP transport at "/mcp" endpoint
Client (http_math_flow_client.py)
- Creates a two-step flow:
- OpenAI parses natural language into math operations
- MCP agent sends operations to the calculator server
- Shows the progression from text to calculation to result
Modify the user_query variable in the client to try:
user_query = "What is 25 multiplied by 4?"
user_query = "Can you subtract 15 from 100?"
user_query = "Add 123 and 456 please"The flow will extract the operation and numbers automatically.
User Query → OpenAI Parser → MCP Client → Calculator Server → Result
The client handles all parameter conversion and error handling automatically!