mcp_calculator
Verified Safeby Mkhubaiib
Overview
A beginner-friendly Model Context Protocol (MCP) server exposing a simple calculator tool (add, subtract, multiply, divide) over WebSocket using FastAPI.
Installation
uvicorn mcp_server.main:app --reload --port 8000Security Notes
The server demonstrates strong security practices for its scope: it uses Pydantic for robust inbound message validation, handles errors gracefully by returning structured error messages without exposing internal details, and explicitly catches division-by-zero errors. No 'eval' or similar dangerous functions are used. There are no hardcoded secrets, and dependencies are standard. The server primarily performs arithmetic, limiting the attack surface. A basic HTML demo page is exposed on `/demo`, which might typically be removed in a production environment, but is benign in this context.
Similar Servers
mcp_calculator
A beginner-friendly Model Context Protocol (MCP) server exposing a simple calculator tool (add, subtract, multiply, divide) over WebSocket using FastAPI.
mcp-server-demo
This server acts as an AI assistant tool provider (MCP server) offering calculator functions, data logging, and reporting capabilities via SQLite, demonstrating how AI can interact with external services.
test_mcp_server
A basic server providing arithmetic tools and server information via the FastMCP framework.
mcp-math-server
A minimal Model Context Protocol (MCP) server designed to expose basic mathematical tools to AI models.