Simple Calculator MCP Server
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Simple Calculator MCP Serveradd 15 and 25"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Simple Calculator MCP Server
A simple Model Context Protocol (MCP) server built with FastMCP that demonstrates how to create MCP Tools and Resources. This project exposes basic arithmetic operations, random number generation, and server metadata over the HTTP transport.
Features
➕ Add two integers
🎲 Generate a random number within a specified range
📄 Expose server information as an MCP Resource
🌐 HTTP transport support
Related MCP server: API MCP Server
Project Structure
SimpleCalculatorMCPServer/
│
├── main.py
├── pyproject.toml
├── README.md
└── .venv/Requirements
Python 3.10+
uv
FastMCP
Installation
1. Clone the repository
git clone <repository-url>
cd SimpleCalculatorMCPServer2. Create a virtual environment
uv venv3. Activate the environment
Linux/macOS
source .venv/bin/activateWindows
.venv\Scripts\activate4. Install FastMCP
uv add fastmcpRunning the Server
Start the MCP server:
python main.pyor
uv run python main.pyThe server will start on:
http://localhost:8000Available Tools
1. add
Adds two integers.
Parameters
Name | Type | Description |
a | int | First integer |
b | int | Second integer |
Example
Input
{
"a": 15,
"b": 25
}Output
402. random_number
Generates a random integer within a given range.
Parameters
Name | Type | Default |
min_val | int | 1 |
max_val | int | 100 |
Example
Input
{
"min_val": 10,
"max_val": 50
}Output
27Available Resource
info://server
Returns metadata about the MCP server.
Example Response
{
"name": "Simple Calculator Server",
"Version": "1.0.0",
"Description": "A basic MCP server with math tools and random number generation.",
"tools": [
"add",
"random_number"
],
"authors": "BinishaChapagain"
}Transport
The server runs using the HTTP transport.
Configuration:
mcp.run(
transport="http",
host="0.0.0.0",
port=8000
)Testing
You can test the server using:
FastMCP Inspector
OpenCode
Any MCP-compatible client
Available endpoints:
Tool:
addTool:
random_numberResource:
info://server
Technologies Used
Python
FastMCP
Model Context Protocol (MCP)
Learning Objectives
This project demonstrates how to:
Create an MCP server using FastMCP.
Register MCP tools.
Register MCP resources.
Expose an MCP server over HTTP.
Interact with the server using an MCP client.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/BinCha1/simple-calculator-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server