measure-analytics-mcp 0.2.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 (137) hide show
  1. measure_analytics_mcp-0.2.0/.github/workflows/ci.yml +27 -0
  2. measure_analytics_mcp-0.2.0/.github/workflows/release.yml +23 -0
  3. measure_analytics_mcp-0.2.0/.gitignore +47 -0
  4. measure_analytics_mcp-0.2.0/CHANGELOG.md +53 -0
  5. measure_analytics_mcp-0.2.0/CODE_OF_CONDUCT.md +34 -0
  6. measure_analytics_mcp-0.2.0/CONTRIBUTING.md +41 -0
  7. measure_analytics_mcp-0.2.0/LICENSE +20 -0
  8. measure_analytics_mcp-0.2.0/PKG-INFO +109 -0
  9. measure_analytics_mcp-0.2.0/README.md +78 -0
  10. measure_analytics_mcp-0.2.0/ROADMAP.md +26 -0
  11. measure_analytics_mcp-0.2.0/SECURITY.md +19 -0
  12. measure_analytics_mcp-0.2.0/docker/alerts-engine.Dockerfile +39 -0
  13. measure_analytics_mcp-0.2.0/docker/bigquery-analyst.Dockerfile +39 -0
  14. measure_analytics_mcp-0.2.0/docker/consent-mode-auditor.Dockerfile +39 -0
  15. measure_analytics_mcp-0.2.0/docker/data-quality.Dockerfile +39 -0
  16. measure_analytics_mcp-0.2.0/docker/ga4-intelligence.Dockerfile +39 -0
  17. measure_analytics_mcp-0.2.0/docker/gtm-operations.Dockerfile +39 -0
  18. measure_analytics_mcp-0.2.0/docker/server-side-auditor.Dockerfile +39 -0
  19. measure_analytics_mcp-0.2.0/docs/adapters.md +194 -0
  20. measure_analytics_mcp-0.2.0/docs/architecture.md +143 -0
  21. measure_analytics_mcp-0.2.0/docs/authentication.md +137 -0
  22. measure_analytics_mcp-0.2.0/docs/clients/chatgpt.md +42 -0
  23. measure_analytics_mcp-0.2.0/docs/clients/claude-desktop.md +57 -0
  24. measure_analytics_mcp-0.2.0/docs/index.md +36 -0
  25. measure_analytics_mcp-0.2.0/docs/installation.md +50 -0
  26. measure_analytics_mcp-0.2.0/docs/quickstart.md +76 -0
  27. measure_analytics_mcp-0.2.0/docs/release-notes.md +90 -0
  28. measure_analytics_mcp-0.2.0/docs/roadmap.md +53 -0
  29. measure_analytics_mcp-0.2.0/docs/security.md +47 -0
  30. measure_analytics_mcp-0.2.0/docs/servers/alerts-engine.md +87 -0
  31. measure_analytics_mcp-0.2.0/docs/servers/bigquery-analyst.md +66 -0
  32. measure_analytics_mcp-0.2.0/docs/servers/consent-mode-auditor.md +61 -0
  33. measure_analytics_mcp-0.2.0/docs/servers/data-quality.md +55 -0
  34. measure_analytics_mcp-0.2.0/docs/servers/ga4-intelligence.md +69 -0
  35. measure_analytics_mcp-0.2.0/docs/servers/google-ads-analyst.md +60 -0
  36. measure_analytics_mcp-0.2.0/docs/servers/gtm-operations.md +64 -0
  37. measure_analytics_mcp-0.2.0/docs/servers/index.md +104 -0
  38. measure_analytics_mcp-0.2.0/docs/servers/server-side-auditor.md +66 -0
  39. measure_analytics_mcp-0.2.0/examples/README.md +56 -0
  40. measure_analytics_mcp-0.2.0/examples/claude_desktop_config.json +118 -0
  41. measure_analytics_mcp-0.2.0/examples/gemini_bridge.py +49 -0
  42. measure_analytics_mcp-0.2.0/examples/openai_bridge.py +53 -0
  43. measure_analytics_mcp-0.2.0/examples/serve_http.py +26 -0
  44. measure_analytics_mcp-0.2.0/mkdocs.yml +72 -0
  45. measure_analytics_mcp-0.2.0/pyproject.toml +135 -0
  46. measure_analytics_mcp-0.2.0/src/measure_alerts/__init__.py +5 -0
  47. measure_analytics_mcp-0.2.0/src/measure_alerts/__main__.py +15 -0
  48. measure_analytics_mcp-0.2.0/src/measure_alerts/config.py +22 -0
  49. measure_analytics_mcp-0.2.0/src/measure_alerts/db.py +88 -0
  50. measure_analytics_mcp-0.2.0/src/measure_alerts/evaluator.py +61 -0
  51. measure_analytics_mcp-0.2.0/src/measure_alerts/notifier.py +96 -0
  52. measure_analytics_mcp-0.2.0/src/measure_alerts/py.typed +0 -0
  53. measure_analytics_mcp-0.2.0/src/measure_alerts/repository.py +117 -0
  54. measure_analytics_mcp-0.2.0/src/measure_alerts/schemas.py +48 -0
  55. measure_analytics_mcp-0.2.0/src/measure_alerts/server.py +151 -0
  56. measure_analytics_mcp-0.2.0/src/measure_alerts/service.py +114 -0
  57. measure_analytics_mcp-0.2.0/src/measure_bigquery/__init__.py +5 -0
  58. measure_analytics_mcp-0.2.0/src/measure_bigquery/__main__.py +19 -0
  59. measure_analytics_mcp-0.2.0/src/measure_bigquery/config.py +69 -0
  60. measure_analytics_mcp-0.2.0/src/measure_bigquery/cost.py +14 -0
  61. measure_analytics_mcp-0.2.0/src/measure_bigquery/py.typed +0 -0
  62. measure_analytics_mcp-0.2.0/src/measure_bigquery/server.py +162 -0
  63. measure_analytics_mcp-0.2.0/src/measure_bigquery/service.py +333 -0
  64. measure_analytics_mcp-0.2.0/src/measure_bigquery/sql.py +112 -0
  65. measure_analytics_mcp-0.2.0/src/measure_consent/__init__.py +5 -0
  66. measure_analytics_mcp-0.2.0/src/measure_consent/__main__.py +15 -0
  67. measure_analytics_mcp-0.2.0/src/measure_consent/config.py +20 -0
  68. measure_analytics_mcp-0.2.0/src/measure_consent/gtm_source.py +61 -0
  69. measure_analytics_mcp-0.2.0/src/measure_consent/models.py +117 -0
  70. measure_analytics_mcp-0.2.0/src/measure_consent/parser.py +66 -0
  71. measure_analytics_mcp-0.2.0/src/measure_consent/py.typed +0 -0
  72. measure_analytics_mcp-0.2.0/src/measure_consent/rules.py +194 -0
  73. measure_analytics_mcp-0.2.0/src/measure_consent/server.py +130 -0
  74. measure_analytics_mcp-0.2.0/src/measure_consent/service.py +108 -0
  75. measure_analytics_mcp-0.2.0/src/measure_dataquality/__init__.py +5 -0
  76. measure_analytics_mcp-0.2.0/src/measure_dataquality/__main__.py +15 -0
  77. measure_analytics_mcp-0.2.0/src/measure_dataquality/analysis.py +159 -0
  78. measure_analytics_mcp-0.2.0/src/measure_dataquality/config.py +56 -0
  79. measure_analytics_mcp-0.2.0/src/measure_dataquality/py.typed +0 -0
  80. measure_analytics_mcp-0.2.0/src/measure_dataquality/server.py +111 -0
  81. measure_analytics_mcp-0.2.0/src/measure_dataquality/service.py +180 -0
  82. measure_analytics_mcp-0.2.0/src/measure_dataquality/sql.py +120 -0
  83. measure_analytics_mcp-0.2.0/src/measure_ga4/__init__.py +5 -0
  84. measure_analytics_mcp-0.2.0/src/measure_ga4/__main__.py +15 -0
  85. measure_analytics_mcp-0.2.0/src/measure_ga4/config.py +57 -0
  86. measure_analytics_mcp-0.2.0/src/measure_ga4/naming.py +80 -0
  87. measure_analytics_mcp-0.2.0/src/measure_ga4/py.typed +0 -0
  88. measure_analytics_mcp-0.2.0/src/measure_ga4/rules.py +75 -0
  89. measure_analytics_mcp-0.2.0/src/measure_ga4/server.py +135 -0
  90. measure_analytics_mcp-0.2.0/src/measure_ga4/service.py +362 -0
  91. measure_analytics_mcp-0.2.0/src/measure_gtm/__init__.py +5 -0
  92. measure_analytics_mcp-0.2.0/src/measure_gtm/__main__.py +15 -0
  93. measure_analytics_mcp-0.2.0/src/measure_gtm/audit.py +105 -0
  94. measure_analytics_mcp-0.2.0/src/measure_gtm/changes.py +94 -0
  95. measure_analytics_mcp-0.2.0/src/measure_gtm/config.py +14 -0
  96. measure_analytics_mcp-0.2.0/src/measure_gtm/gtm_api.py +122 -0
  97. measure_analytics_mcp-0.2.0/src/measure_gtm/models.py +68 -0
  98. measure_analytics_mcp-0.2.0/src/measure_gtm/naming.py +36 -0
  99. measure_analytics_mcp-0.2.0/src/measure_gtm/parser.py +76 -0
  100. measure_analytics_mcp-0.2.0/src/measure_gtm/py.typed +0 -0
  101. measure_analytics_mcp-0.2.0/src/measure_gtm/server.py +225 -0
  102. measure_analytics_mcp-0.2.0/src/measure_gtm/service.py +213 -0
  103. measure_analytics_mcp-0.2.0/src/measure_sgtm/__init__.py +5 -0
  104. measure_analytics_mcp-0.2.0/src/measure_sgtm/__main__.py +15 -0
  105. measure_analytics_mcp-0.2.0/src/measure_sgtm/config.py +47 -0
  106. measure_analytics_mcp-0.2.0/src/measure_sgtm/container_audit.py +147 -0
  107. measure_analytics_mcp-0.2.0/src/measure_sgtm/infra.py +167 -0
  108. measure_analytics_mcp-0.2.0/src/measure_sgtm/models.py +85 -0
  109. measure_analytics_mcp-0.2.0/src/measure_sgtm/net.py +122 -0
  110. measure_analytics_mcp-0.2.0/src/measure_sgtm/parser.py +66 -0
  111. measure_analytics_mcp-0.2.0/src/measure_sgtm/py.typed +0 -0
  112. measure_analytics_mcp-0.2.0/src/measure_sgtm/server.py +152 -0
  113. measure_analytics_mcp-0.2.0/src/measure_sgtm/service.py +112 -0
  114. measure_analytics_mcp-0.2.0/tests/alerts/test_alerts_service.py +93 -0
  115. measure_analytics_mcp-0.2.0/tests/alerts/test_evaluator.py +44 -0
  116. measure_analytics_mcp-0.2.0/tests/alerts/test_repository.py +78 -0
  117. measure_analytics_mcp-0.2.0/tests/bigquery/test_cost.py +32 -0
  118. measure_analytics_mcp-0.2.0/tests/bigquery/test_service.py +129 -0
  119. measure_analytics_mcp-0.2.0/tests/bigquery/test_sql.py +70 -0
  120. measure_analytics_mcp-0.2.0/tests/consent/conftest.py +98 -0
  121. measure_analytics_mcp-0.2.0/tests/consent/test_consent_audits.py +63 -0
  122. measure_analytics_mcp-0.2.0/tests/consent/test_consent_rules.py +119 -0
  123. measure_analytics_mcp-0.2.0/tests/consent/test_parser.py +45 -0
  124. measure_analytics_mcp-0.2.0/tests/dataquality/test_dq_analysis.py +71 -0
  125. measure_analytics_mcp-0.2.0/tests/dataquality/test_dq_service.py +102 -0
  126. measure_analytics_mcp-0.2.0/tests/dataquality/test_dq_sql.py +65 -0
  127. measure_analytics_mcp-0.2.0/tests/ga4/test_audits.py +125 -0
  128. measure_analytics_mcp-0.2.0/tests/ga4/test_naming.py +44 -0
  129. measure_analytics_mcp-0.2.0/tests/ga4/test_rules.py +35 -0
  130. measure_analytics_mcp-0.2.0/tests/gtm/conftest.py +60 -0
  131. measure_analytics_mcp-0.2.0/tests/gtm/test_gtm_audit.py +60 -0
  132. measure_analytics_mcp-0.2.0/tests/gtm/test_gtm_changes.py +56 -0
  133. measure_analytics_mcp-0.2.0/tests/gtm/test_gtm_service.py +135 -0
  134. measure_analytics_mcp-0.2.0/tests/sgtm/conftest.py +47 -0
  135. measure_analytics_mcp-0.2.0/tests/sgtm/test_sgtm_container.py +72 -0
  136. measure_analytics_mcp-0.2.0/tests/sgtm/test_sgtm_infra.py +75 -0
  137. measure_analytics_mcp-0.2.0/tests/sgtm/test_sgtm_service.py +84 -0
