
Google Docs MCP Server

Overview
基本能力
产品定位
Google Docs MCP Server 是一个用于与 Google Docs API 交互的 MCP 服务,主要用于文档的创建、搜索、更新和管理。
核心功能
- 搜索文档:使用自定义查询在 Google Drive 中搜索 Google Docs。
- 创建文档:创建新的 Google Docs,并可选择添加初始内容。
- 追加内容:在现有 Google Doc 的末尾追加内容。
- 更新文档:用新内容替换现有 Google Doc 中的内容。
适用场景
- 自动化文档管理
- 批量文档处理
- 文档内容生成和更新
工具列表
- Extism 插件:用于与 Google Docs API 交互的 WebAssembly 插件。
常见问题解答
无
使用教程
使用依赖
- Node.js (v14 或更高版本)
- npm
- Google Cloud Platform 账户,并启用 Google Drive 和 Google Docs API
安装教程
-
克隆仓库:
git clone <repository-url> cd google-docs-mcp-server
-
安装依赖:
npm install
-
设置 Google API 凭证:
- 访问 Google Cloud Console
- 创建新项目或选择现有项目
- 启用 Google Drive API 和 Google Docs API
- 创建 OAuth 2.0 凭证(桌面应用)
-
下载凭证 JSON 文件并保存为
credentials.json
到项目根目录 -
获取认证令牌:
node get-refresh-token.js
按照浏览器提示授权应用,这将创建token.json
文件。 -
构建服务器:
npm run build
构建 Extism 插件
cd extism-plugin
npm install
npm run build
调试方式
-
启动 MCP 服务器:
npm start
或node build/index.js
-
直接测试插件:
cd extism-plugin extism call --wasi --allow-host www.googleapis.com --allow-host docs.googleapis.com --config GOOGLE_ACCESS_TOKEN=<your-access-token> dist/plugin.wasm describe
搜索文档:
extism call --wasi --allow-host www.googleapis.com --allow-host docs.googleapis.com --config GOOGLE_ACCESS_TOKEN=<your-access-token> dist/plugin.wasm call --input '{"toolId": "search_docs", "arguments": {"query": "name contains \"report\""}}'
创建新文档:
extism call --wasi --allow-host www.googleapis.com --allow-host docs.googleapis.com --config GOOGLE_ACCESS_TOKEN=<your-access-token> dist/plugin.wasm call --input '{"toolId": "create_doc", "arguments": {"title": "My New Document", "content": "Initial content"}}'