Skip to main content
Glama

Google MCP(google-mcp)

一个叫 Google MCP 的自研 stdio 服务器,三块能力合一体:

  1. GitHub 只读桥接:把原 github-mcp 的仓库/Issue/PR/提交/代码搜索等只读能力直接融进来(github_* 前缀,19 个工具),需 GITHUB_TOKEN。

  2. Google Workspace:Gmail + Drive + Calendar,OAuth2 个人账号授权,零第三方依赖(只用 @modelcontextprotocol/sdk + Node 内置模块)。

  3. 浏览器式工具(对标 Edge MCP):内置同源 CDP 引擎(vendor/edge/,随仓库自带,单独 clone 即可跑),开标签/导航/读页/查找/点击/输入/截图/eval/网络/存储,独立浏览器实例(端口 9333),与 Edge MCP 的 9222 互不干扰。

浏览器选择器(重要):Edge MCP 和 Google MCP 都能做浏览器操作。两者的 browser_pick 工具会返回 question + options,模型必须原样用 ask_user_question 弹给用户选「Edge MCP」还是「Google MCP」,按选择调用 edge_* 或 google_*,不要替用户选。

能力

类别

工具

说明

GitHub

github_status / github_whoami / github_search_repositories / github_get_repository

状态/账号/仓库搜索与读取,只读

GitHub

github_list_branches / github_list_commits / github_get_commit / github_list_tags / github_list_releases

分支/提交/Tag/Release,只读

GitHub

github_get_file / github_list_directory / github_get_readme

文件/目录/README 内容,只读

GitHub

github_list_issues / github_get_issue / github_list_pulls / github_get_pull / github_get_pull_diff

Issue 与 PR(含 diff),只读

GitHub

github_search_code / github_search_issues

代码/Issue 跨仓搜索,只读

认证

google_status / google_auth / google_revoke

状态/浏览器授权/撤销。token 值永不返回或打印

Gmail

gmail_search / gmail_read

搜索(Gmail 语法)与读正文,只读

Gmail

gmail_send_draft → gmail_send_commit

发信两步确认

Drive

drive_search / drive_read

文件元数据搜索;Docs→txt、Sheets→csv 导出,只读

Calendar

calendar_list / calendar_events

列日历/事件,只读

Calendar

calendar_insert_draft → calendar_insert_commit

新建日程两步确认

Calendar

calendar_patch_draft → calendar_patch_commit

修改日程两步确认

Calendar

calendar_delete_draft → calendar_delete_commit

删除日程两步确认(不可恢复)

选择器

browser_pick

★ 浏览器操作前必调,弹选项让用户选 Edge / Google MCP

浏览器

google_browser(connect/launch/status/quit/login)/google_tabs/google_goto

连接/启动独立浏览器、标签管理、导航

浏览器

google_read / google_find / google_click / google_type / google_key / google_scroll

读页/找元素/点击/输入/按键/滚动

浏览器

google_screenshot / google_eval / google_wait / google_dialog

截图/执行 JS/等待/弹窗

浏览器

google_storage / google_console / google_network / google_mock / google_cdp

存储 cookie/控制台/网络流量/伪造响应/原始 CDP

读工具可直接调用;所有写工具必须 draft → 展示预览给用户 → 用户明确同意 → commit。commit 必须带用户对预览说的确认原话(consent)。没有直接删邮件的工具。

浏览器工具跑在独立 profile(默认端口 9333,可用 GOOGLE_BROWSER_PORT 改)。google_browser(op="login") 打开 Google 登录页,Workspace API 授权仍走 google_auth(loopback + PKCE,token 只存本地)。浏览器操作前记得先 browser_pick 让用户选。

Related MCP server: Gmail MCP

配置(一次性)