@@ -0,0 +1,27 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ quality:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - name: Install uv
15
+ uses: astral-sh/setup-uv@v3
16
+ - name: Set up Python
17
+ run: uv python install 3.12
18
+ - name: Sync (resolves measure-sdk from PyPI)
19
+ run: uv sync --all-extras
20
+ - name: Ruff (lint)
21
+ run: uv run ruff check .
22
+ - name: Ruff (format)
23
+ run: uv run ruff format --check .
24
+ - name: MyPy (strict)
25
+ run: uv run mypy .
26
+ - name: Pytest
27
+ run: uv run pytest -ra
@@ -0,0 +1,23 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+ workflow_dispatch: {} # allow manual publish of the current version
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write # OIDC token for PyPI Trusted Publishing (no API token stored)
11
+
12
+ jobs:
13
+ pypi-publish:
14
+ runs-on: ubuntu-latest
15
+ environment: pypi # create a matching GitHub environment + PyPI Trusted Publisher
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - name: Install uv
19
+ uses: astral-sh/setup-uv@v3
20
+ - name: Build sdist + wheel
21
+ run: uv build
22
+ - name: Publish to PyPI (Trusted Publishing)
23
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,47 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+ .python-version
11
+
12
+ # uv
13
+ uv.lock.bak
14
+
15
+ # Testing / coverage
16
+ .pytest_cache/
17
+ .mypy_cache/
18
+ .ruff_cache/
19
+ .coverage
20
+ .coverage.*
21
+ coverage.xml
22
+ htmlcov/
23
+
24
+ # Secrets & credentials — NEVER commit these
25
+ .env
26
+ .env.*
27
+ !.env.example
28
+ *.json.key
29
+ service-account*.json
30
+ client_secret*.json
31
+ credentials/
32
+ .secrets/
33
+ token.json
34
+ *.pem
35
+
36
+ # Local alert database (Alerts Engine)
37
+ .measure/
38
+ *.db
39
+
40
+ # Docs build
41
+ site/
42
+
43
+ # IDE / OS
44
+ .idea/
45
+ .vscode/
46
+ .DS_Store
47
+ *.swp
@@ -0,0 +1,53 @@
1
+ # Changelog
2
+
3
+ All notable changes to **measure-analytics-mcp** are documented here.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.2.0] — 2026-07-07
9
+
10
+ ### Changed
11
+
12
+ - **Consolidated into a single installable package.** The repo was a `uv`
13
+ workspace of seven sub-packages (`measure-ga4-intelligence`,
14
+ `measure-bigquery-analyst`, …) that were never published to PyPI, so
15
+ `pip install measure-analytics-mcp` could not resolve them. All seven servers
16
+ now ship from one wheel: their code moved from `apps/*/src/` to `src/`, tests
17
+ to `tests/<domain>/`, and a single `pyproject.toml` exposes the seven console
18
+ scripts (`measure-ga4`, `measure-gtm`, `measure-bigquery`, `measure-consent`,
19
+ `measure-sgtm`, `measure-dataquality`, `measure-alerts`). The only external
20
+ dependency remains `measure-sdk`. No server behaviour or import paths changed.
21
+
22
+ ## [0.1.1] — 2026-06-29
23
+
24
+ ### Changed
25
+
26
+ - Pin `measure-sdk` v0.1.4 — ships the bundled default OAuth client, so users
27
+ can `pip install` and log in (`measure_login`) with no Google Cloud setup.
28
+
29
+ ## [0.1.0] — 2026-06-26
30
+
31
+ First release as an independent product of the
32
+ [Measure MCP ecosystem](https://github.com/measure-mcp), built on
33
+ `measure-sdk>=0.1,<0.2`.
34
+
35
+ ### Added
36
+
37
+ - Seven focused MCP servers, each consuming the shared SDK:
38
+ **BigQuery Analyst** (cost-aware read-only SQL), **GA4 Intelligence**
39
+ (Admin + Data audits), **Consent Mode Auditor** (Consent Mode v2), **Data
40
+ Quality** (GA4-export health), **GTM Operations** (web audits + guarded
41
+ writes), **Server-Side Auditor** (sGTM + Cloud Run health), and the persistent
42
+ **Alerts Engine**.
43
+
44
+ ### Changed
45
+
46
+ - Extracted from the original `measure-analytics-mcp` monorepo: shared
47
+ infrastructure and domain models moved to the standalone `measure-sdk`; servers
48
+ now consume `measure_sdk` exclusively. Google Ads analysis moved to the sibling
49
+ **measure-paid-media-mcp**.
50
+
51
+ [0.2.0]: https://github.com/measure-mcp/measure-analytics-mcp/releases/tag/v0.2.0
52
+ [0.1.1]: https://github.com/measure-mcp/measure-analytics-mcp/releases/tag/v0.1.1
53
+ [0.1.0]: https://github.com/measure-mcp/measure-analytics-mcp/releases/tag/v0.1.0
@@ -0,0 +1,34 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors and leaders pledge to make participation in the
6
+ Measure AI community a harassment-free experience for everyone, regardless of
7
+ age, body size, visible or invisible disability, ethnicity, sex characteristics,
8
+ gender identity and expression, level of experience, education, socio-economic
9
+ status, nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behaviour that contributes to a positive environment:
15
+
16
+ - Demonstrating empathy and kindness toward other people
17
+ - Being respectful of differing opinions, viewpoints and experiences
18
+ - Giving and gracefully accepting constructive feedback
19
+
20
+ Examples of unacceptable behaviour:
21
+
22
+ - Trolling, insulting or derogatory comments, and personal attacks
23
+ - Public or private harassment
24
+ - Publishing others' private information without explicit permission
25
+
26
+ ## Enforcement
27
+
28
+ Instances of abusive, harassing or otherwise unacceptable behaviour may be
29
+ reported to the maintainers via a private GitHub security advisory or the
30
+ contact in [SECURITY.md](SECURITY.md). All complaints will be reviewed and
31
+ investigated promptly and fairly.
32
+
33
+ This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org),
34
+ version 2.1.
@@ -0,0 +1,41 @@
1
+ # Contributing
2
+
3
+ Thanks for helping build Measure Analytics MCP! 🎉
4
+
5
+ ## Setup
6
+
7
+ ```bash
8
+ uv sync --all-extras --dev
9
+ ```
10
+
11
+ ## Before you push
12
+
13
+ ```bash
14
+ uv run ruff check . && uv run ruff format --check .
15
+ uv run mypy packages apps
16
+ uv run pytest
17
+ ```
18
+
19
+ All four must pass; CI enforces them.
20
+
21
+ ## Adding a new MCP server
22
+
23
+ 1. Copy the structure of `src/measure_bigquery` (add a new `src/measure_<name>` package).
24
+ 2. Add a `<Name>Settings(CoreSettings)` in `config.py`.
25
+ 3. Put domain logic in `service.py` (no MCP imports — keep it unit-testable).
26
+ 4. Keep `server.py` thin: validate inputs, delegate, wrap with `tool_errors`.
27
+ 5. Default to read-only. Any write tool must go through the confirmation ritual
28
+ and call `ctx.audit.record(...)`.
29
+ 6. Add tests under `tests/` and a docs page under `docs/servers/`.
30
+
31
+ ## Conventions
32
+
33
+ - Python 3.12+, full type hints, `from __future__ import annotations`.
34
+ - Public functions/classes have docstrings.
35
+ - No credentials, tokens, or secrets in code, logs, or tests.
36
+ - Conventional-commit style messages are appreciated.
37
+
38
+ ## Code of conduct
39
+
40
+ Be kind and constructive. By participating you agree to uphold a welcoming,
41
+ harassment-free environment.
@@ -0,0 +1,20 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Measure Analytics MCP contributors
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
19
+ The full text of the Apache License 2.0 is available at the URL above and
20
+ should be vendored into this file before the first public release.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: measure-analytics-mcp
3
+ Version: 0.2.0
4
+ Summary: AI-powered Measurement Operations for the Google analytics stack (GA4, GTM, BigQuery, Consent Mode, Server-Side, Data Quality, Alerts), over the Model Context Protocol.
5
+ Project-URL: Homepage, https://github.com/measure-mcp/measure-analytics-mcp
6
+ Project-URL: Repository, https://github.com/measure-mcp/measure-analytics-mcp
7
+ Author: Measure AI contributors
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: bigquery,consent-mode,ga4,google-tag-manager,mcp,measureops,model-context-protocol
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: google-analytics-admin>=0.22.0
13
+ Requires-Dist: google-analytics-data>=0.18.0
14
+ Requires-Dist: google-api-python-client>=2.100.0
15
+ Requires-Dist: google-cloud-bigquery>=3.25.0
16
+ Requires-Dist: measure-sdk<0.2,>=0.1
17
+ Requires-Dist: sqlalchemy>=2.0.30
18
+ Requires-Dist: sqlglot>=25.0.0
19
+ Provides-Extra: dev
20
+ Requires-Dist: mypy>=1.11.0; extra == 'dev'
21
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
22
+ Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
23
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
24
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
25
+ Requires-Dist: types-requests; extra == 'dev'
26
+ Provides-Extra: docs
27
+ Requires-Dist: mkdocs-material>=9.5.0; extra == 'docs'
28
+ Requires-Dist: mkdocs>=1.6.0; extra == 'docs'
29
+ Requires-Dist: mkdocstrings[python]>=0.26.0; extra == 'docs'
30
+ Description-Content-Type: text/markdown
31
+
32
+ <div align="center">
33
+
34
+ # 📊 Measure Analytics MCP
35
+
36
+ **AI-powered Measurement Operations for the Google analytics stack, over the
37
+ [Model Context Protocol](https://modelcontextprotocol.io).**
38
+
39
+ A product of the [Measure MCP ecosystem](https://github.com/measure-mcp) ·
40
+ built on **[measure-sdk](https://github.com/measure-mcp/measure-sdk)**.
41
+
42
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
43
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue.svg)](pyproject.toml)
44
+ [![SDK](https://img.shields.io/badge/measure--sdk-%3E%3D0.1%2C%3C0.2-blue.svg)](https://github.com/measure-mcp/measure-sdk)
45
+
46
+ </div>
47
+
48
+ ---
49
+
50
+ ## What it is
51
+
52
+ Audit, analyse and monitor your Google analytics stack in natural language, from
53
+ Claude Desktop, ChatGPT or any MCP client. Seven focused MCP servers, each
54
+ consuming the shared **measure-sdk** (domain models, Health Score, OAuth, …):
55
+
56
+ | Server | Run with | Domain |
57
+ | --- | --- | --- |
58
+ | **BigQuery Analyst** | `measure-bigquery` | Cost-aware, read-only SQL. |
59
+ | **GA4 Intelligence** | `measure-ga4` | GA4 Admin + Data API audits. |
60
+ | **Consent Mode Auditor** | `measure-consent` | Consent Mode v2 compliance. |
61
+ | **Data Quality** | `measure-dataquality` | GA4-export health monitoring. |
62
+ | **GTM Operations** | `measure-gtm` | Web container audits + guarded writes. |
63
+ | **Server-Side Auditor** | `measure-sgtm` | sGTM config + Cloud Run health. |
64
+ | **Alerts Engine** | `measure-alerts` | Persistent cross-domain alerts. |
65
+
66
+ > Paid-media analysis (Google Ads, Meta, …) lives in the sibling product
67
+ > **[measure-paid-media-mcp](https://github.com/measure-mcp/measure-paid-media-mcp)**.
68
+
69
+ ## Install
70
+
71
+ ```bash
72
+ pip install measure-analytics-mcp # pulls measure-sdk automatically
73
+ measure login # Google OAuth — that's all you need
74
+ measure doctor # see what's connected
75
+ measure-bigquery # start a server (stdio)
76
+ ```
77
+
78
+ `measure login` (from the SDK) caches an OAuth token locally; every server then
79
+ works with **no `.env`** and no manual IDs. ADC / service accounts still work as a
80
+ fallback. Read-only by default; writes require explicit confirmation.
81
+
82
+ ## Develop
83
+
84
+ ```bash
85
+ git clone https://github.com/measure-mcp/measure-analytics-mcp.git
86
+ cd measure-analytics-mcp
87
+ uv sync --all-extras # resolves measure-sdk from its pinned tag
88
+ uv run ruff check . && uv run mypy . && uv run pytest
89
+ ```
90
+
91
+ This repo is a **single installable package** (`measure-analytics-mcp`) that
92
+ ships seven focused MCP servers under `src/` (`measure_ga4`, `measure_gtm`,
93
+ `measure_bigquery`, `measure_consent`, `measure_sgtm`, `measure_dataquality`,
94
+ `measure_alerts`). It depends only on **measure-sdk**.
95
+
96
+ ## Ecosystem
97
+
98
+ | | |
99
+ | --- | --- |
100
+ | **measure-sdk** | Shared core: domain models, enums, Health Score, infra. |
101
+ | **measure-analytics-mcp** | This product. |
102
+ | **measure-paid-media-mcp** | Google Ads, Meta, LinkedIn, TikTok, CM360. |
103
+
104
+ See **[CHANGELOG.md](CHANGELOG.md)** · **[ROADMAP.md](ROADMAP.md)** ·
105
+ **[SECURITY.md](SECURITY.md)** · **[CONTRIBUTING.md](CONTRIBUTING.md)**.
106
+
107
+ ## License
108
+
109
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,78 @@
1
+ <div align="center">
2
+
3
+ # 📊 Measure Analytics MCP
4
+
5
+ **AI-powered Measurement Operations for the Google analytics stack, over the
6
+ [Model Context Protocol](https://modelcontextprotocol.io).**
7
+
8
+ A product of the [Measure MCP ecosystem](https://github.com/measure-mcp) ·
9
+ built on **[measure-sdk](https://github.com/measure-mcp/measure-sdk)**.
10
+
11
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
12
+ [![Python](https://img.shields.io/badge/python-3.12%2B-blue.svg)](pyproject.toml)
13
+ [![SDK](https://img.shields.io/badge/measure--sdk-%3E%3D0.1%2C%3C0.2-blue.svg)](https://github.com/measure-mcp/measure-sdk)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## What it is
20
+
21
+ Audit, analyse and monitor your Google analytics stack in natural language, from
22
+ Claude Desktop, ChatGPT or any MCP client. Seven focused MCP servers, each
23
+ consuming the shared **measure-sdk** (domain models, Health Score, OAuth, …):
24
+
25
+ | Server | Run with | Domain |
26
+ | --- | --- | --- |
27
+ | **BigQuery Analyst** | `measure-bigquery` | Cost-aware, read-only SQL. |
28
+ | **GA4 Intelligence** | `measure-ga4` | GA4 Admin + Data API audits. |
29
+ | **Consent Mode Auditor** | `measure-consent` | Consent Mode v2 compliance. |
30
+ | **Data Quality** | `measure-dataquality` | GA4-export health monitoring. |
31
+ | **GTM Operations** | `measure-gtm` | Web container audits + guarded writes. |
32
+ | **Server-Side Auditor** | `measure-sgtm` | sGTM config + Cloud Run health. |
33
+ | **Alerts Engine** | `measure-alerts` | Persistent cross-domain alerts. |
34
+
35
+ > Paid-media analysis (Google Ads, Meta, …) lives in the sibling product
36
+ > **[measure-paid-media-mcp](https://github.com/measure-mcp/measure-paid-media-mcp)**.
37
+
38
+ ## Install
39
+
40
+ ```bash
41
+ pip install measure-analytics-mcp # pulls measure-sdk automatically
42
+ measure login # Google OAuth — that's all you need
43
+ measure doctor # see what's connected
44
+ measure-bigquery # start a server (stdio)
45
+ ```
46
+
47
+ `measure login` (from the SDK) caches an OAuth token locally; every server then
48
+ works with **no `.env`** and no manual IDs. ADC / service accounts still work as a
49
+ fallback. Read-only by default; writes require explicit confirmation.
50
+
51
+ ## Develop
52
+
53
+ ```bash
54
+ git clone https://github.com/measure-mcp/measure-analytics-mcp.git
55
+ cd measure-analytics-mcp
56
+ uv sync --all-extras # resolves measure-sdk from its pinned tag
57
+ uv run ruff check . && uv run mypy . && uv run pytest
58
+ ```
59
+
60
+ This repo is a **single installable package** (`measure-analytics-mcp`) that
61
+ ships seven focused MCP servers under `src/` (`measure_ga4`, `measure_gtm`,
62
+ `measure_bigquery`, `measure_consent`, `measure_sgtm`, `measure_dataquality`,
63
+ `measure_alerts`). It depends only on **measure-sdk**.
64
+
65
+ ## Ecosystem
66
+
67
+ | | |
68
+ | --- | --- |
69
+ | **measure-sdk** | Shared core: domain models, enums, Health Score, infra. |
70
+ | **measure-analytics-mcp** | This product. |
71
+ | **measure-paid-media-mcp** | Google Ads, Meta, LinkedIn, TikTok, CM360. |
72
+
73
+ See **[CHANGELOG.md](CHANGELOG.md)** · **[ROADMAP.md](ROADMAP.md)** ·
74
+ **[SECURITY.md](SECURITY.md)** · **[CONTRIBUTING.md](CONTRIBUTING.md)**.
75
+
76
+ ## License
77
+
78
+ [Apache-2.0](LICENSE).
@@ -0,0 +1,26 @@
1
+ # Roadmap — measure-analytics-mcp
2
+
3
+ This product covers the **Google analytics stack**. It depends only on
4
+ `measure-sdk` and never on other MCPs.
5
+
6
+ ## Now (0.1.x)
7
+
8
+ - Seven servers: BigQuery, GA4, Consent Mode, Data Quality, GTM, Server-Side,
9
+ Alerts Engine.
10
+
11
+ ## Next
12
+
13
+ - Surface a per-property **Health Score** (from `measure_sdk`) in `audit_*` tools
14
+ so analytics health is comparable with paid-media health.
15
+ - CMP adapters for Consent Mode (OneTrust, Cookiebot, Didomi, Usercentrics).
16
+ - Publish to PyPI (`pip install measure-analytics-mcp`).
17
+ - Hosted mode with remote transport (SSE/HTTP).
18
+
19
+ ## Compatibility
20
+
21
+ | measure-analytics-mcp | requires measure-sdk |
22
+ | --- | --- |
23
+ | 0.1.x | `>=0.1,<0.2` |
24
+
25
+ When `measure-sdk` ships a breaking (major) change, this product bumps its own
26
+ minor/major and updates the table.
@@ -0,0 +1,19 @@
1
+ # Security Policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Please **do not** open a public issue for security problems. Instead, open a
6
+ private security advisory on the repository (GitHub → Security → Advisories), or
7
+ email the maintainers listed in `pyproject.toml`.
8
+
9
+ We aim to acknowledge reports within 72 hours.
10
+
11
+ ## Scope & guarantees
12
+
13
+ - Credentials are resolved at runtime and held only in memory. The platform
14
+ never writes them to disk, logs them, or transmits them anywhere except to
15
+ Google APIs.
16
+ - Servers default to `read_only` mode. Writes require an explicit confirmation.
17
+ - Every privileged action is recorded by the audit log.
18
+
19
+ See [docs/security.md](docs/security.md) for the full model.
@@ -0,0 +1,39 @@
1
+ # syntax=docker/dockerfile:1
2
+ # ---------------------------------------------------------------------------
3
+ # alerts-engine MCP server image.
4
+ # Built from the repo root:
5
+ # docker build -f docker/alerts-engine.Dockerfile -t measure/alerts-engine .
6
+ # ---------------------------------------------------------------------------
7
+ FROM python:3.12-slim AS builder
8
+
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
10
+
11
+ ENV UV_COMPILE_BYTECODE=1 \
12
+ UV_LINK_MODE=copy \
13
+ UV_PYTHON_DOWNLOADS=never
14
+
15
+ WORKDIR /app
16
+
17
+ # measure-analytics-mcp is a single package shipping all seven servers.
18
+ COPY pyproject.toml uv.lock* README.md ./
19
+ COPY src src
20
+ RUN --mount=type=cache,target=/root/.cache/uv \
21
+ uv sync --frozen --no-dev || uv sync --no-dev
22
+
23
+ # ---------------------------------------------------------------------------
24
+ FROM python:3.12-slim AS runtime
25
+
26
+ RUN useradd --create-home --uid 10001 measure
27
+ WORKDIR /app
28
+
29
+ COPY --from=builder /app/.venv /app/.venv
30
+ COPY --from=builder /app/src /app/src
31
+
32
+ ENV PATH="/app/.venv/bin:$PATH" \
33
+ PYTHONUNBUFFERED=1 \
34
+ MEASURE_PERMISSION_MODE=read_only \
35
+ MEASURE_LOG_FORMAT=json
36
+
37
+ USER measure
38
+
39
+ ENTRYPOINT ["python", "-m", "measure_alerts"]
@@ -0,0 +1,39 @@
1
+ # syntax=docker/dockerfile:1
2
+ # ---------------------------------------------------------------------------
3
+ # bigquery-analyst MCP server image.
4
+ # Built from the repo root:
5
+ # docker build -f docker/bigquery-analyst.Dockerfile -t measure/bigquery-analyst .
6
+ # ---------------------------------------------------------------------------
7
+ FROM python:3.12-slim AS builder
8
+
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
10
+
11
+ ENV UV_COMPILE_BYTECODE=1 \
12
+ UV_LINK_MODE=copy \
13
+ UV_PYTHON_DOWNLOADS=never
14
+
15
+ WORKDIR /app
16
+
17
+ # measure-analytics-mcp is a single package shipping all seven servers.
18
+ COPY pyproject.toml uv.lock* README.md ./
19
+ COPY src src
20
+ RUN --mount=type=cache,target=/root/.cache/uv \
21
+ uv sync --frozen --no-dev || uv sync --no-dev
22
+
23
+ # ---------------------------------------------------------------------------
24
+ FROM python:3.12-slim AS runtime
25
+
26
+ RUN useradd --create-home --uid 10001 measure
27
+ WORKDIR /app
28
+
29
+ COPY --from=builder /app/.venv /app/.venv
30
+ COPY --from=builder /app/src /app/src
31
+
32
+ ENV PATH="/app/.venv/bin:$PATH" \
33
+ PYTHONUNBUFFERED=1 \
34
+ MEASURE_PERMISSION_MODE=read_only \
35
+ MEASURE_LOG_FORMAT=json
36
+
37
+ USER measure
38
+
39
+ ENTRYPOINT ["python", "-m", "measure_bigquery"]
@@ -0,0 +1,39 @@
1
+ # syntax=docker/dockerfile:1
2
+ # ---------------------------------------------------------------------------
3
+ # consent-mode-auditor MCP server image.
4
+ # Built from the repo root:
5
+ # docker build -f docker/consent-mode-auditor.Dockerfile -t measure/consent-mode-auditor .
6
+ # ---------------------------------------------------------------------------
7
+ FROM python:3.12-slim AS builder
8
+
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
10
+
11
+ ENV UV_COMPILE_BYTECODE=1 \
12
+ UV_LINK_MODE=copy \
13
+ UV_PYTHON_DOWNLOADS=never
14
+
15
+ WORKDIR /app
16
+
17
+ # measure-analytics-mcp is a single package shipping all seven servers.
18
+ COPY pyproject.toml uv.lock* README.md ./
19
+ COPY src src
20
+ RUN --mount=type=cache,target=/root/.cache/uv \
21
+ uv sync --frozen --no-dev || uv sync --no-dev
22
+
23
+ # ---------------------------------------------------------------------------
24
+ FROM python:3.12-slim AS runtime
25
+
26
+ RUN useradd --create-home --uid 10001 measure
27
+ WORKDIR /app
28
+
29
+ COPY --from=builder /app/.venv /app/.venv
30
+ COPY --from=builder /app/src /app/src
31
+
32
+ ENV PATH="/app/.venv/bin:$PATH" \
33
+ PYTHONUNBUFFERED=1 \
34
+ MEASURE_PERMISSION_MODE=read_only \
35
+ MEASURE_LOG_FORMAT=json
36
+
37
+ USER measure
38
+
39
+ ENTRYPOINT ["python", "-m", "measure_consent"]
@@ -0,0 +1,39 @@
1
+ # syntax=docker/dockerfile:1
2
+ # ---------------------------------------------------------------------------
3
+ # data-quality MCP server image.
4
+ # Built from the repo root:
5
+ # docker build -f docker/data-quality.Dockerfile -t measure/data-quality .
6
+ # ---------------------------------------------------------------------------
7
+ FROM python:3.12-slim AS builder
8
+
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
10
+
11
+ ENV UV_COMPILE_BYTECODE=1 \
12
+ UV_LINK_MODE=copy \
13
+ UV_PYTHON_DOWNLOADS=never
14
+
15
+ WORKDIR /app
16
+
17
+ # measure-analytics-mcp is a single package shipping all seven servers.
18
+ COPY pyproject.toml uv.lock* README.md ./
19
+ COPY src src
20
+ RUN --mount=type=cache,target=/root/.cache/uv \
21
+ uv sync --frozen --no-dev || uv sync --no-dev
22
+
23
+ # ---------------------------------------------------------------------------
24
+ FROM python:3.12-slim AS runtime
25
+
26
+ RUN useradd --create-home --uid 10001 measure
27
+ WORKDIR /app
28
+
29
+ COPY --from=builder /app/.venv /app/.venv
30
+ COPY --from=builder /app/src /app/src
31
+
32
+ ENV PATH="/app/.venv/bin:$PATH" \
33
+ PYTHONUNBUFFERED=1 \
34
+ MEASURE_PERMISSION_MODE=read_only \
35
+ MEASURE_LOG_FORMAT=json
36
+
37
+ USER measure
38
+
39
+ ENTRYPOINT ["python", "-m", "measure_dataquality"]