Skip to content

@gemstack/mcp-connector-google-drive

A Google Drive connector for GemStack AI orchestration. Browse, read, and share Drive files over the Drive REST API (v3). Built with @gemstack/mcp-connectors; the result is a standard @gemstack/mcp server.

Installation

bash
npm i @gemstack/mcp-connector-google-drive @gemstack/mcp-connectors @gemstack/mcp

Use

ts
import { createServer } from 'node:http'
import { mountConnectors } from '@gemstack/mcp-connectors'
import { createMcpHttpHandler } from '@gemstack/mcp'
import drive from '@gemstack/mcp-connector-google-drive'

const Server = mountConnectors([drive], {
  // A Google OAuth 2.0 access token with a Drive scope.
  credentials: () => ({ token: process.env.GOOGLE_ACCESS_TOKEN }),
})

// `Server` is a standard @gemstack/mcp server class. Mount an instance
// on any transport: raw node:http / Express / Connect here, or
// `createWebRequestHandler` / `startStdio` from `@gemstack/mcp/runtime`.
const handler = createMcpHttpHandler(new Server())
createServer((req, res) => { void handler(req, res) }).listen(3000)

Tools are exposed namespaced by connector id, e.g. google-drive_list-files.

Auth

Drive has no static API key — it is OAuth 2.0 only. The connector declares auth: { type: 'oauth', scopes: ['https://www.googleapis.com/auth/drive'] } and consumes a bearer token from ctx.auth.token; it does no OAuth handshake itself. Use drive.readonly if you only need the read tools. To protect a web endpoint and obtain the token, wrap it with @gemstack/mcp's oauth2McpMiddleware + registerOAuth2Metadata and feed the verified token through the mount credentials option.

Tools

ToolKindDescription
get-aboutreadAuthenticated user + storage usage
list-filesreadList files (folder / raw query scoped)
search-filesreadSearch by name and full-text content
get-filereadMetadata for one file or folder
get-file-contentreadFile as text (Docs exported, others downloaded)
list-permissionsreadWho has access to a file
create-folderwriteCreate a folder
share-filewriteGrant access (create a permission)
trash-filewrite (destructive)Move a file to the trash (reversible)

get-file-content exports Google Docs/Sheets/Slides to text/CSV and downloads everything else via alt=media. Read tools are annotated readOnly so an agent can auto-approve them; trash-file is marked destructive. Responses are slimmed to the fields an agent needs (no raw API envelopes) to keep token usage down.

See also

Released under the MIT License.