1. 建 OAuth 客户端

  1. 打开 Google Cloud Console → 凭据,建一个项目(或选已有的)。

  2. API 和服务 → 库,分别启用 Gmail API、Google Drive API、Google Calendar API。

  3. 凭据 → 创建凭据 → OAuth 客户端 ID → 应用类型选 桌面应用(desktop app)。

  4. 拿到 客户端 ID 和 客户端密钥。桌面应用允许任意 loopback 重定向端口,不用手动填 redirect URI(服务器每次随机取 127.0.0.1:<随机端口>/callback)。

  5. 把你的账号加为测试用户(OAuth 同意屏幕 → 测试用户),否则授权时会报 "unverified app"。

OOB(urn:ietf:wg:oauth:2.0:oob)已被 Google 废弃,所以这里用 loopback + PKCE,不用复制粘贴验证码的旧流程。万一自动回调收不到,也支持把浏览器地址栏的完整 URL 用 google_auth 的 manualCode 参数粘进来。

2. 给凭据

支持两种(环境变量优先):

  • 环境变量:GOOGLE_CLIENT_ID、GOOGLE_CLIENT_SECRET、GITHUB_TOKEN(GitHub 只读桥接;等价于旧 github-mcp 的 GITHUB_PERSONAL_ACCESS_TOKEN)

  • 配置文件 <包目录>/config.json(已 gitignore):

{
  "clientId": "xxx.apps.googleusercontent.com",
  "clientSecret": "GOCSPX-xxx",
  "scopes": ["https://www.googleapis.com/auth/gmail.readonly", "..."],
  "githubToken": "ghp_xxx"
}

GitHub 只读桥接零额外依赖:用 Node 内置 fetch 直连 https://api.github.com(Bearer token),token 只从配置/环境变量读取,绝不回传或打印。github_status 可查看是否就绪;GITHUB_API_BASE 可改 API 端点(企业版)。GitHub 与 Google 两套凭据互不干扰,可以只配其中一套。

3. 授权

让模型调 google_auth:会打开浏览器 → Google 登录/同意 → 本地回调收到 code → 换 token 落到 <包目录>/.state/token.json(权限 0600)。token 过期自动用 refresh_token 刷新,不用重复登录。

其他环境变量:GOOGLE_MCP_CONFIG(配置文件路径)、GOOGLE_MCP_TOKEN_FILE(token 路径)、GOOGLE_SCOPES(空格分隔覆盖默认 scope)、GOOGLE_BROWSER_HOST / GOOGLE_BROWSER_PORT(浏览器调试端点,默认 127.0.0.1:9333)、GOOGLE_SHOT_DIR(截图目录)。默认 scope = Gmail 只读+发信、Drive 只读、Calendar 读写、openid、userinfo.email。要加能力就加 scope 后重新 google_auth。

在 DSH 里用

dsh-mcp 管理器的 src/lib/catalog.js 里已有 google 模板。用 manager 装:

node bin/dsh-mcp.js add google \
  --param clientId=xxx.apps.googleusercontent.com \
  --param clientSecret=GOCSPX-xxx

然后让 DSH 重载补丁(DSH 是 live reload),调 google_auth 完成一次登录即可。

凭据用 --param 传进去会写进 cordis.patch.yml。模板对 GOOGLE_CLIENT_ID / GOOGLE_CLIENT_SECRET / GITHUB_TOKEN 都用 DSH 的 !!js 表达式从主进程环境变量取值,写法必须是带 ${} 的 !!js "`${process.env.X}`",不能写成 !!js "`process.env.X`"(后者没有 ${},求值结果是字面量字符串 process.env.X,会导致「看起来配了、实际是假值」)。

重要:DSH 主进程只在启动时继承环境变量。如果你在 DSH 运行期间才设置 GITHUB_TOKEN(例如 [Environment]::SetEnvironmentVariable(...,"User")),即使重启 MCP 子进程也读不到,GitHub 工具会一直 401。这种情况要么完全退出并重启 DSH 主进程,要么把 token 直接写进 cordis.patch.yml 的 env.GITHUB_TOKEN,或在包目录的 config.json 里配 githubToken(该文件已在 .gitignore,不会提交)。github_status 只检查「有没有 token 字符串」,不验证有效性;用 github_whoami 才能确认 token 真的生效(成功返回 login)。

