Documents and filesGoogle Drive

Google Drive in ChatGPT or Claude in the browser

Connect browser agents to Google Drive through an HTTPS tunnel, with an access-code login and profile permissions.

Ask ChatGPT, Codex web or Claude in the browser or on your phone about your Google Drive documents. The app searches and reads your documents through drive on your computer, and it can do only what your profile permits. You can stop it or take its access back at any time.

Such an app cannot start drive on your computer, so you give it an internet address instead. It connects over MCP (Model Context Protocol), the standard way an AI app calls outside tools. drive personal mcp serve --http is the MCP server; it listens on 127.0.0.1. An HTTPS tunnel, a program that gives a port on your computer a public HTTPS address, makes it reachable. This page uses Tailscale Funnel, which needs no domain of your own; Cloudflare Tunnel also works. You pass that public address, for example https://laptop.tail1234.ts.net, to drive as --public-url, and the app gets it with /mcp at the end. The app's login page asks for a one-time access code that drive prints in your terminal, so only a person who sees that terminal can connect an app. For apps on your own computer, see use a local MCP client.

On this page:

  1. Before you start
  2. Start the tunnel and server
  3. Connect the app
  4. Permissions for this server process
  5. Stop or revoke access
  6. If it does not work
ChatGPT / Claude ──internet──▶ Tailscale Funnel ──▶ drive personal mcp serve --http (login) ──▶ Google Drive

If your Tailscale connection already works, keep it; you do not need a second tunnel. The local stdin/stdout connection keeps working as before.

Before you start

  • Whoever logs in reads your documents. The login needs the access code from your terminal. Never put a tunnel in front of drive personal mcp serve without --http: that mode has no login at all.
  • Profile permissions decide what the app may change. deny and readonly block writes; ask and allow let an MCP write run without asking you. Only the app may still ask, and that depends on its own settings. Google sign-in and file roles stay independent: a write also needs the write grant: reconnect with --grant write (recipes, configuration, security).
  • The computer that runs drive must stay on. To use it from a phone, run all of this on a small server that is always on, and connect your Google account there.
  • Check that your app or workspace allows custom MCP connections. Availability and administrator controls depend on the app. Follow the current OpenAI connection guide or Claude connector guide.

Start the tunnel and server

Install drive and connect your Google account first (installation guide). Use the same operating system user and profile for setup and for the MCP server.

Install Tailscale, sign in, and enable Funnel: MagicDNS, HTTPS certificates and Funnel permission must be enabled in your tailnet (your Tailscale network). The first Funnel command can print an approval link.

Keep two terminal windows open. The first runs the tunnel. Copy the HTTPS origin it prints into the second window. The origin is the address without /mcp or any other path. Keep an explicit public port such as :8443 in it.

The server listens on 127.0.0.1:8765 (--port changes it) and prints a one-time access code. It never needs administrator rights; only the tunnel may need them.

On Linux, first window:

sudo tailscale funnel 8765

On macOS, when tailscale is not on PATH (Tailscale CLI guide):

TAILSCALE_BE_CLI=1 /Applications/Tailscale.app/Contents/MacOS/Tailscale funnel 8765

On Windows, in PowerShell run as Administrator:

& "$env:ProgramFiles\Tailscale\tailscale.exe" funnel 8765

Second window, as your normal user, without sudo (on Windows, drive.cmd):

drive personal mcp serve --http --port 8765 --public-url https://laptop.tail1234.ts.net

To run drive beside tg or max, give each server its own local port and public HTTPS port: for example, a second Funnel with --https=8443 8766 and drive personal mcp serve --http --port 8766 --public-url https://laptop.tail1234.ts.net:8443. Funnel supports public ports 443, 8443 and 10000 (Funnel command reference).

Alternative: Cloudflare Tunnel

A named Cloudflare tunnel with a public hostname such as mcp.example.com and local service http://127.0.0.1:8765 works the same way:

drive personal mcp serve --http --port 8765 --public-url https://mcp.example.com

A temporary Quick Tunnel (cloudflared tunnel --url …) does not work: Quick Tunnels do not support SSE, the way the HTTP MCP server streams answers.

To keep the server running after its window closes, start it in the background instead. It answers once it listens, with the connector address and the login code:

drive personal mcp server start --port 8765 --public-url https://laptop.tail1234.ts.net
drive personal mcp server status   # running, port, connector address, the current login code, apps logged in
drive personal mcp server stop     # stops only a server that `mcp server start` started

One server can serve several profiles: drive mcp serve --http --profiles work,personal, or --profiles all for every profile on this computer. Each tool call then names its profile. A list has its own login, apart from each profile's and from --profiles all; mcp server start|stop|status and mcp revoke take the same --profiles. With neither a profile nor --profiles, drive refuses and lists the profiles.

The code is kept beside the profile's token file (mcp-http.lock, mode 600) and renews every ten minutes; a server started this way does not write it to its log. WireCat Desktop shows the same status under Tools → Google Drive → MCP server.

Connect the app

The address for the app is your tunnel origin with /mcp at the end, for example https://laptop.tail1234.ts.net/mcp. Add it as a remote MCP connector:

  • ChatGPT or Codex web: open Plugins, choose + Add custom MCP server, and create a plugin with the /mcp address and OAuth, as the OpenAI connection guide describes. Choose dynamic client registration (DCR) when offered, then install the plugin before using it in a conversation.
  • Claude: add a custom connector with this address, as described in Claude custom connectors.

The app opens the drive login page. Check the line that says where the login goes: it must be the app you are connecting, such as chatgpt.com or claude.ai. Then type the access code from your terminal. The code expires after ten minutes; a new code is printed after each login. After five wrong codes the login page refuses every try for 30 seconds, then a new code is printed and the old one no longer works. The app stays logged in as long as it uses the connection at least once every 30 days.

The server offers the same three tools as over stdio: drive_tools_search, drive_read and drive_write. Retrieved document text is data, never instructions.

Permissions for this server process

The server cannot see whether the app asked you before a call. Repeat --permission key=level to tighten permissions only for this server process, for example --permission files=readonly or --permission sheets=deny. An override only tightens: one that would loosen the profile's level is refused. To allow more, change the profile's permissions (configuration guide). --read-only refuses every change for this run.

Stop or revoke access

Press Ctrl-C in both windows to stop the server and the tunnel. App logins survive a restart.

If you started Funnel with --bg, Ctrl-C does not stop that background route: check tailscale funnel status and turn off only its port, for example tailscale funnel --https=443 off.

To log out every app for a profile, or for the server of several profiles:

drive personal mcp revoke --json
drive mcp revoke --profiles all --json

Those apps must log in again with a new code. This does not sign drive out of Google.

If it does not work

  • The app says it cannot connect: open https://laptop.tail1234.ts.net/.well-known/oauth-protected-resource/mcp in a browser. It must show a short JSON. If it does not, Funnel is not running, is not enabled in your Tailscale network, or points at another port.
  • The login page says "Too many wrong codes": wait 30 seconds, then type the new code from the terminal or from drive personal mcp server status. If you did not type them, someone found your address: think about a new device name in Tailscale.
  • "port 8765 is in use": another server holds it; pass another --port and point the tunnel at it.
  • Reading works, writing fails: check the profile's permissions, any --permission overrides and the Google write grant. deny and readonly block writes whatever the app approves.