本 MCP 服务器与 Google Drive 集成,可实现文件的列出、读取与搜索功能,为您在 Google Drive 上的文件操作提供便利。
query(字符串),用于输入搜索查询内容。该服务器支持对 Google Drive 文件的访问:
gdrive:///)
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 替换为您实际的密钥文件路径:
docker run -i --rm --mount type=bind,source=/path/to/gcp-oauth.keys.json,target=/gcp-oauth.keys.json -v mcp-gdrive:/gdrive-server -e GDRIVE_OAUTH_PATH=/gcp-oauth.keys.json -e "GDRIVE_CREDENTIALS_PATH=/gdrive-server/credentials.json" -p 3000:3000 mcp/gdrive auth
该命令会输出一个 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 文件。