- Home
- MCP servers
- Math Operations API &
Math Operations API &
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You run a lightweight MCP (Model Context Protocol) server that exposes basic math operations as both REST API endpoints and as tools for AI applications. This setup lets AI systems call add and subtract through familiar interfaces while also offering quick, local testing and integration with MCP clients.
How to use
You can use the server in two ways: as a FastAPI REST API for traditional HTTP requests, and as an MCP tool server that AI applications can invoke through the MCP ecosystem. Start by running the local MCP server, then connect your MCP client or inspector to list the available tools and call them with your input values. The two available tools are add and subtract, which return the computed result along with metadata about the operation and inputs.
How to install
Prerequisites you need before starting are Python 3.10 or higher and a runtime command to run MCP locally. You will also use uv as the MCP runtime command and an optional package manager to install dependencies.
Install dependencies and prepare your environment with the following steps.
pip install -r requirements.txt
uv pip install -r requirements.txt
Note: You can use either pip or uv to install dependencies depending on your setup. The server itself runs using uv to host the MCP-enabled python module.
## Additional configuration and usage notes
The MCP server is designed to be run locally and accessed by MCP-compatible clients. You can test locally via a terminal or an MCP Inspector tool. The following example demonstrates how the MCP server is typically started and how tools are exposed for AI integrations.
## Troubleshooting and validation
If you encounter issues connecting the MCP server to an AI client, verify the command used to start the server and the working directory. Ensure the required Python dependencies are installed and that the server script mcp\_server.py is present in the specified directory. Check for log messages that indicate misconfigurations or missing dependencies.
## Examples of testing the MCP server locally
You can verify functionality by testing the available tools directly from the MCP Inspector UI or by manual stdio testing. The available tools include add and subtract, each performing the described operation with your inputs.
## Using tooling in code editors and MCP clients
Connect to the local MCP server from your AI tooling by configuring the MCP client with the stdio connection details shown in the example configuration. This enables tools to appear in your editor's MCP panel and to be invoked from within conversations or workflows.
## What you get from the MCP server
Two tools are exposed: add and subtract. Each tool reports the computed result, the operation type, and the input values used. These tools integrate with clients that support MCP tool discovery and invocation.
## Testing and validation commands
Run the MCP server and test the endpoints or tools using your preferred method (REST clients, MCP Inspector, or stdio). Ensure you can list tools and call add and subtract with sample inputs to confirm the expected results.
## Available tools
### add
Adds two numbers and returns the result along with the operation type and inputs.
### subtract
Subtracts the second number from the first and returns the result along with the operation type and inputs.