mmggws
v0.1.44
Published
MoMo Google Workspace CLI and MCP server
Readme
MoMo Google Workspace (mmggws)
Use the package as either a CLI or a stdio MCP server. Both surfaces run the same Workspace operations as the Google account that signs in. This guide finds a Drive file by name and returns its ID and link using the read-only drive_list operation.
Requires Node.js 18 or later and npx.
CLI
Connect the Google account:
npx -y mmggws@latest loginThe command prints a consent URL and attempts to open it in a browser. Choose the account to use with Workspace and approve access. On completion, the CLI reports that the token was saved and its refresh verified. If the browser does not open, use the printed URL.
Inspect the current operation schema, then search by a distinctive name. Replace budget with words from the file name:
npx -y mmggws@latest tool show drive_list
npx -y mmggws@latest tool call drive_list \
--args "{\"query\":\"name contains 'budget' and trashed = false\"}" \
--json--json includes structuredContent; the default text output gives the count and includes next_cursor when another page exists. Use --json for the file details: the structured operation data contains files, whose items include id, name, and web_view_link when Drive supplies a link. Use the returned ID and link for the matching file.
MCP
Register a stdio MCP server in your client with this command and argument list. It launches the package using the canonical command npx -y mmggws@latest:
{
"command": "npx",
"args": ["-y", "mmggws@latest"]
}The portable MCP surface has three tools: search, instructions, and execute. Connect the account through the gateway:
- Call
searchwith{"query":"sign in"}and select theloginoperation. - Call
instructionswith{"operation":"login"}. - Call
executewith{"operation":"login","arguments":{}}, then complete the browser consent for the Google account to use.
Find the Drive file through the same gateway:
- Call
searchwith{"query":"find files in Drive"}and selectdrive_list. - Call
instructionswith{"operation":"drive_list"}to inspect its input schema. - Call
executewith{"operation":"drive_list","arguments":{"query":"name contains 'budget' and trashed = false"}}. Replacebudgetwith words from the file name.
The result's structured data contains files; use the matching item's id and web_view_link when present. This is a shape example only; every value is a placeholder, not observed account data:
{
"files": [
{
"id": "EXAMPLE_ID",
"name": "Example document",
"web_view_link": "EXAMPLE_LINK"
}
],
"next_cursor": "EXAMPLE_CURSOR"
}In CLI --json, this operation data is under structuredContent. MCP clients receive the same fields in structuredContent; the gateway also carries the complete result in its text content.
Empty Results And Pages
No matches is a successful read, not a login error. CLI text says drive_list: 0 files; structured data has files: null when there are no items. MCP's mirrored structured result makes the same empty state visible in its text channel. A matching page contains a files array.
drive_list returns up to 10 files by default (maximum 100). If the result has next_cursor, continue with that opaque value as the only operation argument; an absent cursor means the last page.
CLI:
npx -y mmggws@latest tool call drive_list \
--args "{\"cursor\":\"<next_cursor>\"}" \
--jsonMCP execute:
{
"operation": "drive_list",
"arguments": {"cursor": "<next_cursor>"}
}Replace <next_cursor> with the value returned by the previous page. A cursor supersedes the original query and page options, so send it alone.
Sign-In Recovery
MCP search works before sign-in and does not open a browser. An actual Google execute call may open browser recovery when credentials are missing or the refresh token is permanently rejected. Transient token-service failures and Google API 401/403 responses do not start that recovery. The explicit login operation above can be used when the employee chooses to connect first.
