Accounts¶
Accounts are held by the mcp mechanism: each alias is one OpenCode MCP server at Google's Gmail endpoint, and the server's integration holds the OAuth grant. The plugin puts its Google sign-in on that integration, so one sign-in serves the Gmail tools, the plugin's sources and its remaining services. The plugin never holds a token of its own.
Accounts are held by the mcp mechanism: the vendor's MCP server holds them.
| Field | Type | Required |
|---|---|---|
mode | interactive | credentials_file | access_token | no |
enabledServices | array | no |
domains | array | no |
access | value | no |
scopes | array | no |
oauthClient | value | no |
credentialsFileEnv | string | no |
tokenEnv | string | no |
Sign in¶
| Alias | Server |
|---|---|
default | gws |
work | gws-work |
- In OpenCode, run
/connectand choose Google Workspace (or Google Workspace (work)). Paste a Desktop OAuth client's ID and secret, choose read-only or read and write, and approve the scopes. When a per-serviceaccessmap narrows write, the Read and write choice names the services it changes, such as Read and write for Gmail. - A sign-in's credential is labelled with the verified email Google returned, so
opencode auth listshowsada@example.com; the alias stays the integration's name (gws-work). - Some methods need a scope neither choice asks for, such as Gmail settings, calendar sharing, Drive apps or other contacts. The refusal names the permission and the scope; add it to the account's
scopesand sign in again. - A refusal carries a shortfall:
sign_inwhen signing in again allows it,settingswhen the account's options do not,provider_adminwhen a Workspace admin must allow it, andnonewhen nothing does.statuslists the same for each ready account. - From a terminal,
opencode auth login gws-workstarts the same flow. - Google's Gmail MCP server accepts the token only when the OAuth client is marked Use this client for an AI-powered agent in Google Auth Platform, and the client's project enables
gmailmcp.googleapis.comwithgmail.googleapis.com. See Configure Google Workspace MCP servers. - The host gives each server a generic OAuth method; the plugin replaces it with the Google form, so the client and the scopes are the plugin's.
- A headless profile names
credentialsFileEnvortokenEnv; the value is read at call time and never stored. It has no MCP sign-in, so it keeps the plugin's own Gmail operations, and the Gmail tools ask it to sign in if called. - One OAuth client may serve every alias; set it once in
oauthClientor paste it at the first sign-in.
Choosing an account¶
Every method declared accounts: "optional" takes account. With one account it may be left out; with several, omitting it is ACCOUNT_REQUIRED, whose next step lists the aliases. An unknown alias is ACCOUNT_UNKNOWN. A commit takes no account: the register runs it as the account the plan recorded. A Gmail MCP tool carries its account in its server name (gws_... or gws-work_...), so it takes no account input either.
Status and probe¶
status lists every alias with ready, needs_sign_in or error, and its owner once a probe has answered. A ready account also lists its shortfalls: what it cannot do yet, in the person's words, and whether a sign-in, the account's options, a Workspace admin or nothing allows it. probe returns { source, account, owner, scopes? } from the verified sign-in and reads no content. A sign-in that was revoked is NEEDS_SIGN_IN from the first call that needs it.