Skip to main content
Glama
NeelContractor

Simple Calculator MCP Server

README.md
# Simple Calculator MCP Server

A beginner-friendly MCP (Model Context Protocol) server built with FastMCP.

This project demonstrates how to create, run, and deploy a simple MCP server with tools and resources using FastMCP.

## Features

### Tools

* **add** — Add two numbers together.
* **random_number** — Generate a random number within a specified range.

### Resources

* **info://server** — Returns server metadata and available tools.

## Tech Stack

* Python 3.14+
* FastMCP 3.4.0

## Installation

Install dependencies:

```bash
uv sync
```

or

```bash
uv add fastmcp
```

## Run Locally

Start the MCP server:

```bash
uv run python main.py
```

The server will run on:

```text
http://localhost:8000
```

## MCP Inspector

Test the server using the FastMCP Inspector:

```bash
uv run fastmcp dev inspector main.py
```

## Example Tools

### Add Numbers

Input:

```json
{
  "a": 10,
  "b": 20
}
```

Output:

```json
30
```

### Random Number

Input:

```json
{
  "min_value": 1,
  "max_value": 100
}
```

Output:

```json
57
```

## Resource Example

Resource URI:

```text
info://server
```

Example Response:

```json
{
  "name": "Simple Calculator Server",
  "version": "1.0.0",
  "description": "A basic MCP server with math tools",
  "tools": ["add", "random_number"],
  "author": "Neel Contractor"
}
```

## Deploy to FastMCP Cloud

This project was created as a learning exercise for deploying MCP servers to FastMCP Cloud.

After configuring your FastMCP account, deploy the server using the FastMCP deployment workflow.

## Project Structure

```text
.
├── main.py
├── pyproject.toml
├── uv.lock
└── README.md
```