Skip to main content
Glama
eriktilio

Math Expression MCP Server

by eriktilio

LangChain + Gemini + MCP (Tool Server)

Este projeto demonstra como criar um chain com LangChain usando o modelo gemini-2.0-flash do Google e integrá-lo com ferramentas customizadas usando o MCP (Multi-Chain Protocol), via conexão stdio.

✨ Funcionalidade

A chain é capaz de:

  • Interpretar linguagem natural com o Gemini.

  • Usar ferramentas externas via MCP — neste exemplo, uma calculadora de expressões matemáticas.

  • Executar localmente um servidor de ferramentas que se conecta à chain automaticamente.

Related MCP server: calculator-mcp

🔧 Requisitos

  • Python 3.10+

  • uv (ou pip tradicional)

📦 Instalação

Com uv (recomendado)

uv venv
source .venv/bin/activate
uv pip install -r requirements.txt

Ou com pip tradicional

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Crie um arquivo .env:

GOOGLE_API_KEY=sua_chave_google_api

🚀 Execução

1. Execute o servidor de ferramentas (MCP)

Primeiro, execute o servidor de ferramentas. Este servidor vai processar as expressões matemáticas.

python server.py

2. Execute o cliente

Em seguida, execute o cliente, que se conecta ao servidor e faz as requisições, passando a pergunta para a chain e recebendo o resultado do cálculo.

python client.py

Como Funciona?

  • O chain usa o modelo Gemini-Pro do Google para interpretar a linguagem natural.

  • Uma LLMChain é criada usando o modelo e um PromptTemplate para extrair a expressão matemática de uma pergunta.

  • A expressão extraída é então passada para uma ferramenta de cálculo via o protocolo MCP.

  • O servidor MCP calcula a expressão matemática e retorna o resultado.

A
license - permissive license
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    B
    maintenance
    An MCP server that exposes 16 calculator operations as tools, enabling arithmetic, rounding, and root calculations via natural language.
  • A
    license
    A
    quality
    C
    maintenance
    A Model Context Protocol server that exposes 8 mathematical tools (arithmetic, algebra, calculus, matrix operations, statistics, probability, unit conversions) to any MCP-compatible AI agent, enabling mathematical computations without code.
    8
    22
    1
    MIT
  • A
    license
    B
    quality
    C
    maintenance
    A Model Context Protocol (MCP) server that provides basic mathematical, statistical and trigonometric functions to Large Language Models (LLMs).
    59
    41
    1
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eriktilio/mcp-langchain-integration'

If you have feedback or need assistance with the MCP directory API, please join our Discord server