谷歌文档 MCP 服务器是一个基于 Google Docs API 的 Model Context Protocol (MCP) 服务器。它为语言模型提供了强大的功能,能够创建、搜索、追加内容到以及更新 Google 文档,极大地拓展了语言模型与 Google 文档的交互能力。
该服务器允许语言模型与 Google 文档进行交互。你可以按照以下步骤设置并运行服务器。
git clone
cd google-docs-mcp-server
npm install
credentials.json
在项目根目录node get-refresh-token.js
按照浏览器提示授权应用程序,这将创建一个 token.json
文件。npm run build
该服务器使用 Extism WebAssembly 插件与 Google Docs API 交互。要构建插件,可执行以下命令:
cd extism-plugin
npm install
npm run build
这将在 dist 目录下创建 plugin.wasm
文件。
启动 MCP 服务器:
npm start
或使用明确的 node 命令:
node build/index.js
你可以直接使用 Extism CLI 测试插件。
查看插件描述:
cd extism-plugin
extism call --wasi --allow-host www.googleapis.com --allow-host docs.googleapis.com --config GOOGLE_ACCESS_TOKEN= dist/plugin.wasm describe
搜索文档:
extism call --wasi --allow-host www.googleapis.com --allow-host docs.googleapis.com --config GOOGLE_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= dist/plugin.wasm call --input '{"toolId": "create_doc", "arguments": {"title": "My New Document", "content": "Initial content"}}'
本项目采用 MIT 许可证。