Skip to main content
Context7 can sync Google Docs and Google Slides from Google Drive and serve them like any other library. Google Drive stays the source of truth: a daily sync picks up edits, and files that are removed or no longer shared leave the results. An admin connects Google once under Workspace Settings › Google. Then an admin chooses which folders, Shared Drives, Docs and presentations to sync from Add source → Google Drive, Google Docs or Google Slides. All three use the same connection. Only the selected items, and the Docs and presentations under selected folders, are indexed.
Google Docs and Google Slides are supported. Spreadsheets, PDFs and other file types in a selected folder are skipped. The picker marks them as not supported.

Choose a connection method

Context7 reads Drive as one Google identity, and sees only what that identity can open. It always uses one read-only scope: There are three ways to give Context7 that identity:
If your security team blocks service account keys and sharing outside your domain, use Google account. It needs no key and no domain-wide delegation, and nothing is shared outside your organization.
Open Workspace Settings › Google and choose the method under Authentication. Each method has a Set up Google Cloud panel with the steps below. Enter your project ID there, and the panel fills it into the commands.

Compare the security trade-offs

Every method uses the same read-only scope, and Context7 stores any secret encrypted. The methods differ in what Context7 holds, which identity Google sees, and what someone could read with a leaked credential: Disconnect on the Google page removes the stored credentials. For a service account key, the key stays valid at Google until you delete it there. Libraries keep their indexed content after a disconnect, but they stop syncing until you connect again with the same method, account and Act as user. A new key for the same service account is fine.

Google account

Context7 signs in as a Workspace user that exists only for Context7. You share folders with that user like with any colleague.
1

Enable the Drive and Slides APIs

In the Google Cloud console, select a project that belongs to your Workspace organization. Open APIs & Services → Library and enable the Google Drive API and the Google Slides API, or run:
2

Configure the consent screen as Internal

Open Google Auth Platform and click Get started. Enter an app name such as “Context7”, and under Audience choose Internal. Only users of your organization can sign in, and Google does not need to verify the app.
3

Create an OAuth client

Open Clients, click Create client, and choose a client type:
  • Web application: Under Authorized redirect URIs, add the redirect URI that the settings page shows, for example https://context7.yourcompany.com/api/google/oauth/callback. After the sign-in, Google sends the browser back to Context7. Google accepts only an HTTPS URI with a domain under a public top-level domain, so this does not work for an IP address or a name such as context7.corp. The host can still be reachable only from your network.
  • Desktop app: Use this when Context7 has no such address. The client needs no redirect URI. After the sign-in, Google opens an address on 127.0.0.1 that does not load. You copy that address from the browser’s address bar and paste it into Address after sign-in.
Copy the client ID and the client secret into OAuth client ID and OAuth client secret.
4

Create a Workspace user for Context7

In the Google Admin console, add a user only for Context7, such as context7-bot@yourcompany.com. Like any Workspace user, it usually takes a paid license seat. Do not use a person’s account: Context7 can read everything this account can open, and the connection stops if the account is suspended or deleted.
5

Share your folders with that user

In Google Drive, share each folder with the Context7 user with Viewer access, or add the user to each Shared Drive as a Viewer.
6

Sign in as that user

Click Sign in with Google and sign in as the Context7 user, not as yourself. On Google’s account list, choose Use another account. If Google says the app is blocked, a Workspace admin turns on Trust internal, domain-owned apps in Security → API controls.
Context7 stores the client secret and the sign-in’s refresh token encrypted, and never returns them from any API. If Google later refuses the sign-in, for example because the account was suspended or its sessions were revoked, the settings page shows Reconnect required and syncs fail until an admin clicks Reconnect and signs in again.

Service account key

Context7 signs in as a service account with a JSON key.
1

Create the service account and its key

Run these commands in Cloud Shell or with the gcloud CLI. Replace PROJECT_ID with your project ID. The first command enables the Google Drive API and the Google Slides API. The service account needs no IAM roles in the project.
Organizations created on or after May 3, 2024 block service account keys by default with the iam.disableServiceAccountKeyCreation policy. If Google refuses to create the key, ask an organization admin to allow keys for this project, or use another method.
2

