googlemcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. googlemcp-0.1.0/.gitignore +56 -0
  2. googlemcp-0.1.0/CHANGELOG.md +62 -0
  3. googlemcp-0.1.0/LICENSE +21 -0
  4. googlemcp-0.1.0/PKG-INFO +221 -0
  5. googlemcp-0.1.0/README.md +184 -0
  6. googlemcp-0.1.0/catalog/services.json +167 -0
  7. googlemcp-0.1.0/pyproject.toml +129 -0
  8. googlemcp-0.1.0/src/googlemcp/__init__.py +17 -0
  9. googlemcp-0.1.0/src/googlemcp/__main__.py +8 -0
  10. googlemcp-0.1.0/src/googlemcp/auth/__init__.py +33 -0
  11. googlemcp-0.1.0/src/googlemcp/auth/credentials.py +195 -0
  12. googlemcp-0.1.0/src/googlemcp/auth/flow.py +323 -0
  13. googlemcp-0.1.0/src/googlemcp/catalog.py +49 -0
  14. googlemcp-0.1.0/src/googlemcp/cli.py +497 -0
  15. googlemcp-0.1.0/src/googlemcp/config.py +241 -0
  16. googlemcp-0.1.0/src/googlemcp/context.py +207 -0
  17. googlemcp-0.1.0/src/googlemcp/policy.py +89 -0
  18. googlemcp-0.1.0/src/googlemcp/probes.py +444 -0
  19. googlemcp-0.1.0/src/googlemcp/py.typed +0 -0
  20. googlemcp-0.1.0/src/googlemcp/redaction.py +90 -0
  21. googlemcp-0.1.0/src/googlemcp/secretstore/__init__.py +48 -0
  22. googlemcp-0.1.0/src/googlemcp/secretstore/backends.py +201 -0
  23. googlemcp-0.1.0/src/googlemcp/secretstore/base.py +69 -0
  24. googlemcp-0.1.0/src/googlemcp/secretstore/secretmanager.py +124 -0
  25. googlemcp-0.1.0/src/googlemcp/server.py +140 -0
  26. googlemcp-0.1.0/src/googlemcp/services/__init__.py +32 -0
  27. googlemcp-0.1.0/src/googlemcp/services/_reporting.py +72 -0
  28. googlemcp-0.1.0/src/googlemcp/services/analytics.py +179 -0
  29. googlemcp-0.1.0/src/googlemcp/services/appsscript.py +224 -0
  30. googlemcp-0.1.0/src/googlemcp/services/base.py +166 -0
  31. googlemcp-0.1.0/src/googlemcp/services/calendar.py +339 -0
  32. googlemcp-0.1.0/src/googlemcp/services/chat.py +163 -0
  33. googlemcp-0.1.0/src/googlemcp/services/docs.py +192 -0
  34. googlemcp-0.1.0/src/googlemcp/services/drive.py +350 -0
  35. googlemcp-0.1.0/src/googlemcp/services/driveactivity.py +138 -0
  36. googlemcp-0.1.0/src/googlemcp/services/forms.py +252 -0
  37. googlemcp-0.1.0/src/googlemcp/services/gmail.py +481 -0
  38. googlemcp-0.1.0/src/googlemcp/services/meet.py +194 -0
  39. googlemcp-0.1.0/src/googlemcp/services/people.py +355 -0
  40. googlemcp-0.1.0/src/googlemcp/services/photos.py +349 -0
  41. googlemcp-0.1.0/src/googlemcp/services/searchconsole.py +157 -0
  42. googlemcp-0.1.0/src/googlemcp/services/sheets.py +347 -0
  43. googlemcp-0.1.0/src/googlemcp/services/slides.py +189 -0
  44. googlemcp-0.1.0/src/googlemcp/services/tasks.py +186 -0
  45. googlemcp-0.1.0/src/googlemcp/services/youtube.py +303 -0
  46. googlemcp-0.1.0/src/googlemcp/services/youtube_analytics.py +85 -0
  47. googlemcp-0.1.0/src/googlemcp/services/youtube_reporting.py +108 -0
  48. googlemcp-0.1.0/src/googlemcp/testing.py +86 -0