开发 / 验证

node verify.js                       # 离线自检(不联网、不碰真 token)
node --test --test-isolation=none test/unit.test.js   # 单元测试
node server.js                       # 直接跑 stdio 服务器(需先配凭据)

仓库沙箱里 node --test 默认会 spawn 子进程(被 EPERM 拦),所以测试命令带 --test-isolation=none 在进程内跑。

安全说明

  • token 文件 0600,且从不进入日志或工具返回值;google_status 只显示 scope、过期时间、是否有 refresh_token。

  • confirmId 是一次性的、10 分钟过期、hash 防篡改;确认单只存在内存里,重启即失效。

  • 写操作(发信/日程增删改)在没有用户对预览点头前不会发出。

  • revoke 需要用户明确说「确认撤销 Google 授权」。

Available Tools

55 tools
browser_pickA

【浏览器 MCP 选择器 · 调用任何浏览器操作前必须先调这个】当任务涉及浏览器操作(打开网页/登录态页面/点按钮/截图/看流量)时,边和 Google(本 MCP)都能做,先用本工具拿到选择问题与选项,原样用 ask_user_question 弹出让用户选「Edge MCP」还是「Google MCP」,用户选 Edge 就去调 edge_* 工具,选 Google 就用本 MCP 的 google_browser/google_* 工具。不要替用户选。

Inputs: reason.

calendar_delete_commitB

【第 2 步】用户确认后真正删除日程(不可恢复)。

Inputs: hash (required), consent (required), confirmId (required).

calendar_delete_draftB

【第 1 步】准备删除日程:返回确认单与预览,不真正删除。

Inputs: eventId (required), calendarId.

calendar_eventsB

列出日历事件(支持时间范围与关键词)。只读。

Inputs: q, timeMax, timeMin, pageToken, +2 more.

calendar_insert_commitC

【第 2 步】用户确认后真正创建日程。

Inputs: hash (required), consent (required), confirmId (required).

calendar_insert_draftA

【第 1 步】准备新建日程:返回确认单与预览,不真正创建。展示给用户拿到同意后调用 calendar_insert_commit。

Inputs: event (required), calendarId.

calendar_listC

列出日历(含 id、名称、时区、权限)。只读。

Inputs: pageToken, maxResults.

calendar_patch_commitC

【第 2 步】用户确认后真正修改日程。

Inputs: hash (required), consent (required), confirmId (required).

calendar_patch_draftB

【第 1 步】准备修改日程:返回确认单与预览,不真正修改。

Inputs: changes (required), eventId (required), calendarId.

drive_readB

读取 Google 文档/表格内容为文本(Docs→txt,Sheets→csv)。只读。

Inputs: fileId (required), mimeType.

github_get_commitC

读取单个提交详情(只读)。

Inputs: repo (required), owner (required), ref.

github_get_fileB

读取仓库中一个文件的内容(只读,二进制会提示)。

Inputs: repo (required), owner (required), ref, path.

github_get_issueC

读取单个 Issue(只读)。

Inputs: repo (required), owner (required), number.

github_get_pullC

读取单个 Pull Request(只读)。

Inputs: repo (required), owner (required), number.

github_get_pull_diffB

读取 Pull Request 的 diff/patch(只读,截断到 30000 字符)。

Inputs: repo (required), owner (required), number.

github_get_readmeC

读取仓库 README(只读)。

Inputs: repo (required), owner (required), ref.

github_get_repositoryB

读取一个仓库的元数据(只读)。

Inputs: repo (required), owner (required).

github_list_branchesC

列出仓库分支(只读)。

Inputs: repo (required), owner (required), page, per_page.

