本项目是一个基于 Model Context Protocol (MCP) 的服务器,可用于访问 Google Spreadsheet 数据,让大语言模型(LLM)能直接利用表格信息。
本项目旨在为大语言模型(LLM)提供直接访问 Google Spreadsheet 数据的能力,通过 MCP 协议实现数据交互,提升信息利用效率。
# 克隆仓库
git clone https://github.com/your-username/spreadsheet-mcp-server.git
cd spreadsheet-mcp-server
# 安装依赖项
npm install
# 复制示例环境文件
cp .env.example .env
# 编辑 .env 文件设置 GAS_WEB_APP_URL 和 GAS_API_KEY
# 构建项目
npm run build
服务器运行所需的环境变量如下:
| 属性 | 详情 |
|---|---|
GAS_WEB_APP_URL |
Google Apps Script Web App 的 URL 地址 |
GAS_API_KEY |
Google Apps Script Web App 的访问用 API 密钥 |
这些环境变量可在 .env 文件中设置:
GAS_WEB_APP_URL=https://script.google.com/macros/s/your-deployment-id/exec
GAS_API_KEY=your-api-key
⚠️ 重要提示
若未配置环境变量,服务器将以模拟模式运行,不会实际访问 Google 表格。
npm start
在 Desktop Claude 的配置文件 (claude_desktop_config.json) 中添加以下内容:
{
"mcpServers": {
"spreadsheet": {
"command": "node",
"args": ["/build/index.js" ]
}
}
}
若需设置环境变量,可添加 env 字段如下:
{
"mcpServers": {
"spreadsheet": {
"command": "node",
"args": ["/build/index.js" ],
"env": {
"GAS_WEB_APP_URL": "https://script.google.com/macros/s/your-deployment-id/exec",
"GAS_API_KEY": "your-api-key"
}
}
}
}
配置文件路径如下:
~/Library/Application Support/Claude/claude_desktop_config.json%AppData%\\Claude\\claude_desktop_config.jsonnpm test
本项目采用 MIT 许可证。