这是一个使用 GRID API 的 Model Context Protocol 服务器,可以直接从 Claude for Desktop 使用。
[!重要] 要运行此服务器,需要满足一些前提条件:
- 安装 Claude for Desktop,Node.js 和 Git
- 注册 GRID,上传一个电子表格,并保存一份 您的 API 密钥
克隆这个仓库:
git clone https://github.com/GRID-is/claude-mcp.git
完成后,进入新的目录:
cd claude-mcp
接下来,使用 npm 设置项目:
npm install
现在我们需要配置 Claude for Desktop 使用这个 MCP 服务器。
为此,请打开 Claude 的应用配置文件(如果不存在则创建)。
在 MacOS 上:
~/Library/Application\ Support/Claude/claude_desktop_config.json
在 Windows 上:
%APPDATA%\Claude\claude_desktop_config.json
在 mcpServers 键中添加您的服务器:
{
"mcpServers": {
"grid": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/claude-mcp/dist/index.js"],
"env": {
"GRID_API_TOKEN": "YOUR_API_KEY"
}
}
}
}
确保将 /ABSOLUTE/PATH/TO/claude-mcp 更改为实际的仓库目录位置,并将 YOUR_API_KEY 更改为您的 GRID API 密钥。
关闭 Claude for Desktop 并重新打开它。现在您可以向 Claude 提问关于您的电子表格的问题:
使用 ID 为 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 的工作簿,给我 A1:C10 单元格的总和
如果您想本地修改服务器代码:
安装依赖项:
npm install
构建服务器:
npm run build
为了开发时自动重建:
npm run watch
由于 MCP 服务器通过 stdio 进行通信,调试可能会有挑战。建议使用 MCP Inspector,作为包脚本可用:
npm run inspector
MCP Inspector 将提供一个 URL,以便您可以在浏览器中访问调试工具。