日历管理服务

Google Calendar MCP Server 是一个通过AI代理(如ElevenLabs)管理Google日历预约的服务,支持检查日历可用性、预约管理以及查看当日预约等功能。

  • by GiacomoRicciuto
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 GiacomoRicciuto/google-calendar-mcp

使用说明

谷歌日历MCP服务器

MCP(模型上下文协议)服务器,用于通过ElevenLabs等人工智能代理管理谷歌日历约会。

特性

  • ✅ 查看特定日期的日历可用性
  • ✅ 使用客户详细信息预订预约
  • ✅ 查看今天的约会
  • ✅ 支持上午/下午时间偏好
  • ✅ 自动时隙计算(30分钟间隔,上午9点至下午6点)

设置

先决条件

  • Node.js 18+或Deno
  • Google日历API凭证(服务帐户)
  • 与服务帐户电子邮件共享日历

地方发展

  1. 克隆存储库:

    git clone https://github.com/GiacomoRicciuto/google-calendar-mcp.git
    cd google-calendar-mcp
    
  2. 安装依赖项:

    npm install
    
  3. 配置环境:

    cp .env.example .env
    # Edit .env with your settings
    
  4. 添加Google凭据:

    • 将您的服务帐户JSON文件放入 credentials/service-account.json
    • 使用服务帐户电子邮件共享您的Google日历
  5. 构建并运行:

    npm run build
    npm start
    
  6. 测试服务器:

    # In another terminal
    node test-client.mjs
    

服务器将在以下位置可用:

  • MCP端点: http://localhost:3001/mcp
  • 检查器UI: http://localhost:3001/inspector

可用工具

1.检查可用性

查看特定日期的日历可用性。

参数:

  • date (必填):YYYY-MM-DD格式的日期(例如“2025-12-10”)
  • duration (可选):预约时间(分钟)(默认值:30)
  • preferred_time (可选):“上午”、“下午”或“任何”(默认值:“任何”)

例子:

{
  "date": "2025-12-10",
  "duration": 30,
  "preferred_time": "morning"
}

2.图书预约

在日历上预约。

参数:

  • datetime (必填):ISO日期时间(例如,“2025-12-10T10:00:00+01:00”)
  • customer_name (必填):客户名称
  • customer_phone (必填):客户电话号码
  • customer_email (可选):客户电子邮件
  • duration (可选):持续时间(分钟)(默认值:30)
  • notes (可选):附加注释

例子:

{
  "datetime": "2025-12-10T10:00:00+01:00",
  "customer_name": "Mario Rossi",
  "customer_phone": "+39 333 1234567",
  "customer_email": "mario@example.com",
  "duration": 30,
  "notes": "First appointment"
}

3.获得今天的预约

获取今天的所有预约。

参数: 无

部署

选项1:Deno部署(推荐)

# Install Deno and deployctl
curl -fsSL https://deno.land/install.sh | sh
deno install -Arf jsr:@deno/deployctl

# Deploy
deployctl deploy --project=deepagent-calendar deno-deploy.ts

在Deno Deploy仪表板中设置环境变量:

  • CALENDAR_ID
  • TIMEZONE
  • GOOGLE_CREDENTIALS (JSON字符串)

选项2:ngrok(快速测试)

npm start
# In another terminal:
ngrok http 3001

在ElevenLabs或其他AI代理中使用ngrok HTTPS URL。

环境变量

变量 描述 默认值
CALENDAR_ID 谷歌日历电子邮件 giacomo.ricciuto4@gmail.com
TIMEZONE 日历时区 Europe/Rome
PORT 服务器端口 3001
GOOGLE_CREDENTIALS_PATH JSON凭据路径 ./credentials/service-account.json
NODE_ENV 环境 development

谷歌日历设置

  1. 在Google Cloud Console中创建服务帐户
  2. 启用Google日历API
  3. 下载服务帐户JSON凭据
  4. 使用服务帐户电子邮件共享您的Google日历
  5. 授予“更改事件”权限

与ElevenLabs集成

  1. 部署服务器(使用Deno Deploy或ngrok进行HTTPS)
  2. 获取您的MCP端点URL(例如。, https://your-app.deno.dev/mcp)
  3. 在ElevenLabs代理配置中,添加MCP服务器URL
  4. 代理现在可以通过语音管理日历约会

发展

# Run in development mode with hot reload
npm run dev

# Build TypeScript
npm run build

# Test the MCP server
node test-client.mjs

项目结构

google-calendar-mcp/
├── src/
│   └── index.ts              # Main MCP server (Node.js)
├── credentials/
│   └── service-account.json  # Google credentials (gitignored)
├── deno-deploy.ts            # Deno Deploy entry point
├── test-client.mjs           # Test client
├── .env                      # Environment config (gitignored)
├── .env.example              # Example environment config
├── package.json
├── tsconfig.json
└── README.md

许可证

麻省理工学院

作者

DeepAgent-Giacomo Ricciuto