Alter Google Drive MCP Server

v0.1.0
io.github.AlterAIDev/google-drive-mcp Checked 1 day ago Published 1 day ago

Multi-user Google Drive MCP server with zero tokens on server, share approvals, and audit.

A multi-user Google Drive MCP server for AI agents that searches files, reads Google Docs/Sheets/Slides and text files, inspects sharing permissions, creates Docs/folders, and shares files — where the server never holds a Google token and every permission change waits for a person's approval. It is backed by Alter: Alter stores each user's Google credential, enforces policies, holds sharing requests for approval, and records every call as that person. Deleting files and emptying trash are not tools, and the recommended policy blocks all Google Drive delete operations.

Summary extracted from the README.

Google Drive MCP server with approvals (@alter-ai/google-drive-mcp)

Built with Alter

A multi-user Google Drive MCP server for AI agents that searches files, reads Google Docs/Sheets/Slides and text files, inspects sharing permissions, creates Docs/folders, and shares files — where the server never holds a Google token and every permission change waits for a person's approval. It is backed by Alter: Alter stores each user's Google credential, enforces policies, holds sharing requests for approval, and records every call as that person.

What the server holds vs. never holds

  • Holds: Only an Alter agent key (ALTER_AGENT_API_KEY) — plus ALTER_SIGNIN_KEY when hosted on Cloudflare.
  • Never holds: Google OAuth tokens, user passwords, or your IdP client secret.

Tools

Tool What it does With the recommended policy
search_files Searches non-trashed files visible to the signed-in user by name or content Allowed
get_file Reads file metadata (name, MIME type, owners, modified time, size, link) Allowed
read_file Exports Google Docs/Sheets/Slides or reads plain-text/Markdown/JSON files Allowed
list_permissions Lists who a file or folder is shared with and their access roles Allowed
create_file Creates a Google Doc, plain-text file, or folder Allowed (or hold write)
share_file Grants a user, group, or domain reader/commenter/writer access (no public "anyone" links) Held until you approve it
check_approval Reports what happened to a held request: waiting, done, denied, expired or failed Allowed

Deleting files and emptying trash are not tools, and the recommended policy blocks all Google Drive delete operations.

Two-user isolation demo

Deploy one Cloudflare Worker URL (https://alter-google-drive-mcp.<your-subdomain>.workers.dev/mcp) for your company:

  1. Alice (leadership) and Bob (engineering) both connect to the same Worker URL and sign in through your company OIDC IdP.
  2. Both ask "Find and summarize the Q4 Board Deck in Drive." Alice sees and reads the deck; Bob gets No matching files found because his token is bound strictly to his own Google Drive permissions.
  3. Alice asks her agent to share the deck with an external advisor (share_file). Alter classifies drive.permissions.create as admin, send, write and holds the request until Alice approves it in the Alter Wallet (or slack-approvals), then logs alice@yourcompany.com in the audit trail.

Set up

You need an Alter account and the alter CLI (0.10 or later). Replace <app-id> and <agent-id> below. Every step can also be done in the Alter portal.

1. An Alter app with an identity provider (Auth0, Clerk, Okta, WorkOS, Entra ID, or another OIDC provider). See identity providers or the 5-minute Auth0 / Okta quickstart.

2. Google as a provider. Enable Google Drive API in Google Cloud Console and add Google (google) to your Alter app with these scopes:

  • https://www.googleapis.com/auth/drive.readonly (search, read and inspect permissions)
  • https://www.googleapis.com/auth/drive.file (create and share files the app created; use https://www.googleapis.com/auth/drive only if sharing existing user files)

Tip for Google Workspace teams: Set the Google OAuth consent screen user type to Internal. drive.readonly is a restricted Google scope for public external apps, while Internal Workspace apps skip Google verification completely. See Google provider setup.

3. An agent. The key is printed once, in the api_key field:

alter agents create --app <app-id> --name drive-agent \
  --scopes '{"google":["https://www.googleapis.com/auth/drive.readonly","https://www.googleapis.com/auth/drive.file"]}' \
  --output json | jq -r '.api_key'

4. Connect Google Drive and delegate it to the agent:

alter connect create --provider google --user-token "$USER_JWT" --agent drive-agent --output json

5. Recommended policy. Allow searches and reads, hold every sharing / permission grant (send, admin) for human approval, and block deletes:

echo '{"effect": "require_approval", "when": {"match": {"families": ["send", "admin"]}}, "approval": {"channels": ["email"], "expires_in_seconds": 86400}}' | \
  alter policy rules create --app <app-id> --agent <agent-id> --type require_approval --body - --name "Approve Drive sharing and admin changes"

echo '{"when": {"family": ["delete"]}, "effect": "deny"}' | \
  alter policy rules create --app <app-id> --agent <agent-id> --body - --name "No deletes"

6. Connect your MCP client.

claude mcp add google-drive --env ALTER_AGENT_API_KEY=<agent key> -- npx -y @alter-ai/google-drive-mcp

Until the first npm release, build from source (pnpm install && pnpm build at the repository root) and run node packages/google-drive-mcp/dist/index.js.

Host on Cloudflare (remote, multi-user MCP)

alter keys mint --app <app-id> --name mcp-hosted \
  --scopes idp_users:read,idp_users:write,connect:initiate,grants:write --output json | jq -r '.plain_key'

cd packages/google-drive-mcp
npx wrangler deploy
npx wrangler secret put ALTER_AGENT_API_KEY
npx wrangler secret put ALTER_SIGNIN_KEY
npx wrangler secret put ALLOWED_USERS

Connect clients to https://alter-google-drive-mcp.<your-subdomain>.workers.dev/mcp.

Configuration

Variable Required Meaning
ALTER_AGENT_API_KEY yes The agent's key from step 3
ALTER_ACCOUNT no Which Google account to use when more than one is delegated
ALTER_GRANT_ID no Use this exact grant instead of resolving by provider (not with ALTER_ACCOUNT)

FAQ

Can it make files public ("anyone with the link")? No. share_file only accepts user, group, or domain grantees, and Alter holds every permission grant for human approval under the recommended policy.

What about prompt injection hidden in shared Docs? Every read tool labels Drive content as untrusted, sharing is held for approval, and deletes are blocked.

Enterprise / Company IdP

This server works with any OIDC IdP (Okta, Microsoft Entra ID, Auth0, WorkOS, Clerk). For company-wide policy, audit to SIEM, and on-prem vault → Alter. Want help connecting your company IdP? Book a 20-minute architecture review or email founders@alterauth.com.

License

MIT