@@ -0,0 +1,56 @@
1
+ # Secrets and credentials: never commit
2
+ client_secret*.json
3
+ credentials*.json
4
+ *credentials*.json
5
+ token*.json
6
+ *.refresh_token
7
+ *.pem
8
+ *.p12
9
+ *.key
10
+ .env
11
+ .env.*
12
+ !.env.example
13
+ secrets/
14
+ .googlemcp/
15
+
16
+ # Terraform state, plans, and provider caches
17
+ *.tfstate
18
+ *.tfstate.*
19
+ *.tfplan
20
+ *.tfvars
21
+ !*.tfvars.example
22
+ !examples/**/*.tfvars.example
23
+ .terraform/
24
+ .terraform.lock.hcl.bak
25
+ crash.log
26
+ # Per-operator backend config (copied from backend.tf.example); keep it local
27
+ infra/terraform/backend.tf
28
+ crash.*.log
29
+ override.tf
30
+ override.tf.json
31
+ *_override.tf
32
+ *_override.tf.json
33
+ .terraformrc
34
+ terraform.rc
35
+
36
+ # Python
37
+ __pycache__/
38
+ *.py[cod]
39
+ .venv/
40
+ .pytest_cache/
41
+ .mypy_cache/
42
+ .ruff_cache/
43
+ .coverage
44
+ coverage.xml
45
+ htmlcov/
46
+ dist/
47
+ build/
48
+ *.egg-info/
49
+
50
+ # Local agent and editor state
51
+ .openrig/
52
+ .claude/
53
+ .mcp.json
54
+ .DS_Store
55
+ .idea/
56
+ .vscode/
@@ -0,0 +1,62 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format follows
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project
5
+ uses [Semantic Versioning](https://semver.org/).
6
+
7
+ ## Unreleased
8
+
9
+ ## 0.1.0 - 2026-10-24
10
+
11
+ First public release.
12
+
13
+ ### Added
14
+
15
+ - Local MCP server, `googlemcp serve`, that speaks MCP over stdio only and
16
+ opens no network listener.
17
+ - Adapters for 19 Google products from `catalog/services.json`: Tasks,
18
+ Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, People, Meet, Drive
19
+ Activity, Chat, YouTube Data, YouTube Analytics, YouTube Reporting, Google
20
+ Analytics, Search Console, Apps Script, and Photos (app-created media and
21
+ Picker). 15 are enabled by default; Meet and Chat (Workspace accounts
22
+ only), YouTube Reporting (creates server-side jobs), and Apps Script (runs
23
+ code) are opt-in.
24
+ - Permission model: read scopes and read tools by default; write tools and
25
+ write scopes per product with `GOOGLEMCP_WRITE_PRODUCTS`; delete, trash,
26
+ and send tools only with `GOOGLEMCP_ALLOW_DESTRUCTIVE=true` as well. Tools
27
+ carry MCP read-only and destructive hints.
28
+ - Full Google Tasks support: list task lists and tasks, get, create, update,
29
+ complete, and delete.
30
+ - Desktop OAuth sign-in with PKCE on a 127.0.0.1 loopback redirect:
31
+ `googlemcp auth login`, `auth status`, and `auth revoke`.
32
+ - Secret backends: OS keyring (default), 0600 file, read-only directory,
33
+ read-only environment, and Google Secret Manager (optional
34
+ `secretmanager` extra).
35
+ - CLI commands to inspect the configuration without calling Google
36
+ (`products`, `scopes`, `tools`), health checks (`doctor`, and
37
+ `doctor --probe` for one read-only call per product), and `secret set`,
38
+ `secret list`, `secret delete`.
39
+ - Google error text passed to the model has URLs and credential-looking
40
+ values redacted; for 401 and 403 it is withheld and replaced by a fixed
41
+ recovery hint.
42
+ - Optional Terraform module that enables the APIs for enabled products,
43
+ can create Secret Manager containers (never secret values), and
44
+ bootstraps a private, versioned state bucket. Policy tests reject secret
45
+ versions, keys, public IAM, and hosting resources.
46
+ - Documentation: quick start, Google Cloud console steps, client setup for
47
+ Claude Desktop, Claude Code, Cursor, and Hermes Agent, access longevity,
48
+ an acceptance runbook, and the security model.
49
+ - CI: tests with coverage, ruff, strict mypy, end-to-end tests against a
50
+ fake Google, pip-audit, Checkov, gitleaks, actionlint, and shellcheck.
51
+
52
+ ### Known limitations
53
+
54
+ - Not published on PyPI. Install from a clone with `uv sync`, or run with
55
+ `uvx --from git+<repository URL>`.
56
+ - While the OAuth consent screen is in Testing, Google expires refresh
57
+ tokens 7 days after consent. See `docs/access-longevity.md` for the
58
+ In production option.
59
+ - The Meet and Chat REST APIs do not serve personal Google accounts.
60
+ - Since 2025-03-31 the Photos Library API reaches only media the app
61
+ created; other photos are read through the Picker API.
62
+ - No remote, HTTP, or multi-user mode.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Solomon Wakhungu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.5
2
+ Name: googlemcp
3
+ Version: 0.1.0
4
+ Summary: Local stdio MCP server that exposes scoped Google APIs to MCP clients
5
+ Project-URL: Homepage, https://github.com/1solomonwakhungu/googlemcp
6
+ Project-URL: Repository, https://github.com/1solomonwakhungu/googlemcp
7
+ Project-URL: Issues, https://github.com/1solomonwakhungu/googlemcp/issues
8
+ Project-URL: Changelog, https://github.com/1solomonwakhungu/googlemcp/blob/main/CHANGELOG.md
9
+ Author: Solomon Wakhungu
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: fastmcp,gmail,google,google-api,google-calendar,google-drive,google-workspace,mcp,model-context-protocol,oauth
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Internet
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.12
25
+ Requires-Dist: fastmcp<5,>=4.1.2
26
+ Requires-Dist: google-api-python-client>=2.190
27
+ Requires-Dist: google-auth-oauthlib>=1.2
28
+ Requires-Dist: google-auth>=2.40
29
+ Requires-Dist: keyring>=25
30
+ Requires-Dist: pydantic-settings>=2.10
31
+ Requires-Dist: pydantic>=2.10
32
+ Requires-Dist: requests>=2.32
33
+ Provides-Extra: secretmanager
34
+ Requires-Dist: google-cloud-secret-manager>=2.20; extra == 'secretmanager'
35
+ Requires-Dist: google-crc32c>=1.5; extra == 'secretmanager'
36
+ Description-Content-Type: text/markdown
37
+
38
+ <!-- mcp-name: io.github.1solomonwakhungu/googlemcp -->
39
+
40
+ # GoogleMCP
41
+
42
+ [![CI](https://github.com/1solomonwakhungu/googlemcp/actions/workflows/ci.yml/badge.svg)](https://github.com/1solomonwakhungu/googlemcp/actions/workflows/ci.yml)
43
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
44
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
45
+
46
+ **A local-only, read-only-by-default MCP server giving AI clients scoped access to 19 Google products (98 tools) with zero cloud relay and zero listening ports.**
47
+
48
+ Connect Claude Code, Claude Desktop, Cursor, Hermes Agent, or any stdio MCP client to your Google Workspace **plus** YouTube, Google Analytics (GA4), Search Console, Drive Activity, Apps Script, and Google Photos. Credentials stay in your OS keyring, and every tool is gated by a 3-tier safety model built with prompt injection in mind.
49
+
50
+ - **3-tier least-privilege safety:** Read scopes and read tools only by default (45 read tools across 15 default products). Write tools need per-product `GOOGLEMCP_WRITE_PRODUCTS`; destructive tools (delete, trash, send, run code) need a second opt-in (`GOOGLEMCP_ALLOW_DESTRUCTIVE=true`) and carry explicit MCP `destructiveHint` annotations.
51
+ - **Strict local stdio transport:** `googlemcp serve` opens no network listener, has no HTTP mode, and is never hosted. Each user brings their own Google Cloud project and Desktop OAuth client (PKCE on `127.0.0.1` during one-time login).
52
+ - **19 Google products in one server:** Workspace apps alongside YouTube Data, YouTube Analytics, YouTube Reporting, Google Analytics (GA4), Search Console, Drive Activity, Apps Script, and Google Photos (post-2025 Picker and app-created Library API).
53
+ - **Operator-grade diagnostics:** Inspect exact scopes (`googlemcp scopes`), active tools (`googlemcp tools`), token health (`googlemcp auth status`), and run live read-only smoke checks across every enabled product (`googlemcp doctor --probe`).
54
+
55
+ Full documentation index: [docs/README.md](docs/README.md).
56
+
57
+ ## What you can ask your AI (read-only by default)
58
+
59
+ - *"Search my Gmail for invoices from last month and summarize the totals."*
60
+ - *"Check my Google Calendar free/busy slots tomorrow and list open Google Tasks."*
61
+ - *"Pull top Search Console queries with dropping CTR and compare against GA4 traffic."*
62
+ - *"Find the Q3 launch doc in Google Drive, read its text, and check recent Drive Activity."*
63
+ - *"Fetch my YouTube channel analytics for the last 28 days and list my top videos."*
64
+
65
+ ## Safety tiers
66
+
67
+ | Tier | Configuration | What the MCP client can see and request |
68
+ |---|---|---|
69
+ | Read-only (default) | `GOOGLEMCP_PRODUCTS` unset (or product list) | Read-only OAuth scopes and read tools only (45 tools across 15 default products) |
70
+ | Scoped writes | Add `GOOGLEMCP_WRITE_PRODUCTS=tasks,docs` | Adds write scopes and non-destructive write tools (drafts, edits, create) for listed products only |
71
+ | Destructive actions | Add `GOOGLEMCP_ALLOW_DESTRUCTIVE=true` | Also exposes irreversible tools (send email, delete task/event/contact, trash file, send chat, run Apps Script) with MCP `destructiveHint` |
72
+
73
+ Secrets live in your OS keyring by default (macOS Keychain, Windows Credential Locker, Linux Secret Service), with `file` (strict `0600`), `dir`, `env`, and optional Google Secret Manager backends. Upstream Google errors have URLs and credential-like values redacted, and 401/403 error bodies are withheld entirely. Threat model and CI scans: [docs/security.md](docs/security.md). Vulnerability reports: [SECURITY.md](SECURITY.md).
74
+
75
+ ## Products (19 adapters, 98 tools)
76
+
77
+ `catalog/services.json` is the source of truth; Terraform and the server both read it, and `tests/test_readme.py` checks this table against it. Every tool and OAuth scope is listed in [docs/inventory.md](docs/inventory.md).
78
+
79
+ | Key | Product | Default | Why off by default |
80
+ |---|---|---|---|
81
+ | `tasks` | Google Tasks | on | |
82
+ | `gmail` | Gmail | on | |
83
+ | `calendar` | Google Calendar | on | |
84
+ | `drive` | Google Drive | on | |
85
+ | `docs` | Google Docs | on | |
86
+ | `sheets` | Google Sheets | on | |
87
+ | `slides` | Google Slides | on | |
88
+ | `forms` | Google Forms | on | |
89
+ | `people` | People and Contacts | on | |
90
+ | `meet` | Google Meet | off | Meet REST API needs a Google Workspace account |
91
+ | `driveactivity` | Drive Activity | on | |
92
+ | `chat` | Google Chat | off | Needs a Business or Enterprise Workspace account and a Chat app configured in the console |
93
+ | `youtube` | YouTube Data | on | |
94
+ | `youtube_analytics` | YouTube Analytics | on | |
95
+ | `youtube_reporting` | YouTube Reporting | off | Reporting jobs are created and kept on Google's side |
96
+ | `analytics` | Google Analytics | on | |
97
+ | `searchconsole` | Search Console | on | |
98
+ | `appsscript` | Apps Script | off | Can run code in your account; also needs a manual per-user setting |
99
+ | `photos` | Google Photos (Library app-created data and Picker) | on | |
100
+
101
+ "Default on" means enabled read-only when `GOOGLEMCP_PRODUCTS` is unset. Gmail and Drive use restricted scopes; YouTube Data has a daily quota. Google removed broad Photos Library scopes on 2025-03-31, so the Library API reaches only app-created media while the Picker API reads photos you choose ([Photos API updates](https://developers.google.com/photos/support/updates)). Single-product Tasks guide: [docs/tasks.md](docs/tasks.md).
102
+
103
+ ## Quick start
104
+
105
+ Prerequisites: Python 3.12+, [uv](https://docs.astral.sh/uv/), the [`gcloud` CLI](https://cloud.google.com/sdk/docs/install), and a Google account. Optional: Terraform 1.9+ if you prefer IaC for API enablement ([docs/terraform.md](docs/terraform.md)).
106
+
107
+ ### 1. Install
108
+
109
+ ```sh
110
+ git clone https://github.com/1solomonwakhungu/googlemcp
111
+ cd googlemcp
112
+ uv sync
113
+ uv run googlemcp products # inspect enabled products offline
114
+ ```
115
+
116
+ Or run directly without a local checkout (not yet published on PyPI):
117
+
118
+ ```sh
119
+ uvx --from git+https://github.com/1solomonwakhungu/googlemcp googlemcp products
120
+ ```
121
+
122
+ ### 2. Create a Google Cloud project and enable APIs
123
+
124
+ ```sh
125
+ gcloud auth login
126
+ gcloud projects create PROJECT_ID --name="GoogleMCP"
127
+ gcloud config set project PROJECT_ID
128
+ ```
129
+
130
+ Enable the APIs for your chosen products with `gcloud services enable` ([docs/manual-steps.md](docs/manual-steps.md#enable-the-apis)) or the optional Terraform module ([docs/terraform.md](docs/terraform.md)).
131
+
132
+ ### 3. Pick products, configure consent, and download a Desktop OAuth client
133
+
134
+ Export the same settings your MCP client will use so `scopes` and `auth login` match:
135
+
136
+ ```sh
137
+ export GOOGLEMCP_PRODUCTS=tasks,calendar,gmail,drive
138
+ uv run googlemcp scopes # exact OAuth scopes to paste in step 4 below
139
+ ```
140
+
141
+ In the Google Auth Platform console (no public API exists to automate this; full walkthrough in [docs/manual-steps.md](docs/manual-steps.md)):
142
+
143
+ 1. **Branding:** set app name and your email as support/developer contact.
144
+ 2. **Audience:** choose **External**, add your Google account as a test user.
145
+ 3. **Publishing status:** **Testing** expires refresh tokens after 7 days; **In production** (unverified, personal use) avoids weekly re-login ([docs/access-longevity.md](docs/access-longevity.md)).
146
+ 4. **Data access:** paste the scopes printed by `uv run googlemcp scopes`.
147
+ 5. **Clients:** create a **Desktop app** OAuth client and download its JSON once.
148
+
149
+ Because the app is your own unverified personal app, Google shows "Google hasn't verified this app" during sign-in. Click **Advanced**, then **Go to GoogleMCP (unsafe)**.
150
+
151
+ ### 4. Sign in and verify
152
+
153
+ ```sh
154
+ uv run googlemcp auth login --client-secrets ~/Downloads/client_secret_XXXX.json
155
+ uv run googlemcp auth status \
156
+ && uv run googlemcp auth verify-client ~/Downloads/client_secret_XXXX.json \
157
+ && rm ~/Downloads/client_secret_XXXX.json
158
+ uv run googlemcp doctor --probe # one cheap read-only call per enabled product
159
+ ```
160
+
161
+ `auth login` saves the client ID, client secret, and refresh token in your OS keyring (or Google Secret Manager: [docs/manual-steps.md](docs/manual-steps.md#5-desktop-oauth-client-for-googlemcp-auth-login)). The downloaded JSON is deleted only after verifying the stored client matches it.
162
+
163
+ ### 5. Connect your MCP client
164
+
165
+ **Claude Code:**
166
+
167
+ ```sh
168
+ claude mcp add --env GOOGLEMCP_PRODUCTS=tasks,calendar,gmail,drive \
169
+ --transport stdio googlemcp -- uv run --directory /path/to/googlemcp googlemcp serve
170
+ ```
171
+
172
+ **Claude Desktop / Cursor (`mcpServers` JSON):**
173
+
174
+ ```json
175
+ {
176
+ "mcpServers": {
177
+ "googlemcp": {
178
+ "command": "uv",
179
+ "args": ["run", "--directory", "/path/to/googlemcp", "googlemcp", "serve"],
180
+ "env": {
181
+ "GOOGLEMCP_PRODUCTS": "tasks,calendar,gmail,drive"
182
+ }
183
+ }
184
+ }
185
+ }
186
+ ```
187
+
188
+ Full setup for Claude Desktop, Cursor, generic stdio clients: [docs/clients.md](docs/clients.md). Hermes Agent: [docs/hermes.md](docs/hermes.md). End-to-end verification runbook: [docs/acceptance.md](docs/acceptance.md).
189
+
190
+ To enable writes later (for example `GOOGLEMCP_WRITE_PRODUCTS=tasks`), export the updated setting, rerun `uv run googlemcp scopes`, add the new scopes on the Data access page, rerun `uv run googlemcp auth login`, and update the client `env` block.
191
+
192
+ ## How this compares
193
+
194
+ | Server | Scope | Default safety | Transport & hosting |
195
+ |---|---|---|---|
196
+ | **GoogleMCP** | 19 products (Workspace + YouTube, GA4, Search Console, Photos Picker, Apps Script) | Read-only scopes & tools; per-product writes + separate destructive gate; OS keyring | Local stdio only; zero listening ports; single user |
197
+ | [taylorwilsdon/google_workspace_mcp](https://github.com/taylorwilsdon/google_workspace_mcp) | Workspace apps | Optional read-only flag & tool tiers | Local stdio or hosted HTTP / multi-user |
198
+ | [Google Workspace MCP servers](https://developers.google.com/workspace/guides/configure-mcp-servers) | Workspace apps (one remote server per product; Developer Preview) | Managed Google OAuth | Remote servers hosted by Google |
199
+
200
+ ChatGPT custom connectors require a public HTTPS server, so GoogleMCP intentionally does not target them; use ChatGPT's built-in Google connectors there.
201
+
202
+ ## Access longevity
203
+
204
+ In **Testing** status, Google expires refresh tokens 7 days after consent. Switching your personal app to **In production** (unverified, personal use) removes the 7-day cap; tokens then last until revoked, unused for six months, displaced by the 100-tokens-per-client limit, or invalidated by a password change (when Gmail scopes are enabled). Re-authenticate anytime with `uv run googlemcp auth login`. Details: [docs/access-longevity.md](docs/access-longevity.md).
205
+
206
+ ## Repository layout
207
+
208
+ ```
209
+ catalog/services.json Single source of truth for all 19 Google products
210
+ infra/terraform/ Optional API enablement, opt-in Secret Manager containers, state bucket, tests
211
+ src/googlemcp/ Local stdio MCP server: 19 adapters in services/, policy, auth, secretstore, CLI
212
+ scripts/ Inventory generator and offline acceptance helpers
213
+ tests/ Offline pytest + socket-guarded stdio e2e suite (tests/live requires GOOGLEMCP_LIVE=1)
214
+ docs/ Setup, client, longevity, acceptance, and security documentation
215
+ ```
216
+
217
+ Architecture: [docs/architecture.md](docs/architecture.md). Development & tests: [docs/development.md](docs/development.md). Contributing: [CONTRIBUTING.md](CONTRIBUTING.md). Changelog: [CHANGELOG.md](CHANGELOG.md).
218
+
219
+ ## License
220
+
221
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,184 @@
1
+ <!-- mcp-name: io.github.1solomonwakhungu/googlemcp -->
2
+
3
+ # GoogleMCP
4
+
5
+ [![CI](https://github.com/1solomonwakhungu/googlemcp/actions/workflows/ci.yml/badge.svg)](https://github.com/1solomonwakhungu/googlemcp/actions/workflows/ci.yml)
6
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12%2B-blue.svg)](https://www.python.org/downloads/)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
8
+
9
+ **A local-only, read-only-by-default MCP server giving AI clients scoped access to 19 Google products (98 tools) with zero cloud relay and zero listening ports.**
10
+
11
+ Connect Claude Code, Claude Desktop, Cursor, Hermes Agent, or any stdio MCP client to your Google Workspace **plus** YouTube, Google Analytics (GA4), Search Console, Drive Activity, Apps Script, and Google Photos. Credentials stay in your OS keyring, and every tool is gated by a 3-tier safety model built with prompt injection in mind.
12
+
13
+ - **3-tier least-privilege safety:** Read scopes and read tools only by default (45 read tools across 15 default products). Write tools need per-product `GOOGLEMCP_WRITE_PRODUCTS`; destructive tools (delete, trash, send, run code) need a second opt-in (`GOOGLEMCP_ALLOW_DESTRUCTIVE=true`) and carry explicit MCP `destructiveHint` annotations.
14
+ - **Strict local stdio transport:** `googlemcp serve` opens no network listener, has no HTTP mode, and is never hosted. Each user brings their own Google Cloud project and Desktop OAuth client (PKCE on `127.0.0.1` during one-time login).
15
+ - **19 Google products in one server:** Workspace apps alongside YouTube Data, YouTube Analytics, YouTube Reporting, Google Analytics (GA4), Search Console, Drive Activity, Apps Script, and Google Photos (post-2025 Picker and app-created Library API).
16
+ - **Operator-grade diagnostics:** Inspect exact scopes (`googlemcp scopes`), active tools (`googlemcp tools`), token health (`googlemcp auth status`), and run live read-only smoke checks across every enabled product (`googlemcp doctor --probe`).
17
+
18
+ Full documentation index: [docs/README.md](docs/README.md).
19
+
20
+ ## What you can ask your AI (read-only by default)
21
+
22
+ - *"Search my Gmail for invoices from last month and summarize the totals."*
23
+ - *"Check my Google Calendar free/busy slots tomorrow and list open Google Tasks."*
24
+ - *"Pull top Search Console queries with dropping CTR and compare against GA4 traffic."*
25
+ - *"Find the Q3 launch doc in Google Drive, read its text, and check recent Drive Activity."*
26
+ - *"Fetch my YouTube channel analytics for the last 28 days and list my top videos."*
27
+
28
+ ## Safety tiers
29
+
30
+ | Tier | Configuration | What the MCP client can see and request |
31
+ |---|---|---|
32
+ | Read-only (default) | `GOOGLEMCP_PRODUCTS` unset (or product list) | Read-only OAuth scopes and read tools only (45 tools across 15 default products) |
33
+ | Scoped writes | Add `GOOGLEMCP_WRITE_PRODUCTS=tasks,docs` | Adds write scopes and non-destructive write tools (drafts, edits, create) for listed products only |
34
+ | Destructive actions | Add `GOOGLEMCP_ALLOW_DESTRUCTIVE=true` | Also exposes irreversible tools (send email, delete task/event/contact, trash file, send chat, run Apps Script) with MCP `destructiveHint` |
35
+
36
+ Secrets live in your OS keyring by default (macOS Keychain, Windows Credential Locker, Linux Secret Service), with `file` (strict `0600`), `dir`, `env`, and optional Google Secret Manager backends. Upstream Google errors have URLs and credential-like values redacted, and 401/403 error bodies are withheld entirely. Threat model and CI scans: [docs/security.md](docs/security.md). Vulnerability reports: [SECURITY.md](SECURITY.md).
37
+
38
+ ## Products (19 adapters, 98 tools)
39
+
40
+ `catalog/services.json` is the source of truth; Terraform and the server both read it, and `tests/test_readme.py` checks this table against it. Every tool and OAuth scope is listed in [docs/inventory.md](docs/inventory.md).
41
+
42
+ | Key | Product | Default | Why off by default |
43
+ |---|---|---|---|
44
+ | `tasks` | Google Tasks | on | |
45
+ | `gmail` | Gmail | on | |
46
+ | `calendar` | Google Calendar | on | |
47
+ | `drive` | Google Drive | on | |
48
+ | `docs` | Google Docs | on | |
49
+ | `sheets` | Google Sheets | on | |
50
+ | `slides` | Google Slides | on | |
51
+ | `forms` | Google Forms | on | |
52
+ | `people` | People and Contacts | on | |
53
+ | `meet` | Google Meet | off | Meet REST API needs a Google Workspace account |
54
+ | `driveactivity` | Drive Activity | on | |
55
+ | `chat` | Google Chat | off | Needs a Business or Enterprise Workspace account and a Chat app configured in the console |
56
+ | `youtube` | YouTube Data | on | |
57
+ | `youtube_analytics` | YouTube Analytics | on | |
58
+ | `youtube_reporting` | YouTube Reporting | off | Reporting jobs are created and kept on Google's side |
59
+ | `analytics` | Google Analytics | on | |
60
+ | `searchconsole` | Search Console | on | |
61
+ | `appsscript` | Apps Script | off | Can run code in your account; also needs a manual per-user setting |
62
+ | `photos` | Google Photos (Library app-created data and Picker) | on | |
63
+
64
+ "Default on" means enabled read-only when `GOOGLEMCP_PRODUCTS` is unset. Gmail and Drive use restricted scopes; YouTube Data has a daily quota. Google removed broad Photos Library scopes on 2025-03-31, so the Library API reaches only app-created media while the Picker API reads photos you choose ([Photos API updates](https://developers.google.com/photos/support/updates)). Single-product Tasks guide: [docs/tasks.md](docs/tasks.md).
65
+
66
+ ## Quick start
67
+
68
+ Prerequisites: Python 3.12+, [uv](https://docs.astral.sh/uv/), the [`gcloud` CLI](https://cloud.google.com/sdk/docs/install), and a Google account. Optional: Terraform 1.9+ if you prefer IaC for API enablement ([docs/terraform.md](docs/terraform.md)).
69
+
70
+ ### 1. Install
71
+
72
+ ```sh
73
+ git clone https://github.com/1solomonwakhungu/googlemcp
74
+ cd googlemcp
75
+ uv sync
76
+ uv run googlemcp products # inspect enabled products offline
77
+ ```
78
+
79
+ Or run directly without a local checkout (not yet published on PyPI):
80
+
81
+ ```sh
82
+ uvx --from git+https://github.com/1solomonwakhungu/googlemcp googlemcp products
83
+ ```
84
+
85
+ ### 2. Create a Google Cloud project and enable APIs
86
+
87
+ ```sh
88
+ gcloud auth login
89
+ gcloud projects create PROJECT_ID --name="GoogleMCP"
90
+ gcloud config set project PROJECT_ID
91
+ ```
92
+
93
+ Enable the APIs for your chosen products with `gcloud services enable` ([docs/manual-steps.md](docs/manual-steps.md#enable-the-apis)) or the optional Terraform module ([docs/terraform.md](docs/terraform.md)).
94
+
95
+ ### 3. Pick products, configure consent, and download a Desktop OAuth client
96
+
97
+ Export the same settings your MCP client will use so `scopes` and `auth login` match:
98
+
99
+ ```sh
100
+ export GOOGLEMCP_PRODUCTS=tasks,calendar,gmail,drive
101
+ uv run googlemcp scopes # exact OAuth scopes to paste in step 4 below
102
+ ```
103
+
104
+ In the Google Auth Platform console (no public API exists to automate this; full walkthrough in [docs/manual-steps.md](docs/manual-steps.md)):
105
+
106
+ 1. **Branding:** set app name and your email as support/developer contact.
107
+ 2. **Audience:** choose **External**, add your Google account as a test user.
108
+ 3. **Publishing status:** **Testing** expires refresh tokens after 7 days; **In production** (unverified, personal use) avoids weekly re-login ([docs/access-longevity.md](docs/access-longevity.md)).
109
+ 4. **Data access:** paste the scopes printed by `uv run googlemcp scopes`.
110
+ 5. **Clients:** create a **Desktop app** OAuth client and download its JSON once.
111
+
112
+ Because the app is your own unverified personal app, Google shows "Google hasn't verified this app" during sign-in. Click **Advanced**, then **Go to GoogleMCP (unsafe)**.
113
+
114
+ ### 4. Sign in and verify
115
+
116
+ ```sh
117
+ uv run googlemcp auth login --client-secrets ~/Downloads/client_secret_XXXX.json
118
+ uv run googlemcp auth status \
119
+ && uv run googlemcp auth verify-client ~/Downloads/client_secret_XXXX.json \
120
+ && rm ~/Downloads/client_secret_XXXX.json
121
+ uv run googlemcp doctor --probe # one cheap read-only call per enabled product
122
+ ```
123
+
124
+ `auth login` saves the client ID, client secret, and refresh token in your OS keyring (or Google Secret Manager: [docs/manual-steps.md](docs/manual-steps.md#5-desktop-oauth-client-for-googlemcp-auth-login)). The downloaded JSON is deleted only after verifying the stored client matches it.
125
+
126
+ ### 5. Connect your MCP client
127
+
128
+ **Claude Code:**
129
+
130
+ ```sh
131
+ claude mcp add --env GOOGLEMCP_PRODUCTS=tasks,calendar,gmail,drive \
132
+ --transport stdio googlemcp -- uv run --directory /path/to/googlemcp googlemcp serve
133
+ ```
134
+
135
+ **Claude Desktop / Cursor (`mcpServers` JSON):**
136
+
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "googlemcp": {
141
+ "command": "uv",
142
+ "args": ["run", "--directory", "/path/to/googlemcp", "googlemcp", "serve"],
143
+ "env": {
144
+ "GOOGLEMCP_PRODUCTS": "tasks,calendar,gmail,drive"
145
+ }
146
+ }
147
+ }
148
+ }
149
+ ```
150
+
151
+ Full setup for Claude Desktop, Cursor, generic stdio clients: [docs/clients.md](docs/clients.md). Hermes Agent: [docs/hermes.md](docs/hermes.md). End-to-end verification runbook: [docs/acceptance.md](docs/acceptance.md).
152
+
153
+ To enable writes later (for example `GOOGLEMCP_WRITE_PRODUCTS=tasks`), export the updated setting, rerun `uv run googlemcp scopes`, add the new scopes on the Data access page, rerun `uv run googlemcp auth login`, and update the client `env` block.
154
+
155
+ ## How this compares
156
+
157
+ | Server | Scope | Default safety | Transport & hosting |
158
+ |---|---|---|---|
159
+ | **GoogleMCP** | 19 products (Workspace + YouTube, GA4, Search Console, Photos Picker, Apps Script) | Read-only scopes & tools; per-product writes + separate destructive gate; OS keyring | Local stdio only; zero listening ports; single user |
160
+ | [taylorwilsdon/google_workspace_mcp](https://github.com/taylorwilsdon/google_workspace_mcp) | Workspace apps | Optional read-only flag & tool tiers | Local stdio or hosted HTTP / multi-user |
161
+ | [Google Workspace MCP servers](https://developers.google.com/workspace/guides/configure-mcp-servers) | Workspace apps (one remote server per product; Developer Preview) | Managed Google OAuth | Remote servers hosted by Google |
162
+
163
+ ChatGPT custom connectors require a public HTTPS server, so GoogleMCP intentionally does not target them; use ChatGPT's built-in Google connectors there.
164
+
165
+ ## Access longevity
166
+
167
+ In **Testing** status, Google expires refresh tokens 7 days after consent. Switching your personal app to **In production** (unverified, personal use) removes the 7-day cap; tokens then last until revoked, unused for six months, displaced by the 100-tokens-per-client limit, or invalidated by a password change (when Gmail scopes are enabled). Re-authenticate anytime with `uv run googlemcp auth login`. Details: [docs/access-longevity.md](docs/access-longevity.md).
168
+
169
+ ## Repository layout
170
+
171
+ ```
172
+ catalog/services.json Single source of truth for all 19 Google products
173
+ infra/terraform/ Optional API enablement, opt-in Secret Manager containers, state bucket, tests
174
+ src/googlemcp/ Local stdio MCP server: 19 adapters in services/, policy, auth, secretstore, CLI
175
+ scripts/ Inventory generator and offline acceptance helpers
176
+ tests/ Offline pytest + socket-guarded stdio e2e suite (tests/live requires GOOGLEMCP_LIVE=1)
177
+ docs/ Setup, client, longevity, acceptance, and security documentation
178
+ ```
179
+
180
+ Architecture: [docs/architecture.md](docs/architecture.md). Development & tests: [docs/development.md](docs/development.md). Contributing: [CONTRIBUTING.md](CONTRIBUTING.md). Changelog: [CHANGELOG.md](CHANGELOG.md).
181
+
182
+ ## License
183
+
184
+ MIT. See [LICENSE](LICENSE).