Math MCP Server
Provides four fundamental arithmetic operations (add, subtract, multiply, divide) as MCP tools with zero-division protection.
README
Math MCP Server
A clean and simple Model Context Protocol (MCP) server built with FastMCP that provides four fundamental mathematical operations as tools.
Features
This MCP server exposes the following tools:
- add - Add two numbers together
- subtract - Subtract the second number from the first
- multiply - Multiply two numbers together
- divide - Divide the first number by the second (with zero-division protection)
Installation
# Install dependencies
uv sync
Usage
Running the Server
The server can be run directly using:
uv run math-mcp-server
Configuring in Kiro or Other MCP Clients
Add this server to your MCP client configuration (e.g., ~/.kiro/settings/mcp.json):
{
"mcpServers": {
"math": {
"command": "uv",
"args": [
"--directory",
"d:\\MCP\\math-mcp-server",
"run",
"math-mcp-server"
]
}
}
}
Example Tool Usage
Once configured, you can use the tools through your MCP client:
Addition:
- Input:
a=5, b=3 - Output:
5 + 3 = 8
Subtraction:
- Input:
a=10, b=4 - Output:
10 - 4 = 6
Multiplication:
- Input:
a=7, b=6 - Output:
7 × 6 = 42
Division:
- Input:
a=15, b=3 - Output:
15 ÷ 3 = 5.0
Code Structure
The implementation is extremely simple and readable using FastMCP:
from fastmcp import FastMCP
mcp = FastMCP("Math Operations Server")
@mcp.tool()
def add(a: float, b: float) -> str:
"""Add two numbers together."""
result = a + b
return f"{a} + {b} = {result}"
# ... and so on for subtract, multiply, divide
Each operation is a separate @mcp.tool() decorated function, making the code:
- Easy to read and understand
- Simple to extend with new operations
- Self-documenting with type hints and docstrings
Project Structure
math-mcp-server/
├── src/
│ └── math_mcp_server/
│ └── __init__.py # Main server implementation (4 simple functions!)
├── pyproject.toml # Project configuration
└── README.md # This file
Requirements
- Python >= 3.14
- fastmcp >= 3.4.6
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.