Skip to main content
Glama
vrxtxxx

MCPMathServer

by vrxtxxx

MCPMathServer

A Model Context Protocol (MCP) server exposing math and weather tools, with a LangChain agent client powered by Groq.

Features

  • Math toolsadd, subtract, multiply via MCP stdio transport

  • Weather toolget_weather via MCP streamable HTTP transport (placeholder)

  • Agent client — LangChain agent that connects to both MCP servers and answers natural-language queries using ChatGroq

Related MCP server: SampleMCP

Prerequisites

Setup

# Clone and enter the project
git clone <repo-url> && cd MCPMathServer

# Install dependencies with uv (virtual environment is created automatically)
uv init 

# For virtual environment:
uv venv

Create a .env file in the project root:

GROQ_API_KEY=your_groq_api_key_here

Usage

Run the math server (stdio)

python mathserver.py

Run the weather server (streamable HTTP)

python weather.py

Run the agent client

python client.py

The client connects to both servers, then sends example queries:

  • "what's (3 + 5) x 12?" — routed to the math server

  • "what is the weather in California?" — routed to the weather server

Project Structure

MCPMathServer/
├── mathserver.py      # MCP math tool server (stdio)
├── weather.py         # MCP weather tool server (streamable HTTP)
├── client.py          # LangChain agent client
├── main.py            # Entry point placeholder
├── pyproject.toml     # Project metadata & dependencies
├── requirements.txt   # Pip dependencies
└── .env               # API keys (not committed)

Dependencies

Related MCP Connectors

Related MCP Servers