使用说明
🧠 MCP服务器项目-多代理人工智能工具
该项目演示了如何使用 FastMCP 框架。它包括基于COM的电子邮件自动化、外部API集成(OpenWeather)、基于本地文件的注释和实用程序功能的组合,所有这些都可以通过兼容MCP的代理接口访问。
🔧 需求
- Python 3.10+
- Windows(Outlook COM需要)
.env文件包含:OPENWEATHER_API_KEY=your_openweather_key_here
📁 目录结构
. ├── outlook_assistant.py#outlook电子邮件阅读/回复/撰写/搜索工具 ├── weather_mcp.py#当前、预报、历史和空气质量天气工具 ├── sticy_notes.py#文本文件支持的notes工具 ├── addition_server.py#简单的添加和问候工具 ├── notes.txt#用于存储便利贴的文件 └── README.md#此文件
📬 Outlook电子邮件助手
基于COM的电子邮件助手,与Microsoft Outlook集成,用于:
- 列出Outlook中的所有文件夹
- 获取并显示最近或匹配的电子邮件
- 阅读完整的电子邮件内容
- 发送回复或撰写新电子邮件
🔧 暴露的工具:
list_folders()list_recent_emails(days, folder_name)search_emails(search_term, days, folder_name)get_email_by_number(email_number)reply_to_email_by_number(email_number, reply_text)compose_email(recipient_email, subject, body, cc_email)
⚠️ 必须运行 视窗 安装了Microsoft Outlook。
🌍 天气工具(OpenWeather API)
使用OpenWeatherMap API提供天气详细信息,包括:
- 当前天气
- 5天预报
- 空气质量
- 天气警报
- 历史天气(过去5天)
🌦 暴露的工具:
get_current_weather(location)get_weather_forecast(location, days)get_air_quality(location)get_historical_weather(location, date)get_weather_alerts(location)search_location(query)
🌐 需要设置
OPENWEATHER_API_KEY在……里面.env
📝 AI贴纸
简单的笔记助手,将笔记本地存储在 notes.txt 文件。
🛠 工具和资源:
add_note(message)read_notes()get_latest_note()–作为资源notes://latestnote_summary_prompt()–从所有笔记中生成摘要提示
➕ 添加实用程序
使用MCP的简单算术和动态问候工具示例:
add(a, b)get_greeting(name)→ 资源greeting://{name}
🏁 运行任何MCP服务器
每个文件都定义了自己的FastMCP服务器。单独运行它们:
python outlook_assistant.py python weather_mcp.py python stick_notes.py python addition_server.py
每台服务器都将启动自己的FastMCP接口,以便与代理集成。
🧪 代理示例
现在,您可以将这些MCP工具与代理(CrewAI、LangChain等)连接,以启用会话工作流,如:
- “伦敦今天天气怎么样?”
- “总结我最新的便签”
- “回复Ajay的最后一封未读电子邮件”
- “42+11是什么?”
