# Google Drive MCP Server > **Google Drive MCP Server** is a hosted, multitenant Model Context Protocol (MCP) server run by **MewCP** (https://mewcp.com), giving AI agents managed access to Google Drive. > > MewCP takes care of all MCP infrastructure for you — credential storage, OAuth flows, > token refresh, and production-grade auto-scaling — so your AI agents can connect to > third-party services and run freely without you managing any MCP server yourself. > > To connect your agent to this server you need a MewCP account and two values: > - MEWCP_KEY — your personal API key (dashboard → Developer) > - CREDENTIAL_ID — the stored credential MewCP securely injects per request > > Server page: https://mewcp.com/mcp/google-drive > MewCP docs: https://docs.mewcp.com > Full catalog: https://mewcp.com/llms.txt ## About Access and manage files, folders and shared content stored in Google Drive. Upload, download, organize and search documents while working with permissions and collaborative file storage. ## How to connect Server Page URL: https://mewcp.com/mcp/google-drive Gateway URL: https://gateway.mewcp.com/google-drive/mcp Every request to this server requires two headers: Authorization: Bearer — your MewCP API key (dashboard → Developer) x-mewcp-credential-id: — the stored credential ID for this service All connection snippets and ready-to-use code examples are available on the server page and in this document below. --- ## Server documentation **Upload, search, and manage Google Drive files — directly from your AI workflows.** A Model Context Protocol (MCP) server that exposes Google Drive's API for listing, searching, uploading, downloading, sharing, and organizing files and folders. ## Overview The Google Drive MCP Server provides full programmatic access to Google Drive through a stateless, multi-tenant interface: - List, search, upload, and download files using Drive's native query syntax - Create and organize folders, manage file permissions and sharing - Read text file content directly without downloading to disk Perfect for: - Automating file management and document workflows from AI agents - Building assistants that can read, organize, and share Drive files - Integrating Google Drive actions into LLM-powered pipelines ## Tools
list_files — List files in Google Drive Lists files in Google Drive with optional filtering by parent folder, name, or type. **Inputs:** ``` - `folder_id` (string, optional) — Parent folder ID to filter results by - `query` (string, optional) — Additional Drive query fragment e.g. `name contains 'report'` - `page_size` (integer, optional) — Maximum number of results to return, capped at 1000. Default: `10` ``` **Output:** ```json { "count": 3, "files": [ { "id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs", "name": "report.pdf", "mimeType": "application/pdf", "size": "204800", "createdTime": "2024-01-15T10:00:00.000Z", "modifiedTime": "2024-03-20T14:30:00.000Z", "webViewLink": "https://drive.google.com/file/d/..." } ] } ```
get_file_metadata — Get metadata for a specific file by ID Returns the full metadata object for a single file or folder. **Inputs:** ``` - `file_id` (string, required) — Google Drive file ID ``` **Output:** ```json { "id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs", "name": "report.pdf", "mimeType": "application/pdf", "size": "204800", "createdTime": "2024-01-15T10:00:00.000Z", "modifiedTime": "2024-03-20T14:30:00.000Z", "owners": [{ "displayName": "John Doe", "emailAddress": "john@example.com" }], "webViewLink": "https://drive.google.com/file/d/..." } ```
download_file — Download a file from Google Drive to local disk Downloads a file from Drive and writes it to a specified local path. **Inputs:** ``` - `file_id` (string, required) — Google Drive file ID - `destination_path` (string, required) — Local filesystem path to save the file to ``` **Output:** ```json { "message": "File downloaded successfully to: /path/to/file.pdf" } ```
upload_file — Upload a file to Google Drive Uploads a local file to Google Drive with an optional destination name, folder, and MIME type. **Inputs:** ``` - `file_path` (string, required) — Local filesystem path of the file to upload - `name` (string, optional) — Destination filename in Drive. Defaults to the local filename - `folder_id` (string, optional) — Parent folder ID in Drive to upload into - `mime_type` (string, optional) — MIME type of the file e.g. `text/plain`, `application/pdf` ``` **Output:** ```json { "message": "File uploaded successfully", "file": { "id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs", "name": "report.pdf", "webViewLink": "https://drive.google.com/file/d/..." } } ```
create_folder — Create a new folder in Google Drive Creates a new folder, optionally nested inside a parent folder. **Inputs:** ``` - `name` (string, required) — Folder name - `parent_folder_id` (string, optional) — Parent folder ID to create the folder inside ``` **Output:** ```json { "message": "Folder created successfully", "folder": { "id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs", "name": "Projects", "webViewLink": "https://drive.google.com/drive/folders/..." } } ```
delete_file — Delete a file or folder from Google Drive Permanently deletes a file or folder. This action cannot be undone. **Inputs:** ``` - `file_id` (string, required) — Google Drive file or folder ID to delete ``` **Output:** ```json { "message": "File/folder with ID 1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs deleted successfully" } ```
search_files — Search for files in Google Drive using advanced queries Searches Drive using the full Drive query expression language and returns matching file metadata. **Inputs:** ``` - `query` (string, required) — Drive query expression e.g. `name contains 'report'`, `mimeType='application/pdf'` - `page_size` (integer, optional) — Maximum number of results to return, capped at 1000. Default: `10` ``` **Output:** ```json { "count": 2, "files": [ { "id": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs", "name": "Q1 Report.pdf", "mimeType": "application/pdf", "webViewLink": "https://drive.google.com/file/d/..." } ] } ```
share_file — Share a file with a user or make it publicly accessible Grants a permission on a file, either to a specific user or to anyone with the link. **Inputs:** ``` - `file_id` (string, required) — Google Drive file ID - `email` (string, optional) — Recipient email address when sharing with a specific user - `role` (string, optional) — Permission role. Values: `reader`, `commenter`, `writer`. Default: `reader` - `share_type` (string, optional) — Permission type. Values: `user`, `group`, `domain`, `anyone`. Defaults to `user` if email is provided, otherwise `anyone` ``` **Output:** ```json { "message": "File shared successfully", "permission_id": "anyoneWithLink", "webViewLink": "https://drive.google.com/file/d/.../view", "webContentLink": "https://drive.google.com/uc?id=..." } ```
get_file_content — Get the content of a text file from Google Drive Reads and returns the decoded text content of a file directly, without saving to disk. **Inputs:** ``` - `file_id` (string, required) — Google Drive file ID ``` **Output:** ```json "The full decoded text content of the file as a string." ```
## API Parameters Reference
Common Parameters - `file_id` — Unique Google Drive file or folder identifier. Obtain from `list_files`, `search_files`, or any file response. - `folder_id` — ID of a Drive folder. Use `list_files` or `search_files` with `mimeType='application/vnd.google-apps.folder'` to find folder IDs. - `page_size` — Limits the number of items returned. Always capped at 1000.
Resource Formats **Drive Query Syntax (`query` parameter):** ``` name contains 'report' — Files with "report" in name name = 'budget.xlsx' — Exact filename match mimeType = 'application/pdf' — Files of a specific MIME type mimeType = 'application/vnd.google-apps.folder' — Folders only 'folder_id' in parents — Files inside a specific folder modifiedTime > '2024-01-01T00:00:00' — Files modified after a date fullText contains 'quarterly' — Files containing text (Docs/Sheets only) ``` **Permission Roles:** ``` reader — View only commenter — View and comment writer — View, comment, and edit ```
## Troubleshooting
Missing or Invalid Headers - **Cause:** API key not provided in request headers or incorrect format - **Solution:** 1. Verify `Authorization: Bearer YOUR_API_KEY` and `X-Mewcp-Credential-Id: CREDENTIAL-ID` headers are present 2. Check API key is active in your MewCP account
Insufficient Credits - **Cause:** API calls have exceeded your request limits - **Solution:** 1. Check credit usage in your Curious Layer dashboard 2. Upgrade to a paid plan or add credits for higher limits 3. Contact support for credit adjustments
Credential Not Connected - **Cause:** No Google Drive credential linked to your account - **Solution:** 1. Go to **Credentials** in your MewCP dashboard 2. Connect your Google account via OAuth 3. Retry the request with the correct `X-Mewcp-Credential-Id` header
Malformed Request Payload - **Cause:** JSON payload is invalid or missing required fields - **Solution:** 1. Validate JSON syntax before sending 2. Ensure all required tool parameters are included 3. Check parameter types match expected values
Server Not Found - **Cause:** Incorrect server name in the API endpoint - **Solution:** 1. Verify endpoint format: `{server-name}/mcp/{tool-name}` 2. Use correct server name from documentation 3. Check available servers in your Curious Layer account
Google Drive API Error - **Cause:** Upstream Google Drive API returned an error - **Solution:** 1. Check Google service status at [Google Workspace Status Page](https://www.google.com/appsstatus) 2. Verify your credential has the required Drive permissions 3. Review the error message for specific details
--- ### Resources - **[Google Drive API Documentation](https://developers.google.com/drive/api/guides/about-sdk)** — Official API reference - **[Google Drive API Reference](https://developers.google.com/drive/api/reference/rest/v3)** — Complete endpoint reference - **[FastMCP Docs](https://gofastmcp.com/v2/getting-started/welcome)** — FastMCP specification - **[FastMCP Credentials](https://pypi.org/project/fastmcp-credentials/)** — FastMCP Credentials package for credential handling --- ## Connection snippets ### Python (fastmcp) ```python import asyncio from fastmcp import Client from fastmcp.client.transports import StreamableHttpTransport SERVER_URL = "https://gateway.mewcp.com/google-drive/mcp" MEWCP_KEY = "YOUR_MEWCP_KEY" CREDENTIAL_ID = "YOUR_CREDENTIAL_ID" transport = StreamableHttpTransport( url=SERVER_URL, headers={ "Authorization": f"Bearer {MEWCP_KEY}", "x-mewcp-credential-id": CREDENTIAL_ID, } ) async def main(): client = Client(transport) async with client: await client.ping() tools = await client.list_tools() resources = await client.list_resources() prompts = await client.list_prompts() # Change the tool name and arguments with actual tool and arguments available in server result = await client.call_tool("example_tool", {"param": "value"}) print(result) asyncio.run(main()) ``` ### TypeScript (MCP SDK) ```typescript import { Client } from "@modelcontextprotocol/sdk/client/index.js"; import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"; const SERVER_URL = "https://gateway.mewcp.com/google-drive/mcp"; const MEWCP_KEY = "YOUR_MEWCP_KEY"; const CREDENTIAL_ID = "YOUR_CREDENTIAL_ID"; const transport = new StreamableHTTPClientTransport(new URL(SERVER_URL), { requestInit: { headers: { Authorization: `Bearer ${MEWCP_KEY}`, "x-mewcp-credential-id": CREDENTIAL_ID, }, }, }); const client = new Client({ name: "mewcp-client", version: "1.0.0", }); await client.connect(transport); const tools = await client.listTools(); console.log("Available tools:", tools.tools.map(t => t.name)); // Change the tool name and arguments to a tool available on your server const result = await client.callTool({ name: "example_tool", arguments: { param: "value" }, }); console.log("Tool result:", result); ``` ### VS Code (settings.json) ```json { "servers": { "mewcp-google-drive": { "type": "http", "url": "https://gateway.mewcp.com/google-drive/mcp", "headers": { "Authorization": "Bearer YOUR_MEWCP_KEY", "x-mewcp-credential-id": "YOUR_CREDENTIAL_ID" } } } } ``` ### Cursor (mcp.json) ```json { "mcpServers": { "google-drive": { "url": "https://gateway.mewcp.com/google-drive/mcp", "headers": { "Authorization": "Bearer YOUR_MEWCP_KEY", "x-mewcp-credential-id": "YOUR_CREDENTIAL_ID" } } } } ``` ### Claude Desktop (claude_desktop_config.json) ```json "mcpServers": { "google-drive": { "command": "npx", "args": [ "-y", "mcp-remote@latest", "https://gateway.mewcp.com/google-drive/mcp", "--transport", "http-only", "--header", "Authorization: Bearer YOUR_MEWCP_KEY", "--header", "x-mewcp-credential-id: YOUR_CREDENTIAL_ID" ] } } ```