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-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.
mcp-math-server
A minimal Model Context Protocol (MCP) server designed to expose basic mathematical tools to AI models.
MCP-Server
Provides examples of Minimal Context Protocol (MCP) servers in Python for basic arithmetic operations and RSS feed searching, demonstrating different transport mechanisms (STDIO, HTTP) and FastAPI integration.
remote-mcp-server
A remote Model Context Protocol (MCP) server for tracking personal expenses, providing tools to add, list, and summarize financial data.