模型上下文协议服务器

一个基于FastAPI的MCP服务器,提供Google Tasks、Google Calendar和基本计算器操作的工具。

  • by Theedon
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 theedon/fastapi-mcp-example

使用说明

mcp示例

基于FastAPI的MCP(模型上下文协议)服务器,为Google任务、Google日历和基本计算器操作提供工具。

特性

  • 谷歌任务API:使用您的Google帐户创建和删除任务。
  • 谷歌日历API:更新Google日历中的事件。
  • 计算器:简单的数学运算(加、减)。

需求

  • Python 3.12+
  • 诗歌 用于依赖关系管理

安装

poetry install

运行服务器

poetry run uvicorn src.main:app --reload

API终点

  • /calc/add_numbers (POST):加两个数字。
  • /calc/subtract_numbers/{a}/{b} (GET):减去两个数字。
  • /google_tasks/create (POST):创建一个谷歌任务。
  • /google_tasks/delete (POST):删除谷歌任务。
  • /google_calendar/update_event (POST):更新谷歌日历事件。
  • /status (GET):健康检查。
  • /metadata (GET):服务器元数据。

认证

Google端点需要OAuth2访问令牌。有关详细信息,请参阅相关架构文件。