github_list_commitsA

列出提交历史(只读,支持 sha/path/author/since/until 过滤)。

Inputs: repo (required), owner (required), sha, page, +5 more.

github_list_directoryB

列出仓库中一个目录的内容(只读)。

Inputs: repo (required), owner (required), ref, path.

github_list_issuesC

列出仓库 Issue(只读,不含 PR)。

Inputs: repo (required), owner (required), page, sort, +5 more.

github_list_pullsC

列出 Pull Request(只读)。

Inputs: repo (required), owner (required), base, head, +5 more.

github_list_releasesC

列出 Release(只读)。

Inputs: repo (required), owner (required), page, per_page.

github_list_tagsC

列出 Tag(只读)。

Inputs: repo (required), owner (required), page, per_page.

github_search_codeC

搜索代码(只读,需 GitHub 代码搜索权限)。

Inputs: q (required), page, per_page.

github_search_issuesC

跨仓库搜索 Issue/PR(只读)。

Inputs: q (required), page, sort, order, +1 more.

github_search_repositoriesC

搜索 GitHub 仓库(只读)。

Inputs: repo (required), owner (required), q, page, +3 more.

github_statusA

查看 GitHub 只读桥接是否可用(是否配置 token)。只读,不返回 token 值。

Inputs: no named parameters.

github_whoamiA

查看当前 GitHub token 对应的账号(只读)。

Inputs: no named parameters.

gmail_readB

读取一封邮件的头部与正文(优先纯文本)。只读。

Inputs: id (required), format.

gmail_send_commitB

【第 2 步】用户确认后真正发送邮件。consent 必须是用户对预览说的确认原话。

Inputs: hash (required), consent (required), confirmId (required).

gmail_send_draftA

【第 1 步】准备发送邮件:返回确认单与预览,不真正发送。展示给用户并拿到同意后调用 gmail_send_commit。

Inputs: to (required), body (required), cc, bcc, +2 more.

google_authA

第一次使用/token 失效时,完成 Google OAuth2 授权(打开浏览器,本地 loopback 收 code + PKCE)。授权成功后 token 只存本地,永不回传。

Inputs: timeoutMs, manualCode.

google_browserA

连接/启动/关闭 Google MCP 专用的 Chromium/Edge 浏览器(CDP 调试,默认独立端口 9333,与 edge-mcp 的 9222 不是同一个实例)。第一次用先 op=connect(复用已开着的浏览器),连不上再 op=launch(本服务拉独立 profile)。op=status 看状态,op=login 打开 Google 登录页(先 google_auth 拿授权)。

Inputs: op, exe, host, kill, +6 more.

google_cdpC

逃生舱:直接发一条 CDP 命令(scope=browser/page)。如 Page.captureScreenshot、Network.setUserAgentOverride。

Inputs: method (required), scope, params, tab_id, +1 more.

google_clickB

真实鼠标点击(先 scrollIntoView)。clear=true 先清空输入框,count=2 双击,button=right 右键。

Inputs: x, y, name, role, +9 more.

google_consoleC

读页面 console 输出与 JS 异常。

Inputs: clear, level, limit, since, +1 more.

google_dialogC

处理页面 JS 弹窗(alert/confirm/prompt/beforeunload):accept=true 确定,false 取消。

Inputs: accept, tab_id, wait_ms, prompt_text.

google_evalC

在当前页面执行 JS(表达式/函数体,支持 await)。返回值走 JSON 序列化。

Inputs: script (required), args, tab_id, timeout_ms.

google_findB

在页面里找元素(selector/text/role+name/xpath),返回坐标与推荐选择器,点击前确认唯一性。

Inputs: name, role, text, limit, +5 more.

google_gotoC

导航:goto/back/forward/reload。默认等到 load;wait_until 可选 domcontentloaded/networkidle/none。

Inputs: op, url, tab_id, timeout_ms, +2 more.

google_keyC

按特殊键:Enter/Tab/Escape/Backspace/方向键/F1-F12,支持 ctrl/shift/alt/meta。

Inputs: key (required), alt, ctrl, meta, +3 more.

google_mockC

拦截并伪造响应(CDP Fetch),用于调试前端如何响应服务端异常。op=set/status/off。

Inputs: op, body, rules, status, +4 more.

google_networkC

查看网络流量(CDP Network),op=log/list/body/clear。抓 XHR 出入参先 log 拿 request_id 再 body。

Inputs: op, url, limit, filter, +6 more.

google_readB

读页面:mode=outline(默认,可交互元素清单)/text/html/aria。selector 可限定容器。

Inputs: mode, limit, tab_id, selector, +1 more.

google_revokeB

撤销 Google 授权并删除本地 token(需明确同意)。

Inputs: confirm (required).

google_screenshotC

截图并以图片返回(JPEG/PNG)。full_page=true 抓整页。

Inputs: format, tab_id, quality, save_as, +1 more.

google_scrollC

滚动页面(真实 mouseWheel),selector 可指定容器。

Inputs: tab_id, delta_x, delta_y, selector.

google_statusA

查看当前 Google 授权状态与服务器信息;不返回任何 token 明文。

Inputs: no named parameters.

google_storageC

读写页面 localStorage/sessionStorage/cookie(cookie 的 httpOnly 字段是关键证据)。

Inputs: op, key, url, area, +7 more.

google_tabsB

标签页:list(含 id/title/url)、open、switch、activate、close。tab_id 为 CDP targetId,其它 google_* 工具可用它精确定位。

Inputs: op, url, tab_id, tab_index.

google_typeC

向输入框输入文本(CDP insertText,支持中文)。clear=true 先清空,submit=true 回车。

Inputs: text (required), name, role, clear, +5 more.

google_waitB

等页面出现某段文字或某个元素(轮询 250ms),SPA 首屏渲染慢时用。

Inputs: text, tab_id, poll_ms, selector, +1 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 55 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, and the draft/commit pairs (gmail_send, calendar_insert/patch/delete) are explicitly labeled as two-step, which removes ambiguity. Minor overlaps exist between escape-hatch tools (google_eval vs google_cdp, google_read outline vs aria) and the two browser entry points (browser_pick vs google_browser), but descriptions explain the difference well enough.

    Naming Consistency3/5

    There is a good domain-prefix scheme (google_, gmail_, drive_, calendar_, github_) that makes grouping predictable, but within prefixes the convention is mixed: some tools are verb_noun (github_get_issue, gmail_search), others bare verbs (google_goto, google_click), and others bare nouns (google_tabs, google_console). browser_pick breaks the pattern entirely and the Google prefix covers both Workspace and browser tools.

    Tool Count2/5

    55 tools is far beyond the 25+ threshold and the server bundles four separate domains: browser automation (~20 tools), Gmail, Drive, Calendar, and a GitHub read-only bridge. Each area individually is reasonably scoped, but the combined surface is heavy and hard for an agent to navigate without misfires.

    Completeness3/5

    Browser automation and Calendar CRUD are thorough (with safe draft/commit confirmation), and the GitHub bridge is a complete read-only surface. However, Gmail lacks thread/label/modify/delete operations and Drive is read-only (no upload/create/write), leaving notable gaps in two of the four advertised domains.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Local MCP server providing Gmail tools (search, read, draft, send, trash) via Google's official API, integrated with GitHub Copilot CLI.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that enables AI assistants to interact with GitHub via a fine-grained personal access token — pushing commits, managing branches, opening and merging PRs, creating issues, and reading repositories. It runs locally with no telemetry and supports a read-only mode.
      15
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A read-only MCP server that lets AI assistants inspect local workspace files, search context, view git diffs, and fetch a fixed GitHub profile, all within a sandboxed stdio transport.
      5
      ISC