Skip to content

A modular AI agent leveraging MCP servers to perform math, weather, and other tool-based tasks via natural language.

Notifications You must be signed in to change notification settings

kartik0905/mcp-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP-Agent

Python License Status

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.


Features

  • 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) and streamable_http (for web servers).

Installation

  1. Clone the repository:
git clone https://github.com/<your-username>/mcp-agent.git
cd mcp-agent
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Setup environment variables:
  • Create a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here

Usage

Start the MCP Servers

Math Server:

python mathserver.py

Weather Server:

python weather_server.py

Run the Client

python client.py

Example queries:

What's (3 + 5) * 12?
What is the weather in California?

Folder Structure

├── .env.example
├── .gitignore
├── README.md
├── client.py
├── main.py
├── mathserver.py
├── pyproject.toml
├── uv.lock
└── weather.py

Example Output

Math response: 96
Weather response: Currently sunny in California, 25°C

License

This project is licensed under the MIT License. See the LICENSE file for details.


Future Improvements

  • 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).

About

A modular AI agent leveraging MCP servers to perform math, weather, and other tool-based tasks via natural language.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages