google-mcp

google-mcp

Enables interaction with Google Chat through MCP, allowing listing spaces and messages, searching messages, and sending messages. Supports local and remote transports.

Category
访问服务器

README

google-mcp

A Model Context Protocol server for Google Workspace with pluggable transports — run it locally over stdio or remotely over HTTP (so you can reach it from a phone). It ships with Google Chat today and is structured so Gmail, Drive, and Calendar can be added as additional modules.

You bring your own Google Cloud OAuth client and authorize once. The server then exposes Chat tools to any MCP client (Claude, Claude Code, etc.).

Transports

The server selects a transport at startup — by CLI arg or the GOOGLE_MCP_TRANSPORT env var. Adding a transport means implementing one TransportRunner and registering it; nothing else changes (Open/Closed).

Transport Command Use
stdio google-mcp serve stdio (default) Local MCP client on the same machine
http google-mcp serve http Remote / phone access over HTTP

The HTTP transport listens on PORT (default 8080) at GOOGLE_MCP_HTTP_PATH (default /mcp). Set GOOGLE_MCP_BEARER_TOKEN to require an Authorization: Bearer <token> header.

Tools

Tool Description
chat_list_spaces List spaces and direct messages the user belongs to.
chat_list_messages List messages in a space.
chat_find_messages Find messages in a space by case-insensitive text match.
chat_send_message Post a text message to a space.

Why not the official Google Chat MCP server?

Google offers a hosted Chat MCP server at chatmcp.googleapis.com, but it is in Developer Preview and gated behind program enrollment. google-mcp runs locally, uses scopes you control, and is easy to extend to other Workspace APIs.

Prerequisites

  • Node.js >= 20
  • A Google Cloud project with the Google Chat API enabled
  • An OAuth client (type: Desktop app) for the loopback authorization flow

Setup

1. Create an OAuth client

  1. In Google Cloud Console, enable the Google Chat API.
  2. Configure the OAuth consent screen (External or Internal).
  3. Create credentials → OAuth client ID → Desktop app.
  4. Note the client ID and client secret.

2. Install and build

git clone https://github.com/thehellmaker/google-mcp.git
cd google-mcp
npm install
npm run build

3. Provide credentials

Copy .env.example to .env (or export the variables in your shell):

export GOOGLE_OAUTH_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GOOGLE_OAUTH_CLIENT_SECRET="your-client-secret"

4. Authorize once

npm run auth

This opens a loopback authorization flow. Approve access in your browser. A refresh token is stored at ~/.config/google-mcp/token.json (mode 0600).

Use with Claude / Claude Code

Add to your MCP client config (paths and env are illustrative):

{
  "mcpServers": {
    "google": {
      "command": "node",
      "args": ["/absolute/path/to/google-mcp/dist/index.js"],
      "env": {
        "GOOGLE_OAUTH_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
        "GOOGLE_OAUTH_CLIENT_SECRET": "your-client-secret"
      }
    }
  }
}

Remote access (phone)

A local stdio server can only be reached from the same machine. To trigger tools from a phone, run the HTTP transport on a host the Claude app can reach over HTTPS, and add it as a custom connector.

GOOGLE_MCP_TRANSPORT=http PORT=8080 GOOGLE_MCP_BEARER_TOKEN="$(openssl rand -hex 32)" npm run start:http

Then put it behind HTTPS. Options, simplest first:

  • Tunnel (quick test): cloudflared tunnel --url http://localhost:8080 or ngrok http 8080 gives a public HTTPS URL.
  • Single small host: Fly.io, Railway, Render, or a cheap VPS running the container/process behind a TLS reverse proxy (Caddy/Traefik).
  • Behind an MCP gateway: put it behind an existing open-source MCP gateway (Pomerium, Obot, Microsoft mcp-gateway, Docker MCP Gateway) when you want OAuth, per-tool policy, and audit logging without writing them yourself.

Note on auth: the built-in bearer token is the minimal guard. Claude's custom-connector UI expects either an open server or full OAuth — a fronting gateway is the clean way to add OAuth to a remote deployment.

OAuth scopes

https://www.googleapis.com/auth/chat.spaces.readonly
https://www.googleapis.com/auth/chat.messages.readonly
https://www.googleapis.com/auth/chat.messages.create
https://www.googleapis.com/auth/chat.memberships.readonly

Security

  • No credentials are committed. .env, token.json, and credentials.json are gitignored.
  • The refresh token lives only on your machine under ~/.config/google-mcp/.
  • The server inherits exactly the permissions your OAuth consent grants — nothing more.

Adding a new Workspace module

  1. Create src/modules/<name>/index.ts exporting a ToolModule (name, scopes, register).
  2. Add it to the array in src/modules/registry.ts.

Scopes are aggregated automatically for the auth flow.

License

Apache License 2.0. See LICENSE and NOTICE.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选