此 MCP 服务器与 Google Drive 集成,可实现文件的列出、读取和搜索功能,为用户提供便捷的文件管理体验。
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"]
}
}
}
要使用 npm 运行服务器:
npm start
可以直接运行 JavaScript 文件:
node dist/index.js
query(字符串):搜索查询服务器提供对 Google Drive 文件的访问:
gdrive:///)
请参阅项目的许可文件以获取详细信息。
如有任何问题,请通过以下方式联系: