Back to Home
Mkhubaiib icon

mcp_calculator

Verified Safe

by Mkhubaiib

Overview

A beginner-friendly Model Context Protocol (MCP) server exposing a simple calculator tool (add, subtract, multiply, divide) over WebSocket using FastAPI.

Installation

Run Command
uvicorn mcp_server.main:app --reload --port 8000

Security 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

Stats

Interest Score0
Security Score9
Cost ClassLow
Avg Tokens150
Stars0
Forks0
Last Update2025-11-27

Tags

WebSocketFastAPICalculatorMCPPython