谷歌服务集成服务器

开源MCP服务器,用于本地运行谷歌服务(Gmail、日历、文档、表格、驱动器及Google Home设备)并通过ngrok隧道与Ditto助手后端连接。

  • by ditto-assistant
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 ditto-assistant/ditto-mcp-servers

使用说明

同上,MCP服务器

[!警告] 已存档/不推荐用于桌面。 Google工作区和家庭服务器 现在是 直接捆绑到Hey Ditto桌面应用程序中 (hey-ditto-realtime-desktop, google-mcp/),它在哪里运行 localhost:3100 并自动注册其工具-- 没有ngrok,没有手动设置。使用桌面应用程序进行本地谷歌集成。

此独立项目仅适用于 ngrok隧道路径:暴露 谷歌工具 云Ditto后端/手机应用程序 (api.heyditto.ai), 它需要一个公共URL。它共享相同的秘密 (~/.ditto-mcp-servers/google-workspace/)和港口 :3100 作为桌面 整合,所以 不要同时跑这两个。

开源 MCP(模型上下文协议) 服务器用于 同上助理。每台服务器都作为 本地家庭服务器 --您机器上的Next.js应用程序,具有设置GUI、用于连接的ngrok隧道和承载令牌身份验证,因此只有Ditto可以调用它。

支持的服务器

服务器 服务 端口 状态
谷歌 Gmail、日历、文档、表格、驱动器+谷歌主页(灯、恒温器等) 3100 ✅ 可用

建筑学

┌─────────────────────────────────────────────┐
│  Your Machine                               │
│                                             │
│  ┌───────────────────────────────────────┐  │
│  │  Next.js App (localhost:3100)         │  │
│  │  /         → Setup Wizard / Dashboard │  │
│  │  /api/mcp  → MCP SSE Endpoint        │  │
│  └──────────┬────────────────────────────┘  │
│             │                               │
│  ┌──────────▼──────────┐                    │
│  │  ngrok tunnel       │                    │
│  │  https://xyz.ngrok  │                    │
│  └──────────┬──────────┘                    │
└─────────────┼───────────────────────────────┘
              │
     ┌────────▼────────┐     ┌────────────────────────┐
     │  Ditto Backend  │◄───►│  Google APIs +         │
     │  api.heyditto.ai│     │  Google Assistant gRPC │
     └─────────────────┘     └────────────────────────┘

MCP端点(/api/mcp)受a保护 承载令牌 首次运行时自动生成并显示在仪表板上。Ditto使用该令牌通过ngrok隧道连接。


快速开始

先决条件

  • Node.js 20+
  • pnpm — npm install -g pnpm
  • ngrok帐户 — 免费注册
  • 谷歌云项目 使用OAuth凭据(见下文)
  • 同上账户 — 嘿,我也是

1.克隆并安装

git clone https://github.com/ditto-assistant/ditto-mcp-servers.git
cd ditto-mcp-servers
pnpm install

2.启动服务器

pnpm dev

打开 http://localhost:3100 --安装向导将指导您完成其余操作。


谷歌服务器(端口3100)

一个服务器,一个OAuth流,一个ngrok隧道。覆盖谷歌工作区 和 谷歌主页。

设置步骤

步骤1--谷歌OAuth凭据

  1. 谷歌云控制台 → 创建或选择项目
  2. 启用所需的API(API和服务→ 图书馆):
    • Gmail API、Google Calendar API、Google Docs API、Google Sheets API、Google Drive API
    • 谷歌助手API (适用于Google Home控制)
  3. OAuth同意屏幕 → 外部→ 将您的电子邮件添加为测试用户→ 添加范围 https://www.googleapis.com/auth/assistant-sdk-prototype
  4. 凭证→ 创建凭据→ OAuth 2.0客户端ID → Web应用程序
    • 授权重定向URI: http://localhost:3100/api/google/callback
  5. 粘贴 客户端ID 和 客户端密钥 进入巫师
  6. 对于谷歌主页:记下你的GCP 项目ID字符串 (例如。 my-project-123456)--设置后,将其输入仪表板上的主页卡中

第二步——使用谷歌登录 --一个同意屏幕允许访问您启用的所有内容

步骤3--ngrok代币 --粘贴您的 ngrok身份验证令牌

第4步——服务 --打开/关闭:Gmail、日历、文档、表格、驱动器, 谷歌主页

第5步——启动 --点击 启动服务器 打开隧道

可用工具(29)

类别 工具
Gmail gmail_search, gmail_read, gmail_send, gmail_draft, gmail_list_labels
日历 calendar_list_events, calendar_create_event, calendar_update_event, calendar_delete_event, calendar_search_events
文件 docs_create, docs_read, docs_update, docs_search
图纸 sheets_create, sheets_read, sheets_update, sheets_search
驾驶 drive_list, drive_search, drive_upload, drive_download
谷歌主页 home_send_command, home_turn_on, home_turn_off, home_set_brightness, home_set_color, home_set_thermostat, home_query

Google Home示例命令:

  • “打开卧室的灯”
  • “将厨房灯设置为40%”
  • “关闭所有灯”
  • “将恒温器设置为70度”
  • “客厅的灯开着吗?”

连接到Ditto

启动后,转到仪表板(http://localhost:3100):

  1. 复制 查找 URL (例如。 https://xxxx.ngrok-free.app)
  2. 复制 承载令牌 从连接卡

然后在Ditto应用程序中-- 设置→ MCP服务器→ 添加服务器:

字段 值
姓名 Google
URL https://xxxx.ngrok-free.app/api/mcp
认证 持票人→ 粘贴令牌

保存、启用和确认工具加载。


保持运行

服务器必须在本地运行,Ditto才能使用其工具。跑 pnpm dev 重启后再次启动。所有凭据都保存在 ~/.ditto-mcp-servers/google-workspace/ 所以设置只需要完成一次。保留的ngrok域使URL在重新启动时保持稳定。


项目结构

ditto-mcp-servers/
├── .npmrc                    # pnpm hoist config for @ngrok/* and @grpc/* native modules
├── packages/
│   ├── config/               # Config persistence (~/.ditto-mcp-servers/)
│   └── tunnel/               # ngrok tunnel management
└── servers/
    └── google-workspace/     # Google Workspace + Home MCP server (port 3100)
        ├── proto/            # Google Assistant Embedded gRPC proto
        ├── src/app/api/      # MCP SSE, config, status, OAuth routes
        ├── src/mcp/          # MCP server + 29 tool definitions
        ├── src/google/       # Google API clients + Assistant gRPC client
        └── src/components/   # Setup wizard + dashboard UI

凭据存储在:

~/.ditto-mcp-servers/google-workspace/
├── config.json    # OAuth creds, ngrok token, service toggles
├── tokens.json    # Google OAuth refresh token
├── state.json     # Active tunnel URL
└── auth.json      # Bearer token for Ditto

发展

pnpm install    # Install all dependencies
pnpm dev        # Start server on :3100
pnpm build      # Build all packages
pnpm lint       # Lint with Biome
pnpm format     # Format with Biome

贡献

欢迎投稿!用你的新服务器或改进打开一个PR。

许可证

麻省理工学院