local-only server
The server can only run on the client’s local machine because it depends on local resources.
Integrations
Allows execution of custom Google Apps Script code through a bridge that forwards scripts from an MCP client to a GAS Interpreter endpoint, enabling AI agents to run custom scripts in the Google Apps Script environment.
克劳德-加斯-布里奇
这是一个使用 Node.js 连接MCP(模型上下文协议)客户端(例如 Claude Desktop)和 GAS 解释器(Google Apps Script 端)的桥接服务器。
在bridge.mjs
中,启动@modelcontextprotocol/sdk的 MCP 服务器,并提供向 GAS Web 端点进行 HTTP POST 的功能。
配置概述
Copy
bridge.mjs
MCP 服务器本身。定义一个名为execute-gas
的工具,将从客户端收到的GAS脚本传输到指定的WebApp(Apps Script)端点。
调用该工具时,标题、脚本文本和 API 密钥以 JSON 格式发送。
要求
- Node.js 18 及以上版本
@modelcontextprotocol/sdk
建议使用 Node 18 及以上版本 - GAS 解释器已部署
在 Google Apps Script 中正确部署 GAS 解释器并获取 Web 应用的 URL。 - (可选)MCP 客户端,例如 Claude Desktop
设置
- 获取源代码Copy
- 安装依赖包* 纱线也可以接受Copy
- 设置 GAS 部署 URL
将bridge.mjs
中的GAS_ENDPOINT
替换为实际的 Apps Script URL。
例子:Copy - 使用 Node.js 启动服务器当控制台显示Copy
"Bridge server started (Stdio). Waiting for requests..."
服务器处于待机模式,将接受来自 MCP 客户端的调用。
与 Claude Desktop 集成(示例)
如果您使用的是 Claude Desktop,请将以下内容添加到claude_desktop_config.json
:
Copy
- 重启Claude桌面
- 您应该在聊天屏幕底部的工具列表(锤子图标)中看到
execute-gas
。 - 当你发出诸如“我想通过 ChatGPT 运行 GAS 脚本”之类的指令时,
bridge.mjs
会接收请求并将其转发给 GAS 解释器。
管理 API 密钥
- 如果 GAS 解释器需要 API 密钥,请在调用该工具时指定
"apiKey": "..."
,或者引用bridge.mjs
中的环境变量并根据需要嵌入。
You must be authenticated.
Tools
将 MCP 客户端(如 Claude Desktop)连接到 Google Apps Script 的桥接服务器,允许通过自然语言界面执行 GAS 脚本。