Calculadora MCP

Calculadora MCP

Provides a basic calculator tool for arithmetic operations (addition, subtraction, multiplication, division) with division-by-zero handling, and a temperature conversion tool between Celsius and Fahrenheit.

Category
Visit Server

README

Calculadora MCP

Este projeto foi desenvolvido em Python e consiste num servidor MCP com duas ferramentas.

Uma das ferramentas permite fazer cálculos básicos e a outra permite converter temperaturas.

Funcionalidades

A tool calcular permite realizar:

  • soma;
  • subtração;
  • multiplicação;
  • divisão.

Também foi acrescentada uma verificação para impedir divisões por zero e para apresentar uma mensagem quando a operação não é válida.

A tool converter_temperatura permite converter:

  • Celsius para Fahrenheit;
  • Fahrenheit para Celsius.

Tecnologias utilizadas

  • Python
  • MCP
  • Pytest
  • Logging

Instalação

Para instalar as bibliotecas necessárias:

pip install -r requirements.txt

Configuração no Claude Desktop

No Claude Desktop, abri as Configurações, entrei na área Desenvolvedor e cliquei em Editar configuração. Foi aberta a pasta onde se encontra o ficheiro claude_desktop_config.json. Abri esse ficheiro, adicionei a configuração abaixo, guardei as alterações e reiniciei completamente a aplicação.

{
  "mcpServers": {
    "calculadora": {
      "command": "C:\\Users\\Joao\\PycharmProjects\\PythonProject3\\.venv\\Scripts\\python.exe",
      "args": [
        "C:\\Users\\Joao\\PycharmProjects\\PythonProject3\\server.py"
      ]
    }
  }
}

Depois de guardar esta configuração, foi necessário reiniciar o Claude Desktop para que o servidor ficasse disponível.

Executar o servidor

Para iniciar o servidor:

python server.py

Testes

Os testes automáticos podem ser executados com:

pytest -v

Foram criados 8 testes para verificar os cálculos, a divisão por zero, as operações inválidas e as conversões de temperatura.

Teste da calculadora

A calculadora foi testada através do Claude Desktop.

Teste da calculadora

Teste do conversor

O conversor de temperatura também foi testado através do Claude Desktop.

Teste do conversor

Logging

Foi criado um ficheiro chamado server.log.

Nesse ficheiro ficam registadas as chamadas feitas às tools, incluindo a operação escolhida e os valores recebidos.

Registo das chamadas

Testes automáticos

Os testes foram executados com sucesso.

Testes automáticos

Ficheiros do projeto

  • server.py – contém o servidor MCP e as duas tools.
  • test_server.py – contém os testes automáticos.
  • requirements.txt – contém as bibliotecas necessárias.
  • server.log – guarda os registos das chamadas.
  • Pasta screenshots – contém as imagens dos testes.

Autora

Eduarda Brandão

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured