A modular AI agent powered by MCP (Multi-Client Protocol) servers, capable of performing math calculations, fetching weather data, and executing multiple tool-based tasks via natural language commands.
- Math Server: Supports addition, subtraction, multiplication, division, and evaluation of complex math expressions.
- Weather Server: Fetches current weather data for any location.
- Multi-Tool Agent: Combines multiple MCP servers into a single AI agent using LangChain and ReAct architecture.
- Flexible Transport: Supports both
stdio(for local Python servers) andstreamable_http(for web servers).
- Clone the repository:
git clone https://github.com/<your-username>/mcp-agent.git
cd mcp-agent- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Setup environment variables:
- Create a
.envfile in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
Math Server:
python mathserver.pyWeather Server:
python weather_server.pypython client.pyExample queries:
What's (3 + 5) * 12?
What is the weather in California?
├── .env.example
├── .gitignore
├── README.md
├── client.py
├── main.py
├── mathserver.py
├── pyproject.toml
├── uv.lock
└── weather.py
Math response: 96
Weather response: Currently sunny in California, 25°C
This project is licensed under the MIT License. See the LICENSE file for details.
- Add Notes / Knowledge Base MCP for remembering information.
- Add File Manager MCP for reading/writing local files.
- Add Code Runner MCP for executing Python/JS snippets safely.
- Expand to scientific math functions (log, sqrt, power).