多工具AI代理

一个基于MCP和LangChain的多工具AI代理,可动态连接并交互多个外部工具服务器(如数学计算和天气查询)。

  • by VinAy1223jhf
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 VinAy1223jhf/Multi-Tool-AI-Agent-using-MCP-Math-Weather-Server

使用说明

使用MCP的多工具人工智能代理

该项目演示了如何构建 工具增强型人工智能代理 使用 MCP(模型上下文协议) 和 LangChain,其中单个代理可以与多个外部工具动态交互。


我建造了什么

  • 创建 两台MCP服务器:
    • A. 数学服务器 用于算术运算
    • A. 天气服务器 通过HTTP公开
  • 建造了一个 客户端AI代理 即:
    • 连接到多个MCP服务器
    • 根据用户查询自动选择正确的工具
    • 使用LLM推理和调用工具

查询示例

User: what's (3 + 4) * 12?
User: what's the weather in dwarka sec-3 today?
## Tech Stack Used

- Python

- LangChain

- MCP (Model Context Protocol)

- FastMCP

- Groq LLM (qwen/qwen3-32b)

- AsyncIO

## Key Learnings

- How AI agents interact with external tools

- How MCP enables standardized tool communication

- Managing multiple tool servers (stdio + HTTP)

- Letting the model decide which tool to call and when