本仓库提供了基于 Model Control Protocol (MCP) 的服务器,可将各类服务与 Claude Desktop 集成,为用户带来便捷的服务交互体验。
MCP 集成服务器包含 Gmail 和 Google Calendar MCP 服务器、后端 API MCP 服务器。下面将为你介绍它们的使用方法。
credentials.json
在项目目录中。# 安装所需包
pip install google-auth-oauthlib google-auth-httplib2 google-api-python-client
# 在 Claude Desktop 中安装服务器
mcp install server.py
mcp run server.py
。# 安装所需包
pip install pydantic
# 在 Claude Desktop 中安装服务器
mcp install backend_server.py
backend_server.py
中配置 API 端点和其他设置。# 获取收件箱中的最新邮件
from server import get_latest_emails
latest_emails = get_latest_emails(max_results=10)
# 使用 Gmail 查询搜索邮件
from server import search_emails
search_results = search_emails(query='subject:important', max_results=10)
# 查看特定电子邮件的内容
from server import get_email_content
email_content = get_email_content(email_id='123456')
# 发送电子邮件
from server import send_email
send_email(to='example@example.com', subject='Test', body='This is a test email', cc=None, bcc=None)
# 搜索日历事件
from server import search_events
events = search_events(query='meeting', max_results=10, time_min='2024-01-01T00:00:00Z')
# 创建新的日历事件
from server import create_calendar_event
create_calendar_event(summary='Meeting', start_time='2024-01-01T09:00:00Z', end_time='2024-01-01T10:00:00Z', description='Important meeting', location='Office')
# 假设 backend_server.py 中有一个与后端 API 交互的函数
from backend_server import interact_with_backend
result = interact_with_backend()
get_latest_emails(max_results: int = 10)
:获取收件箱中的最新邮件。search_emails(query: str, max_results: int = 10)
:使用 Gmail 查询搜索邮件。get_email_content(email_id: str)
:查看特定电子邮件的内容。send_email(to: str, subject: str, body: str, cc: Optional[str], bcc: Optional[str])
:发送电子邮件。search_events(query: str, max_results: int = 10, time_min: Optional[str])
:搜索日历事件。create_calendar_event(summary: str, start_time: str, end_time: str, description: Optional[str], location: Optional[str])
:创建新的日历事件。本项目使用 Python 开发,借助 Google API 实现 Gmail 和 Google Calendar 的集成,使用 Pydantic 模型进行数据验证。通过 MCP 协议,实现与 Claude Desktop 的通信。
文档未提及相关许可证信息。
感谢使用 MCP 集成服务器。如需更多信息,请查阅完整文档或联系支持团队。