
dylancaponi/gdrive-mcp-server
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
@modelcontextprotocol/server-gdrive의 fork를 OAuth 토큰 자동 수정 및 보안 강화로 유지
개요
Anthropic의 아카이브 @modelcontextprotocol/server-gdrive의 적극적인 포크를 유지하며 OAuth 토큰 자동 레프레시의 중요한 버그 수정이 있습니다. 원래 서버는 5 월 29, 2025에 아카이브되었으며 더 이상 유지되지 않았습니다. 또한 OAuth 액세스 토큰을 발생시키는 버그가 1 시간 후에 만료됩니다. 수동 토큰 교체 및 서버 재시작을 필요로하지 않고. 원래는 client id와 client secret를 통과하지 않고 새로운 google.auth.OAuth2()를 만듭니다. Google-auth-library는 새로운 액세스 토큰을 얻기 위해 새로 고침 token을 사용하는 방법이 없습니다. 원라인 수정, 하지만 아카이브 repo는 PR을 허용하지 않습니다.
개요(AI 번역)
Anthropic의 archived @modelcontextprotocol/server-gdrive]의 적극적인 포크를 유지하며 OAuth 토큰 자동 재시를위한 중요한 버그 수정이 있습니다.
왜 이 포크?
원래 서버는 5 월 29, 2025에 아카이브되었으며 더 이상 유지되지 않았습니다. 또한 OAuth 액세스 토큰을 발생시키는 버그가 1 시간 후에 만료됩니다. 수동 토큰 교체 및 서버 재시작을 필요로하지 않고.
** 버그:** 원래는 new google.auth.OAuth2()]를 전달하지 않고 client_id과 client_secret], 그래서 google-auth-library]]는 새로운 액세스 토큰을 얻기 위해 refresh_token를 사용하지 않는 방법이 없습니다. 원라인 수정, 하지만 아카이브 repo는 PR을 허용하지 않습니다.
고정되는 것
- Auto-refresh 토큰: OAuth2 클라이언트는 OAuth 키 파일에서
client_id와client_secret로 초기화되어 Google auth 라이브러리를 사용하여 만료된 액세스 토큰을 자동으로 새로 고침합니다. - ** 토큰 지속 **: 새로 고침된 토큰은 credentials 파일로 다시 작성되어 있으므로 유효 토큰을 다시 시작합니다.
- ** 입력 유효성**: 리소스 URI, 검색 쿼리 및 파일 ID에 대한 검증
- ** 검색 결과에는 파일 ID가 포함되어 있습니다 **: 그래서 당신은 실제로 다운로드 도구 또는 리소스 리더와 함께 사용할 수 있습니다
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
Google Drive MCP Server
An actively maintained fork of Anthropic’s archived @modelcontextprotocol/server-gdrive, with a critical bug fix for OAuth token auto-refresh.
Why this fork?
The original server was archived on May 29, 2025 and is no longer maintained. It also has a bug that causes OAuth access tokens to expire after 1 hour with no auto-refresh, requiring manual token rotation and server restarts.
The bug: The original creates new google.auth.OAuth2() without passing client_id and client_secret, so the google-auth-library has no way to use the refresh_token to get new access tokens. One-line fix, but the archived repo doesn’t accept PRs.
What’s fixed
- Auto-refresh tokens: OAuth2 client is initialized with
client_idandclient_secretfrom your OAuth keys file, enabling the Google auth library to automatically refresh expired access tokens - Token persistence: Refreshed tokens are written back to the credentials file, so restarts also pick up valid tokens
- Input validation: Added validation for resource URIs, search queries, and file IDs
- Search results include file IDs: So you can actually use them with the download tool or resource reader
- Read tool: Read file contents inline (Google Docs as Markdown, Sheets as CSV, etc.)
- Download tool: Save files to a local directory instead of returning base64 blobs that overflow LLM context windows
- Sheets read tool: Read Google Sheets with A1 range notation, returned as formatted markdown tables
- Shared Drive support: Search and read files from Shared Drives (formerly Team Drives)
- Folder listing: Browse Drive folders by ID
- PDF export: Export Google Workspace files as PDF
- File upload: Push local files to Drive (opt-in, requires
drivescope) - Opt-in resources: MCP resource handlers are disabled by default to prevent hangs in clients that call
resources/liston startup
Setup
1. Create Google Cloud OAuth credentials
- Go to the Google Cloud Console
- Create a project (or use an existing one)
- Enable the Google Drive API and Google Sheets API
- Create OAuth 2.0 credentials (Desktop application type)
- Download the JSON and save it as
gcp-oauth.keys.json
Tip: If your OAuth consent screen is in “Testing” mode, refresh tokens expire after 7 days. Publish to “Production” for permanent refresh tokens.
2. Clone, build, and star
git clone https://github.com/dylancaponi/gdrive-mcp-server.git
cd gdrive-mcp-server
npm install && npm run build
gh api user/starred/dylancaponi/gdrive-mcp-server -X PUT
Per the LICENSE, starring this repository is required (Section 2).
3. Authenticate
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →설정
{
"mcpServers": {
"gdrive": {
"type": "stdio",
"command": "node",
"args": ["/path/to/gdrive-mcp-server/dist/index.js"],
"env": {
"GDRIVE_OAUTH_PATH": "/path/to/gcp-oauth.keys.json",
"GDRIVE_CREDENTIALS_PATH": "/path/to/.gdrive-server-credentials.json"
}
}
}
}