Paste the key

Paste the contents of context7-drive-key.json into Service account JSON key, then delete the file. Click Test connection, then click Connect.Context7 checks the key with Google before it saves it, stores it encrypted, and never returns it from any API. The settings page shows only the service account’s email and the last characters of the key ID. To rotate the key, paste the new key and save.
3

Share the content

In Google Drive, share each folder you want to sync with the service account’s email address, with Viewer access. For a Shared Drive, add the service account as a member with the Viewer role. The email ends in iam.gserviceaccount.com, so if Drive does not allow sharing outside your organization, ask a Workspace admin to allow it for the service account, or use domain-wide delegation.

Domain-wide delegation (optional)

If sharing with the service account is not practical, the service account can act as one Workspace user and see what that user sees. You then share folders with that user, so nothing is shared outside your domain.
  1. Copy the service account’s client ID. It is client_id in the JSON key, and the Set up Google Cloud panel shows it after you paste the key.
  2. A Workspace super admin opens Domain-wide delegation in the Google Admin console (Security → Access and data control → API controls) and clicks Add new.
  3. They enter that client ID and the scope https://www.googleapis.com/auth/drive.readonly.
  4. In Context7, enter the user’s email address in Act as user.
Context7 acts only as the user in Act as user. But Google lets a service account with domain-wide delegation read Drive as any user in your domain, within the allowed scope. Protect the key accordingly, and expect your security team to review this setup.
Without delegation, the service account can read only what is explicitly shared with it. This keeps the approved content small and visible in Drive’s sharing settings, so prefer it when you can.

Server credentials

Context7 uses the server’s Application Default Credentials, so no key is stored in Context7: Create the service account as for a key, without the key command. For workload identity federation, let your workload identity pool act as the service account, and write the credential file. Replace the uppercase values with your pool, provider, subject and token file. On AWS or Azure, use --aws or --azure instead of --credential-source-file:
Set GOOGLE_APPLICATION_CREDENTIALS to the path of google-credentials.json on the Context7 server, and restart it. Then share your folders with the service account as for a key, click Test connection, and click Connect. Domain-wide delegation is not available in this mode.

Test the connection

Test connection checks the credentials with Google and lists the first folders, files and Shared Drives that the identity can see. If the list is empty, share a folder with the identity, then test again. After you connect, the page shows the identity’s email with a copy button.

Add a library

Go to Add and choose a Google source:
  • Google Drive syncs folders, Shared Drives, Docs and presentations.
  • Google Docs and Google Slides sync single files of that kind. Folders and Shared Drives stay browsable but cannot be selected.
The picker is a tree of your Shared Drives and the items shared with the Context7 identity:
  • Click a folder or Shared Drive to open it. Its contents load when you open it, and long lists load more as you scroll.
  • Type in the search box to find folders and files by name in all of Drive, also inside folders that you have not opened.
  • Check a folder or Shared Drive to select all of it. Later syncs then also pick up new files in it. If you uncheck items inside it, only its checked items are selected.
  • Selected shows what the library will contain. A library can have up to 200 selected items.
Enter a title and click Start sync. The description is optional. The selection defines the library: to sync a different set of folders, add another library. Each Doc is indexed under its Google URL, for example https://docs.google.com/document/d/<id>/edit. That link is the Source: of every result, so an agent can point people to the original document. Results taken from a document’s text also name it, as Source: <Doc title> (<link>).

Google Slides

Each slide of a presentation is indexed as its own page, with a link that opens that slide: https://docs.google.com/presentation/d/<id>/edit#slide=id.<slide id>. The slide’s title becomes its heading, and its text, lists, links, tables and speaker notes follow. Results taken from a slide name the deck and the slide, as Source: <deck name>, slide <n>: <slide title> (<link>). Hidden (skipped) slides are not indexed. Elements are indexed in reading order: top to bottom, and left to right within a row. An image, chart or video contributes its alt text, as *Image: …*, *Chart: …* or *Video: …*, and a video that has one keeps its link. WordArt contributes its text. Auto-generated alt text, such as a file name or “Picture 3”, is left out. Images, charts, diagrams and videos themselves are not indexed. Docs index an image’s alt text the same way, as *Image: …*. When a presentation changes, Context7 reads the whole presentation again:
  • A slide that did not change reuses its last extraction.
  • A deleted slide leaves the results.
  • If one slide fails to index, its last indexed version stays.
  • If the presentation cannot be read, all its slides keep their last indexed version.
  • A presentation with no visible slides counts as empty and leaves the results.

How syncing works

Every sync lists the selected folders again and compares each file with the last sync: A sync builds the new index next to the live one and swaps it in only when it finishes, so queries always see a complete library.

Failures keep valid content

  • One file fails (for example a Doc is larger than Drive’s 10 MB export limit, or the LLM times out while extracting it): the last indexed version of that file stays in the results. The library page shows a warning, its logs list the file and the reason, the Libraries list in Workspace Settings › Google shows the failed files, and the next sync tries it again.
  • The whole sync fails (for example Google refuses access because the Drive API is disabled, or Google cannot be reached): all live content stays as it was, and the error is shown in the library’s logs.
Sharing is the approval. When a selected folder or Shared Drive is no longer shared with the Context7 identity, the next sync removes its files from the results. Check sharing changes before the daily sync if you want to keep the content.
Context7 retries Google API quota errors with exponential backoff and limits how many requests it sends at once.

Scheduled sync

Google Drive libraries sync every day at 03:00 server time by default. Under Sync schedule on the Google page (Workspace Settings › Google), you can:
  • turn the scheduled sync off,
  • change the schedule: pick a preset such as Every 6 hours, or enter a cron expression such as 0 */6 * * *,
  • click Sync all now to queue every Google Drive library at once.
When a sync fails, scheduled or manual, Context7 retries that library after 15 minutes, 1 hour and 6 hours. Each delay counts from the previous attempt. To sync one library by hand, click Refresh on its page, or Sync now next to it in the Libraries list. To read and re-index every file instead of skipping unchanged ones, select Re-index all files in the Refresh dialog, or in the library’s menu in the Libraries list. Only an admin can refresh a Google Drive library, even when Refresh repositories is on in Workspace Settings › Authorization: the sync reads Drive with the connector’s credentials.

Monitor libraries

The Libraries list on the Google page (Workspace Settings › Google) shows every Google Drive library with its selection, its last sync, and a status: Expanding a row shows the most common failure reasons and up to 50 failed files, each linked to Drive. Download CSV exports every failed file. Problem libraries sort to the top, and Needs attention filters the list to them.

Authority labels

Authority labels can match Google Drive content by path or by URL:
  • A path pattern matches the file’s folder path and file name inside the selection. For example, /QA/Standards/Release sign-off is the Release sign-off Doc in the Standards folder of a selected QA folder, and the prefix /QA/Standards/ matches every file in that folder. For a Shared Drive, the path starts with the Shared Drive’s name.
  • A URL pattern matches the Doc’s Google URL, for example https://docs.google.com/document/d/<id>.
For a presentation:
  • A URL prefix https://docs.google.com/presentation/d/<id> matches every slide of that presentation.
  • A path rule matches the presentation’s path in Drive, for example /QA/Standards/Release review for the Release review presentation in the Standards folder, and applies to all its slides.

Network access

The server talks only to Google: Set GOOGLE_DRIVE_API_URL and GOOGLE_SLIDES_API_URL to send Drive and Slides API calls through another endpoint, such as a Private Google Access address or a proxy. Each value must include the API path, for example https://www.googleapis.com/drive/v3 and https://slides.googleapis.com/v1. With Google account, the admin’s browser also opens accounts.google.com for the sign-in. To send the server’s OAuth calls through another endpoint, set GOOGLE_OAUTH_TOKEN_URL (default https://oauth2.googleapis.com/token), GOOGLE_OAUTH_REVOKE_URL (default https://oauth2.googleapis.com/revoke) and GOOGLE_OAUTH_AUTHORIZE_URL (default https://accounts.google.com/o/oauth2/v2/auth).

Troubleshooting