calc-mcp

calc-mcp

3.3

Calc-MCP is a simple Model Context Protocol (MCP) server that integrates a calculator tool, allowing users to perform basic arithmetic operations through the MCP framework.

Calc-MCP is designed to provide a straightforward implementation of an MCP server with a focus on arithmetic operations. It leverages the MCP framework to facilitate communication between clients and the server, enabling users to perform calculations such as addition, subtraction, multiplication, and division. This server is ideal for educational purposes, demonstrations, or as a foundational component for more complex MCP-based applications. By integrating a calculator tool, Calc-MCP showcases the potential of MCP technology in handling specific tasks within a model context.

Features

  • Simple Arithmetic Operations: Supports basic operations like addition, subtraction, multiplication, and division.
  • MCP Framework Integration: Utilizes the MCP protocol to manage client-server communication efficiently.
  • Educational Tool: Serves as a learning resource for understanding MCP server implementation.
  • Extensible Design: Can be expanded to include more complex mathematical functions or additional tools.
  • Lightweight and Fast: Designed to be minimalistic, ensuring quick response times and low resource usage.

MCP Tools

  • {'Calculator': 'A tool integrated into the MCP server to perform basic arithmetic operations.'}

Usage with Different Platforms

Python

python
import mcp

class CalcMCPServer(mcp.Server):
    def handle_request(self, request):
        operation = request.get('operation')
        operands = request.get('operands')
        if operation == 'add':
            result = sum(operands)
        elif operation == 'subtract':
            result = operands[0] - operands[1]
        elif operation == 'multiply':
            result = operands[0] * operands[1]
        elif operation == 'divide':
            result = operands[0] / operands[1]
        else:
            result = 'Invalid operation'
        return {'result': result}

server = CalcMCPServer()
server.start()