Skip to main content
Glama
technical-guide.mdβ€’3.44 kB
# πŸ”§ Technical Documentation *Advanced setup and development guide for developers and technical users.* ## πŸ—οΈ Architecture Overview ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Claude AI │◄──►│ MCP Server │◄──►│ Google Drive β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ API β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ β”‚ β”‚ β”‚ β”‚ WebSocket/ Node.js HTTPS/ stdio transport Express OAuth2 ``` ### Components - **MCP Server**: Node.js application implementing the Model Context Protocol - **Google Drive Client**: googleapis library for Drive API interactions - **Authentication Layer**: Supports both Service Account and OAuth 2.0 - **Transport**: stdio-based communication with Claude Desktop ## πŸ“ Project Structure ``` mcp-google-drive-server/ β”œβ”€β”€ server.js # Main MCP server implementation β”œβ”€β”€ auth.js # OAuth authentication helper β”œβ”€β”€ test.js # Basic functionality test β”œβ”€β”€ debug-test.js # Authentication debugging β”œβ”€β”€ package.json # Node.js dependencies β”œβ”€β”€ service-account.json # Service account credentials (not in repo) β”œβ”€β”€ credentials.json # OAuth credentials (not in repo) β”œβ”€β”€ token.json # OAuth tokens (not in repo) β”œβ”€β”€ docs/ # Documentation β”‚ β”œβ”€β”€ SETUP-GUIDE.md β”‚ β”œβ”€β”€ FAQ.md β”‚ └── TROUBLESHOOTING.md └── README.md # Main documentation ``` ## πŸ” Authentication Methods ### Service Account (Recommended for Production) **Pros:** - No user interaction required - Suitable for server environments - Consistent access without token expiration - Can be shared across team members **Cons:** - Requires explicit folder sharing - More complex initial setup - Requires Google Cloud project management **Implementation:** ```javascript const auth = new google.auth.GoogleAuth({ credentials: serviceAccount, scopes: [ 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/drive.readonly', 'https://www.googleapis.com/auth/drive.metadata.readonly' ] }); ``` ### OAuth 2.0 (For Development/Personal Use) **Pros:** - Access to user's entire Drive (with permission) - Easier for personal use - Standard Google OAuth flow **Cons:** - Requires periodic re-authentication - User interaction needed for initial setup - Tokens can expire **Implementation:** ```javascript const oAuth2Client = new google.auth.OAuth2( client_id, client_secret, redirect_uris[0] ); ``` ## πŸ› οΈ API Implementation ### Tool Definitions The server implements these MCP tools: | Tool | Description | Parameters | |------|-------------|------------| | `list_files` | List and search files | `query`, `maxResults`, `folderId`, `includeShared` | | `read_file` | Read file contents | `fileId` | | `create_file

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Raincode-Bahrain/mcp-drive'

If you have feedback or need assistance with the MCP directory API, please join our Discord server