google-mcp

google-mcp

Enables interaction with Google Docs, Sheets, and Drive through natural language, supporting file management, document editing, and spreadsheet operations via OAuth authentication.

Category
访问服务器

README

google-mcp — Google Docs, Sheets & Drive MCP Server

A production-ready MCP server for Google Docs, Google Sheets, and Google Drive with OAuth token authentication. Deploy to Railway or run locally with Claude Desktop.

Features

  • Google Drive: List, search, create, move, copy, delete files and folders; manage sharing permissions
  • Google Docs: Read, create, append, find-and-replace, and insert text into documents
  • Google Sheets: Create spreadsheets, read/write ranges, append rows, manage sheets
  • OAuth Authentication: Uses access tokens with automatic refresh on expiration
  • Dual Transport: HTTP/SSE for claude.ai and Claude Desktop via stdio

Setup

1. Create a Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project
  3. Enable these APIs:
    • Google Drive API
    • Google Docs API
    • Google Sheets API

2. Create OAuth 2.0 Credentials

  1. Go to Credentials in the Google Cloud Console
  2. Click Create Credentials → OAuth 2.0 Client ID
  3. Application type: Web application
  4. Authorized redirect URIs:
    • https://your-api.up.railway.app/api/oauth/google/callback (if using bridge-ai-ops for OAuth)
    • Or any OAuth callback URL you're using
  5. Copy the Client ID and Client Secret

3. Get Google Tokens

Use the bridge-ai-ops-api OAuth flow to get OAuth tokens:

  1. POST /api/oauth/start with appId for Google (set up in bridge-ai-ops app_catalog)
  2. Get redirected to Google login
  3. Authorize access to Docs, Sheets, Drive
  4. Tokens are stored and can be exported via the platform

Or manually exchange an auth code:

curl -X POST https://oauth2.googleapis.com/token \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "code=AUTH_CODE&client_id=CLIENT_ID&client_secret=CLIENT_SECRET&redirect_uri=REDIRECT_URI&grant_type=authorization_code"

Environment Variables

Variable Required Description
GOOGLE_CLIENT_ID Yes OAuth Client ID from Google Cloud Console
GOOGLE_CLIENT_SECRET Yes OAuth Client Secret from Google Cloud Console
GOOGLE_ACCESS_TOKEN Yes Short-lived OAuth access token
GOOGLE_REFRESH_TOKEN Yes Long-lived OAuth refresh token (for auto-refresh)
TRANSPORT No http (default) or stdio
PORT No Server port (default: 8080)

Tools

Google Drive (9 tools)

Tool Description
drive_list_files List files and folders (optionally filter by parent or query)
drive_search_files Full-text search across Drive
drive_get_file Get file metadata and details
drive_create_folder Create a new folder
drive_move_file Move file to a different folder
drive_copy_file Copy a file
drive_delete_file Move file to trash
drive_get_permissions Get sharing permissions for a file
drive_share_file Share a file with an email address (viewer/commenter/editor)

Google Docs (6 tools)

Tool Description
docs_get_document Get full document content (JSON format)
docs_get_text Extract plain text from a document
docs_create_document Create a new blank document
docs_append_text Append text to the end of a document
docs_replace_text Find and replace text in a document
docs_insert_text Insert text at a specific character position

Google Sheets (8 tools)

Tool Description
sheets_get_spreadsheet Get spreadsheet metadata and sheet names
sheets_read_range Read values from a cell range (e.g., Sheet1!A1:D10)
sheets_write_range Write values to a cell range
sheets_create_spreadsheet Create a new spreadsheet
sheets_append_rows Append rows of data to a sheet
sheets_clear_range Clear all values in a cell range
sheets_add_sheet Add a new sheet/tab
sheets_delete_sheet Delete a sheet/tab by name

Local Development

npm install
npm run build

# Test locally
GOOGLE_ACCESS_TOKEN="..." GOOGLE_REFRESH_TOKEN="..." GOOGLE_CLIENT_ID="..." GOOGLE_CLIENT_SECRET="..." npm start

Server will run on http://localhost:8080

  • Health check: curl http://localhost:8080/health
  • Claude Desktop connection: stdio with TRANSPORT=stdio

Claude Desktop Configuration

Remote (Railway HTTP)

{
  "mcpServers": {
    "google": {
      "url": "https://your-app.up.railway.app/sse"
    }
  }
}

Local (stdio)

{
  "mcpServers": {
    "google": {
      "command": "node",
      "args": ["/path/to/dist/index.js"],
      "env": {
        "TRANSPORT": "stdio",
        "GOOGLE_CLIENT_ID": "your_client_id",
        "GOOGLE_CLIENT_SECRET": "your_client_secret",
        "GOOGLE_ACCESS_TOKEN": "your_access_token",
        "GOOGLE_REFRESH_TOKEN": "your_refresh_token"
      }
    }
  }
}

Railway Deployment

  1. Create a GitHub repository and push this code
  2. In Railway, create a new service → Deploy from GitHub
  3. Select this repository
  4. Set environment variables in Railway dashboard:
    • GOOGLE_CLIENT_ID
    • GOOGLE_CLIENT_SECRET
    • GOOGLE_ACCESS_TOKEN
    • GOOGLE_REFRESH_TOKEN
  5. Generate a domain: Settings → Networking → Generate Domain
  6. Use https://your-domain.up.railway.app/mcp for claude.ai
  7. Use https://your-domain.up.railway.app/sse for Claude Desktop

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选