Skip to main content
Glama
mburatti

Stateless Math MCP Server

by mburatti

MCP Sample Application (Stateless Architecture)

A Model Context Protocol (MCP) sample project implemented in Python using FastMCP and mcp.client. This project demonstrates a stateless MCP server exposing mathematical tools over stdio transport along with an asynchronous client.


Features

  • Stateless MCP Server (server.py): Uses standard stdio transport without maintaining session states.

  • Asynchronous Client (client.py): Connects to the MCP server, discovers available tools dynamically, and executes tool calls.


Related MCP server: node-mcp-poc

Setup & Installation

Prerequisites

  • Python 3.10+ (Python 3.14 supported)

  • Virtual Environment (.venv)

1. Create and Activate Virtual Environment

python3 -m venv .venv
source .venv/bin/activate

2. Install Dependencies

pip install -r requirements.txt

Running the Application

Option A: Using the Runner Script

Execute the provided bash script to automatically use the environment's Python interpreter:

chmod +x run_sample.sh
./run_sample.sh

Option B: Running Manually

Activate your virtual environment and run the client:

python3 client.py

Example Output

When running client.py or ./run_sample.sh, the client will:

  1. Start the MCP server via stdio.

  2. Discover and print all available registered tools.

  3. Invoke the soma tool with arguments a=15 and b=27.

Starting MCP Server (Stateless Mode 2026-07-28 Spec)...
Connected to MCP Server (Stateless Mode).

--- Discovered Tools (Stateless) ---
{
  "name": "soma",
  "description": "Soma dois números fornecidos pelo usuário statelessly.",
  ...
}
------------------------------------

Calling tool: soma(15, 27)...
Result: O resultado de 15.0 + 27.0 é 42.0

Client finished. Stateless server connection closed.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal reference implementation of an MCP server with two basic math tools (add and multiply), designed as a starting point for learning MCP protocol and deploying remote servers to cloud platforms.
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal MCP server that exposes tools for addition, echoing text, time lookup, and URL fetching, with support for HTTP and stdio transports.
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    A model-agnostic MCP server exposing example tools (add1, multiply2, greet) for learning purposes, working with any LLM through stdio transport.
    -
  • F
    license
    A
    quality
    C
    maintenance
    A learning-oriented MCP server that exposes basic tools (echo, add, reverse) over stdio transport to validate MCP handshake and tool calls.
    3
    -