谷歌工作区mcp内部
日本语版: Read_ja.md
用于Google文档和Google表格的只读MCP服务器。
为AI代理提供11个工具,用于读取、列出和搜索谷歌文档和表格——没有写访问权限。
可用工具
谷歌文件
| 工具 |
说明 |
read_document |
以Markdown或纯文本形式获取文档正文 |
list_documents |
在您的驱动器中列出Google文档 |
search_documents |
按关键字搜索文档 |
get_document_info |
获取文档元数据(标题、所有者、时间戳) |
list_comments |
列出对文档的评论 |
get_comment |
获取特定评论及其回复线程 |
谷歌表格
| 工具 |
说明 |
read_spreadsheet |
以CSV或JSON格式获取工作表内容 |
get_spreadsheet_info |
获取电子表格元数据(标题、工作表、区域设置、时区) |
list_spreadsheets |
在您的驱动器中列出Google表格 |
search_spreadsheets |
按关键字搜索电子表格 |
get_sheet_range |
获取特定范围的单元格值(A1表示法) |
Tool parameters
read_document
| 参数 |
类型 |
必填 |
默认 |
说明 |
document_id |
string |
是 |
-- |
谷歌文档文档ID |
format |
string |
否 |
"markdown" |
输出格式: "markdown" 或 "text" |
list_documents
| 参数 |
类型 |
必填 |
默认 |
说明 |
folder_id |
string |
否 |
-- |
限制到特定文件夹 |
max_results |
编号 |
否 |
20 |
可退回的最大项目数(限制:100) |
order_by |
string |
否 |
"modifiedTime desc" |
排序顺序 |
search_documents
| 参数 |
类型 |
必填 |
默认 |
说明 |
query |
string |
是 |
-- |
搜索关键字 |
max_results |
编号 |
否 |
10 |
可退回的最大项目数(限制:50) |
get_document_info
| 参数 |
类型 |
必填 |
默认 |
说明 |
document_id |
string |
是 |
-- |
谷歌文档文档ID |
list_comments
| 参数 |
类型 |
必填 |
默认 |
说明 |
document_id |
string |
是 |
-- |
谷歌文档文档ID |
include_resolved |
boolean |
否 |
false |
是否包含已解决的评论 |
get_comment
| 参数 |
类型 |
必填 |
默认 |
说明 |
document_id |
string |
是 |
-- |
谷歌文档文档ID |
comment_id |
string |
是 |
-- |
注释ID |
read_spreadsheet
| 参数 |
类型 |
必填 |
默认 |
说明 |
spreadsheet_id |
string |
是 |
-- |
谷歌表格电子表格ID |
sheet_name |
string |
否 |
-- |
要读取的工作表名称(默认为第一张工作表) |
format |
string |
否 |
"csv" |
输出格式: "csv" 或 "json" |
get_spreadsheet_info
| 参数 |
类型 |
必填 |
默认 |
说明 |
spreadsheet_id |
string |
是 |
-- |
谷歌表格电子表格ID |
list_spreadsheets
| 参数 |
类型 |
必填 |
默认 |
说明 |
folder_id |
string |
否 |
-- |
限制到特定文件夹 |
max_results |
编号 |
否 |
20 |
可退回的最大项目数(限制:100) |
order_by |
string |
否 |
"modifiedTime desc" |
排序顺序 |
search_spreadsheets
| 参数 |
类型 |
必填 |
默认 |
说明 |
query |
string |
是 |
-- |
搜索关键字 |
max_results |
编号 |
否 |
10 |
可退回的最大项目数(限制:50) |
get_sheet_range
| 参数 |
类型 |
必填 |
默认 |
说明 |
spreadsheet_id |
string |
是 |
-- |
谷歌表格电子表格ID |
range |
string |
Yes |
-- |
A1表示法中的范围(例如。 Sheet1!A1:D10) |
安装
macOS/Linux
curl -fsSL https://raw.githubusercontent.com/flowernotfound/google-workspace-mcp-inhouse/master/install.sh | bash
二进制文件安装到 ~/bin/google-workspace-mcp-inhouse.
Windows(PowerShell)
irm https://raw.githubusercontent.com/flowernotfound/google-workspace-mcp-inhouse/master/install.ps1 | iex
二进制文件安装到 %LOCALAPPDATA%\Programs\google-workspace-mcp-inhouse\.
安装程序会自动将目录添加到您的用户 PATH.
设置
1.地点 credentials.json
获得 credentials.json 从GCP控制台将其放置在config目录中。
# macOS / Linux
mv ~/Downloads/credentials.json ~/.config/google-workspace-mcp-inhouse/credentials.json
# Windows (PowerShell)
Move-Item ~\Downloads\credentials.json ~\.config\google-workspace-mcp-inhouse\credentials.json
2.身份验证
# macOS / Linux
google-workspace-mcp-inhouse auth
# Windows
google-workspace-mcp-inhouse.exe auth
浏览器窗口打开。使用您的Google帐户登录以授予只读访问权限。
3.用克劳德代码注册
添加以下内容 .mcp.json:
{
"mcpServers": {
"google-workspace-mcp-inhouse": {
"type": "stdio",
"command": "${HOME}/bin/google-workspace-mcp-inhouse"
}
}
}
窗户: 替换 ${HOME}/bin/google-workspace-mcp-inhouse 使用完整路径,例如。
C:\Users\yourname\AppData\Local\Programs\google-workspace-mcp-inhouse\google-workspace-mcp-inhouse.exe
更新中
# macOS / Linux
google-workspace-mcp-inhouse update
# Windows — re-run the installer
irm https://raw.githubusercontent.com/flowernotfound/google-workspace-mcp-inhouse/master/install.ps1 | iex
先决条件(管理员设置)
在单个工程师安装此工具之前,管理员需要设置一次GCP项目。
看 README_ja.md—GCP初期设定 查看完整的设置指南。
发展
mise run build # build binary
mise run test # run tests
mise run lint # run linter
mise run fmt # format code
需要 布置 去1.23+。