MCP Calculator Server logo

MCP Calculator Server

by kumartheashwani

This is a Model Context Protocol (MCP) server implementation with a basic calculator tool. It provides arithmetic operations through a REST API and can be deployed in Smithery.

View on GitHub

Last updated: N/A

What is MCP Calculator Server?

The MCP Calculator Server is a server that implements the Model Context Protocol and provides a basic calculator tool. It offers arithmetic operations (add, subtract, multiply, divide) through a REST API and is designed to be integrated with Smithery.

How to use MCP Calculator Server?

The server can be run in HTTP mode (recommended for production), Smithery mode (for local tool integration), or dual mode (for development). Use the provided scripts or commands to start the server in the desired mode, ensuring to set the appropriate environment variables. Access the API endpoints via HTTP requests or integrate with Smithery as a local or remote tool.

Key features of MCP Calculator Server

  • Basic arithmetic operations (add, subtract, multiply, divide)

  • MCP-compliant API endpoints

  • JSON schema validation

  • Error handling

  • Multiple communication modes (HTTP, WebSocket, stdio)

  • Specialized entry points for different deployment scenarios

Use cases of MCP Calculator Server

  • Providing a calculator service within a Smithery environment

  • Performing arithmetic operations via a REST API

  • Integrating with other tools and services using the MCP protocol

  • Deploying as a microservice in a containerized environment

FAQ from MCP Calculator Server

What is MCP?

MCP stands for Model Context Protocol. It is a protocol used for communication between tools and services.

How do I run the server in HTTP mode?

Set the MCP_HTTP_MODE environment variable to 1 and run the server using uvicorn or the provided start-container script.

How do I integrate the server with Smithery as a local tool?

Set the MCP_STDIO_MODE and LOGGING_CONFIG environment variables to 1 and stdio respectively, and run the server using the provided start-smithery script or configure smithery to use the server.py script with the correct environment variables.

What are the available API endpoints?

The server provides endpoints for health checks, listing available tools, and executing operations via JSON-RPC. There are also dedicated MCP endpoints for Smithery integration.

How do I deploy the server in a Docker container?

Build the Docker image using the provided Dockerfile and run the container, exposing port 8000. For Smithery integration, use the Dockerfile.smithery and run the container with MCP_STDIO_MODE and LOGGING_CONFIG environment variables set.