Used for environment variable management, specifically for storing and accessing API keys like GROQ_API_KEY securely within the application.
Provides a unified agent interface for tool invocation, enabling orchestration of multiple MCP servers (Math and Weather agents) through LangChain's framework.
Serves as the implementation language for custom MCP servers, providing both stdio and HTTP transports for agent communication.
Model Context Protocol (MCP) Multi-Agent Demo
This project demonstrates how to set up and communicate with custom Model Context Protocol (MCP) servers in Python. It showcases multi-agent orchestration using LangChain, Groq, and MCP adapters, enabling both local and remote tool integration.
Features
- Custom MCP Servers: Math and Weather agents, each as independent MCP servers
- Multi-Transport Communication: Local (stdio) and remote (HTTP) transports
- LangChain Integration: Unified agent interface for tool invocation
- Async Orchestration: Efficient, non-blocking agent communication
Components
1. mathserver.py
A custom MCP server providing math operations (add, multiply) via stdio transport.
2. weather.py
A custom MCP server providing weather information via HTTP transport - (Static content for demo).
3. client.py
A Python client that connects to both servers, discovers their tools, and invokes them using a LangChain agent powered by Groq.
Setup Instructions
- Clone the repository
- Install dependencies:
- Set up environment variables:
- Create a
.env
file with yourGROQ_API_KEY
:
- Run the servers:
- Start the weather server (in one terminal):
- The math server is started automatically by the client when needed.
- Run the client:
Example Output
Learning Outcomes
- How to build and register custom MCP servers
- How to enable communication between agents using stdio and HTTP
- How to orchestrate multi-agent workflows with LangChain
Requirements
- Python 3.8+
- See
requirements.txt
for Python dependencies
License
MIT
This server cannot be installed
Demonstrates custom MCP servers for math and weather operations, enabling multi-agent orchestration using LangChain, Groq, and MCP adapters for both local and remote tool integration.
Related MCP Servers
- -securityAlicense-qualityA server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.Last updated -PythonMIT License
- -securityFlicense-qualityA modular production-ready system that provides specialized agents for math, research, weather, and summarization tasks through a unified MCP toolbox with smart supervisor capabilities.Last updated -Python
- -securityFlicense-qualityA Model Context Protocol (MCP) server that demonstrates mathematical capabilities through a LangChain integration, allowing clients to perform math operations via the MCP protocol.Last updated -Python
- -securityFlicense-qualityA Model Context Protocol (MCP) server that enables AI assistants and LLMs to access real-time weather data and forecasts by connecting to the OpenWeatherMap API.Last updated -Python