Google Docs context provider for OpenCtx

This is a context provider for OpenCtx that brings Google Docs context to code AI and editors. Only items, not annotations, are supported.

Status: experimental

Configuration for Sourcegraph teammates

  1. Find "OpenCtx Google Docs provider config" in 1Password and follow instructions from there.

Configuration outside of Sourcegraph

To create Google Drive/Docs API credentials:

  1. Enable the following services in your Google Cloud project: gcloud services enable
  2. Configure the OAuth consent screen (only a name and email addresses are required)
  3. Create a new OAuth client ID (select "Desktop app" as the application type)
  4. Save the credentials JSON file (client_secret_xxx.apps.googleusercontent.json)
  5. Obtain an access token for your Google Drive user account: run GOOGLE_OAUTH_CLIENT_FILE=path/to/client_secret_xxx.apps.googleusercontent.json pnpm run google-auth and continue in your web browser

Then use the following OpenCtx provider configuration:

"openctx.providers": {
// ...other providers...
"": {
"googleOAuthClient": {
"client_id": "XXX",
"client_secret": "XXX",
"redirect_uris": ["http://localhost"]
"googleOAuthCredentials": {
"refresh_token": "XXX",
"access_token": "XXX",
"expiry_date": "XXX",