Sourav04/local-mcp-server-calculator
If you are the rightful owner of local-mcp-server-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.
This project is a simple MCP server using fastmcp that provides basic calculation tools: add, subtract, multiply, and divide.
MCP Calculator Server
This project is a simple MCP server using fastmcp that provides basic calculation tools: add, subtract, multiply, and divide.
Setup
-
Install dependencies
Ensure you have Python 3.10+ installed.
and Install fasmcp using uv or pip
-
Run the server
python server.pyThe server will start at
http://127.0.0.1:8000/mcp(if using HTTP transport). (use this only for testing as the client tool will be running the server as well during testing)
Tools
add(a: float, b: float) -> floatsubtract(a: float, b: float) -> floatmultiply(a: float, b: float) -> floatdivide(a: float, b: float) -> float(raises error ifb == 0)
You can connect to this server using a fastmcp client or extend it with more tools as needed.
Using the Test Client (via stdio)
A sample client is provided in test_client.py to demonstrate how to interact with the MCP server using stdio transport.
How to Run the Client
- Make sure you are in the
mcpdirectory:cd mcp - Run the client:
python3 test_client.py
The client will automatically start the server and print the results of the calculator tools:
add(5, 3) = 8.0
subtract(10, 4) = 6.0
multiply(6, 7) = 42.0
divide(20, 5) = 4.0
You do not need to start the server separately when using stdio transport with the client.
Snapshot