Remote Calculator FastMCP Server
by abhiram4580
README.md
# Remote Calculator FastMCP Server
A Model Context Protocol (MCP) server built with [FastMCP](https://github.com/jlowin/fastmcp) specifically configured to run **remotely over HTTP / SSE** (Server-Sent Events).
Remote MCP clients (e.g., Claude Desktop, Cursor, LibreChat, Open WebUI, and custom MCP clients) can connect to this server across the network or internet.
---
## 🛠 Available Tools
| Tool | Description | Parameters |
| :--- | :--- | :--- |
| `add` | Add two numbers together | `a` (float), `b` (float) |
| `subtract` | Subtract `b` from `a` (`a - b`) | `a` (float), `b` (float) |
| `multiply` | Multiply two numbers together | `a` (float), `b` (float) |
| `divide` | Divide `a` by `b` (with zero division check) | `a` (float), `b` (float) |
| `generate_random_number` | Generate a random integer in a range | `min_value` (int, default: 1), `max_value` (int, default: 100) |
---
## 🚀 Running the Remote Server
### Option 1: Direct Run (FastMCP Runner)
Runs on all network interfaces (`0.0.0.0`) by default on port `8000`:
```bash
uv run python main.py
```
### Option 2: Production ASGI Server (Uvicorn)
The Starlette ASGI application `app` is exported in `main.py`:
```bash
uv run uvicorn main:app --host 0.0.0.0 --port 8000
```
### Option 3: Using the FastMCP CLI
```bash
uv run fastmcp run main.py --transport sse --host 0.0.0.0 --port 8000
```
---
## ⚙️ Configuration (Environment Variables)
| Variable | Default | Description |
| :--- | :--- | :--- |
| `MCP_HOST` | `0.0.0.0` | Host/network interface to bind to |
| `PORT` or `MCP_PORT` | `8000` | Port number to listen on |
| `MCP_TRANSPORT` | `sse` | Transport protocol: `sse` or `http` (streamable HTTP) |
---
## 🔌 Connecting Remote MCP Clients
### 1. Connecting via SSE (Recommended for Remote Clients)
- **Endpoint URL**: `http://<SERVER_IP_OR_DOMAIN>:8000/sse`
Example client configuration (e.g., Claude Desktop / Cursor / LibreChat):
```json
{
"mcpServers": {
"remote-calculator": {
"url": "http://your-server-ip:8000/sse"
}
}
}
```
### 2. Connecting via Streamable HTTP
If using `MCP_TRANSPORT=http`:
- **Endpoint URL**: `http://<SERVER_IP_OR_DOMAIN>:8000/mcp`
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues