此MCP服务器与Google Drive集成,允许列出、读取和搜索文件。
query (字符串):搜索查询该服务器提供对Google Drive文件的访问:
gdrive:///<file_id>)
https://www.googleapis.com/auth/drive.readonlygcp-oauth.keys.json并放置在仓库根目录下(例如:servers/gcp-oauth.keys.json)确保使用npm run build或npm run watch构建服务器。
要进行认证并保存凭据:
auth参数运行服务器:node ./dist authservers/.gdrive-server-credentials.json)要将此服务器与桌面应用集成,请在应用的服务器配置中添加以下内容:
认证:
假设您已经在Google Cloud上完成了OAuth应用的设置,现在可以使用以下命令对服务器进行认证,将/path/to/gcp-oauth.keys.json替换为您OAuth密钥文件的路径:
docker run -i --rm --mount type=bind,source=/path/to/gcp-oath.keys.json,target=/gcp-oath.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oath.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth
该命令将打印出需要在浏览器中打开的URL。在浏览器中打开此URL并完成身份验证过程。凭据将保存在mcp-gdrive卷中。
一旦认证成功,您可以在应用的服务器配置中使用该服务器:
{
"mcpServers": {
"gdrive": {
"command": "docker",
"args": ["run", "-i", "--rm", "-v", "mcp-gdrive:/gdrive-server", "-e", "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json", "mcp/gdrive"]
}
}
}
{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gdrive"
]
}
}
}
此MCP服务器采用MIT许可证。这意味着您可以自由地使用、修改和分发该软件,但需遵守MIT许可证中的条款和条件。更多详情,请参阅项目存储库中的LICENSE文件。 </中文翻译>