focus-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.
@@ -0,0 +1,77 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ dist/
9
+ *.egg-info/
10
+ *.egg
11
+
12
+ # Virtual Environments
13
+ .env
14
+ .venv
15
+ env/
16
+ venv/
17
+ ENV/
18
+ .python-version
19
+
20
+ # UV Package Manager
21
+ .uv/
22
+ uv.lock.bak
23
+
24
+ # Testing
25
+ .pytest_cache/
26
+ .coverage
27
+ .coverage.*
28
+ htmlcov/
29
+ *.cover
30
+
31
+ # IDEs and Editors
32
+ .vscode/
33
+ .idea/
34
+ *.swp
35
+ *.swo
36
+ *~
37
+ .DS_Store
38
+
39
+ # Data Files
40
+ data/focus-export/
41
+ *.parquet
42
+ *.csv
43
+ *.json.gz
44
+
45
+ # Temporary Files
46
+ *.tmp
47
+ *.bak
48
+ *.backup
49
+ *.log
50
+
51
+ # Database
52
+ *.db
53
+ *.sqlite
54
+ *.sqlite3
55
+ *.duckdb
56
+ *.duckdb.wal
57
+
58
+ # MCP Server
59
+ mcp_cache/
60
+ .mcp/
61
+ mcp_logs/
62
+
63
+ # Ruff
64
+ .ruff_cache/
65
+
66
+ # MyPy
67
+ .mypy_cache/
68
+ .dmypy.json
69
+ dmypy.json
70
+
71
+ # Local MCP config
72
+ .mcp.json
73
+
74
+ # Scripts folder (exclude contents but keep folder)
75
+ scripts/*
76
+ !scripts/.keep
77
+ !scripts/verify_package.py
@@ -0,0 +1,175 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
@@ -0,0 +1,412 @@
1
+ Metadata-Version: 2.4
2
+ Name: focus-mcp
3
+ Version: 0.2.0
4
+ Summary: MCP server for querying FOCUS cloud billing data with DuckDB
5
+ Project-URL: Homepage, https://github.com/glassity/focus-mcp
6
+ Project-URL: Repository, https://github.com/glassity/focus-mcp
7
+ Project-URL: Issues, https://github.com/glassity/focus-mcp/issues
8
+ Author: Glassity
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: billing,cloud-cost,duckdb,finops,focus,mcp
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Office/Business :: Financial
21
+ Classifier: Topic :: System :: Systems Administration
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: duckdb<2,>=1.3.2
24
+ Requires-Dist: mcp[cli]<2,>=1.13.1
25
+ Requires-Dist: packaging>=24.0
26
+ Requires-Dist: pandas<3,>=2.3.2
27
+ Requires-Dist: pydantic<3,>=2
28
+ Requires-Dist: pyyaml<7,>=6.0.0
29
+ Provides-Extra: gcs
30
+ Requires-Dist: gcsfs>=2024.6.0; extra == 'gcs'
31
+ Description-Content-Type: text/markdown
32
+
33
+ <p align="center">
34
+ <a href="https://glassity.cloud">
35
+ <picture>
36
+ <source media="(prefers-color-scheme: dark)" srcset=".github/assets/logo-dark-mode.svg">
37
+ <img src=".github/assets/logo-light-mode.svg" alt="Glassity" width="320">
38
+ </picture>
39
+ </a>
40
+ </p>
41
+
42
+ <p align="center">
43
+ <a href="https://github.com/glassity/focus-mcp/actions/workflows/docker-publish.yml"><img src="https://github.com/glassity/focus-mcp/actions/workflows/docker-publish.yml/badge.svg" alt="Docker build"></a>
44
+ <a href="https://hub.docker.com/r/glassity/focus-mcp"><img src="https://img.shields.io/docker/pulls/glassity/focus-mcp?color=0EA0BE" alt="Docker pulls"></a>
45
+ <a href="https://pypi.org/project/focus-mcp/"><img src="https://img.shields.io/pypi/v/focus-mcp?color=0EA0BE" alt="PyPI version"></a>
46
+ <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue.svg" alt="Python 3.11+"></a>
47
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-1E1839" alt="License: Apache-2.0"></a>
48
+ </p>
49
+
50
+ <p align="center">
51
+ <a href="https://focus.finops.org/"><img src="https://img.shields.io/badge/FOCUS%20v1.0-36%20queries-blue.svg" alt="FOCUS v1.0: 36 queries"></a>
52
+ <a href="https://focus.finops.org/"><img src="https://img.shields.io/badge/FOCUS%20v1.1-41%20queries-green.svg" alt="FOCUS v1.1: 41 queries"></a>
53
+ <a href="https://focus.finops.org/"><img src="https://img.shields.io/badge/FOCUS%20v1.2-53%20queries-orange.svg" alt="FOCUS v1.2: 53 queries"></a>
54
+ </p>
55
+
56
+ # FOCUS MCP Server
57
+
58
+ Ask your AI assistant what your cloud actually costs. This MCP (Model Context
59
+ Protocol) server connects Claude, or any other MCP client, to your
60
+ [FOCUS](https://focus.finops.org/) billing data, so questions like these become
61
+ one-line prompts instead of hand-written SQL:
62
+
63
+ - *"What are my highest-cost services by region this month?"*
64
+ - *"Show me commitment discount utilization trends."*
65
+ - *"Which accounts have unusual spending patterns?"*
66
+ - *"Explain the difference between BilledCost and EffectiveCost."*
67
+
68
+ Under the hood, [DuckDB](https://duckdb.org/) queries your Parquet exports
69
+ directly, whether they sit on local disk, S3, or GCS. There is no data
70
+ warehouse to stand up. The server bundles 130 queries curated from the
71
+ official FOCUS use-case catalog (36 for v1.0, 41 for v1.1, 53 for v1.2), and
72
+ each query cites the page it came from.
73
+
74
+ ## What is FOCUS?
75
+
76
+ [FOCUS](https://focus.finops.org/) (FinOps Open Cost & Usage Specification) is
77
+ the open standard for cloud billing data. AWS, Microsoft, and Google Cloud
78
+ export it natively, so one schema and one set of queries work across
79
+ providers.
80
+
81
+ ## Quick start
82
+
83
+ ### 1. Get FOCUS data
84
+
85
+ Each provider has an official export path:
86
+
87
+ - AWS: [FOCUS setup guide for AWS](https://focus.finops.org/get-started/aws/) (Data Exports → FOCUS 1.0)
88
+ - Microsoft Azure: [FOCUS setup guide for Microsoft](https://focus.finops.org/get-started/microsoft/)
89
+ - Google Cloud: [FOCUS setup guide for Google Cloud](https://focus.finops.org/get-started/google-cloud/), or see [GCS + BigQuery](#google-cloud-gcs--bigquery-focus-export) below
90
+ - Other providers: [all FOCUS setup guides](https://focus.finops.org/get-started/)
91
+
92
+ The server reads Parquet with Hive partitioning:
93
+
94
+ ```
95
+ /path/to/your/focus/data/
96
+ ├── billing_period=2025-05/
97
+ │ ├── file1.parquet
98
+ │ └── file2.parquet
99
+ ├── billing_period=2025-06/
100
+ │ └── ...
101
+ ```
102
+
103
+ ### 2. Run the server
104
+
105
+ The quickest path needs no container. `uvx` fetches and runs the published
106
+ package in one step:
107
+
108
+ ```bash
109
+ claude mcp add focus -e FOCUS_DATA_LOCATION=/path/to/your/focus/data -- uvx focus-mcp
110
+ ```
111
+
112
+ For Claude Desktop, add this to `claude_desktop_config.json`:
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "focus": {
118
+ "command": "uvx",
119
+ "args": ["focus-mcp"],
120
+ "env": {
121
+ "FOCUS_DATA_LOCATION": "/path/to/your/focus/data",
122
+ "FOCUS_VERSION": "1.0"
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ Reading GCS with Application Default Credentials needs the `gcs` extra, which
130
+ uvx installs when you name it:
131
+
132
+ ```bash
133
+ claude mcp add focus -e FOCUS_DATA_LOCATION=gs://your-bucket/focus \
134
+ -- uvx --from 'focus-mcp[gcs]' focus-mcp
135
+ ```
136
+
137
+ Docker remains available and is the better fit when you want a pinned,
138
+ attested image:
139
+
140
+ Images are published to Docker Hub and GitHub Container Registry on every
141
+ release:
142
+
143
+ ```bash
144
+ docker pull glassity/focus-mcp:latest # Docker Hub
145
+ docker pull ghcr.io/glassity/focus-mcp:latest # GHCR
146
+ ```
147
+
148
+ For Claude Code, one command:
149
+
150
+ ```bash
151
+ claude mcp add focus -- docker run -i --rm \
152
+ -v /path/to/your/focus/data:/data:ro \
153
+ -e FOCUS_DATA_LOCATION=/data \
154
+ glassity/focus-mcp:latest
155
+ ```
156
+
157
+ For Claude Desktop, add this to `claude_desktop_config.json`:
158
+
159
+ ```json
160
+ {
161
+ "mcpServers": {
162
+ "focus": {
163
+ "command": "docker",
164
+ "args": [
165
+ "run", "-i", "--rm",
166
+ "-v", "/path/to/your/focus/data:/data:ro",
167
+ "-e", "FOCUS_DATA_LOCATION=/data",
168
+ "-e", "FOCUS_VERSION=1.0",
169
+ "glassity/focus-mcp:latest"
170
+ ]
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ For S3 or GCS data, drop the volume mount and point `FOCUS_DATA_LOCATION` at
177
+ the bucket. See [Data locations](#data-locations) for the credential options.
178
+
179
+ ### 3. Ask something
180
+
181
+ Start your client and try:
182
+
183
+ ```
184
+ Show me what FOCUS data is loaded.
185
+ ```
186
+
187
+ The assistant calls `get_data_info` and reports row counts, date ranges, and
188
+ providers. From there, ask in plain language:
189
+
190
+ ```
191
+ Run the service costs by region analysis for the last 3 months.
192
+ Show me the top 10 most expensive services across all accounts.
193
+ Find unused capacity reservations I can optimize.
194
+ Compare costs across providers and regions.
195
+ What columns are available in FOCUS v1.2?
196
+ ```
197
+
198
+ ## Tools
199
+
200
+ Eight tools, in two groups.
201
+
202
+ Data and query:
203
+
204
+ | Tool | What it does |
205
+ | --- | --- |
206
+ | `get_data_info` | Inspect the loaded data: row counts, date ranges, providers |
207
+ | `list_use_cases` | Browse the predefined analysis queries for your FOCUS version |
208
+ | `get_use_case` | One query in detail: SQL, parameters, citation to the spec |
209
+ | `execute_query` | Run a predefined query or custom SQL against your data |
210
+
211
+ Schema and specification:
212
+
213
+ | Tool | What it does |
214
+ | --- | --- |
215
+ | `list_columns` | All FOCUS columns with type and requirement level |
216
+ | `get_column_details` | Full definition of one column |
217
+ | `list_attributes` | FOCUS formatting standards and conventions |
218
+ | `get_attribute_details` | Full requirements of one attribute |
219
+
220
+ The schema tools answer from the FOCUS specification itself, so the assistant
221
+ can explain what a column means as well as query it.
222
+
223
+ ## Query library
224
+
225
+ Every query is extracted from the official
226
+ [FOCUS use-case catalog](https://focus.finops.org/use-cases/) and carries a
227
+ citation back to its source page:
228
+
229
+ - FOCUS v1.0: 36 queries
230
+ - FOCUS v1.1: 41 queries
231
+ - FOCUS v1.2: 53 queries
232
+
233
+ Coverage includes cost allocation, commitment discount tracking, anomaly
234
+ detection, budget reconciliation, and provider comparison. `FOCUS_VERSION`
235
+ selects which set is active.
236
+
237
+ ## Data locations
238
+
239
+ ### Local files
240
+
241
+ ```bash
242
+ export FOCUS_DATA_LOCATION="/path/to/your/focus/data"
243
+ ```
244
+
245
+ A downloaded copy of an AWS Data Export (`aws s3 sync`, a mounted volume)
246
+ is loaded through the manifests it was copied with, exactly as the bucket
247
+ itself would be — see below.
248
+
249
+ ### Amazon S3
250
+
251
+ ```bash
252
+ export FOCUS_DATA_LOCATION="s3://your-bucket/focus-exports"
253
+ export AWS_REGION="us-west-2" # defaults to us-east-1
254
+ ```
255
+
256
+ Point the location at the export root, the prefix holding both `data/` and
257
+ `metadata/`. AWS Data Exports list every file of their latest delivery in a
258
+ per-billing-period manifest under `metadata/`, and the server loads those
259
+ files when the manifests are there: superseded chunks and re-delivered
260
+ periods left behind on the prefix are ignored instead of double-counted.
261
+ Locations without manifests — a BigQuery export, a directory of Parquet
262
+ files — are read by globbing every Parquet file underneath them.
263
+ `get_data_info` reports which of the two was used, and the file list is
264
+ refreshed every few minutes so new deliveries need no restart.
265
+
266
+ Authentication uses the standard AWS credential chain, in order: IAM role
267
+ (automatic on EC2/ECS/Lambda), `AWS_ACCESS_KEY_ID`/`AWS_SECRET_ACCESS_KEY`
268
+ environment variables, `AWS_PROFILE`, then `~/.aws/credentials`.
269
+
270
+ ```bash
271
+ export AWS_PROFILE="billing-reader" # use a specific profile
272
+ ```
273
+
274
+ Some buckets store keys with a leading slash; if listing fails, try a double
275
+ slash after the bucket name: `s3://your-bucket//focus/path`.
276
+
277
+ When running in Docker, pass credentials as `-e` variables or mount the
278
+ profile read-only:
279
+
280
+ ```bash
281
+ docker run -i --rm \
282
+ -v "$HOME/.aws:/home/mcp/.aws:ro" \
283
+ -e FOCUS_DATA_LOCATION="s3://your-bucket/focus-exports" \
284
+ -e AWS_REGION="us-west-2" \
285
+ -e AWS_PROFILE="billing-reader" \
286
+ glassity/focus-mcp:latest
287
+ ```
288
+
289
+ ### Google Cloud (GCS + BigQuery FOCUS export)
290
+
291
+ Google Cloud exports billing natively in FOCUS format:
292
+ **Billing → Billing export → FOCUS usage cost** (Preview) writes a FOCUS table
293
+ to BigQuery. Export it to Parquet in a GCS bucket:
294
+
295
+ ```sql
296
+ EXPORT DATA OPTIONS (
297
+ uri = 'gs://your-bucket/focus-export/*.parquet',
298
+ format = 'PARQUET',
299
+ overwrite = true
300
+ ) AS
301
+ SELECT * FROM `your-project.your_focus_dataset.your_focus_table`;
302
+ ```
303
+
304
+ Schedule that statement as a BigQuery scheduled query to keep the bucket
305
+ fresh; this also archives your data past the FOCUS export's 2-year TTL. Then:
306
+
307
+ ```bash
308
+ export FOCUS_DATA_LOCATION="gs://your-bucket/focus-export"
309
+ ```
310
+
311
+ Authentication is tried in this order:
312
+
313
+ 1. HMAC keys: set `GCS_HMAC_KEY_ID` and `GCS_HMAC_SECRET` (create with
314
+ `gcloud storage hmac create <service-account-email>`). This path uses
315
+ DuckDB's native GCS support over the S3-interoperability API and needs no
316
+ extra dependencies.
317
+ 2. Application Default Credentials: included in the Docker image; from a
318
+ source checkout, install the extra with `uv sync --extra gcs`. Then
319
+ authenticate however you normally do: `gcloud auth application-default
320
+ login`, a service-account JSON via `GOOGLE_APPLICATION_CREDENTIALS`, or
321
+ workload identity on GCE/GKE.
322
+ 3. No credentials: public buckets only.
323
+
324
+ Two methods exist because DuckDB's built-in GCS support only speaks HMAC; ADC
325
+ comes from the optional `gcsfs` dependency. Credentials are only ever read
326
+ inside the server process and are never exposed to MCP clients.
327
+
328
+ ## Configuration
329
+
330
+ | Variable | Default | Description |
331
+ | --- | --- | --- |
332
+ | `FOCUS_DATA_LOCATION` | `data/focus-export` | Where the Parquet lives: a local path, `s3://…`, or `gs://…` |
333
+ | `FOCUS_VERSION` | `1.0` | FOCUS specification version: `1.0`, `1.1`, or `1.2` |
334
+ | `AWS_REGION` | `us-east-1` | Region for S3 access |
335
+ | `AWS_PROFILE` | (unset) | AWS profile for S3 authentication |
336
+ | `AWS_ACCESS_KEY_ID` / `AWS_SECRET_ACCESS_KEY` | (unset) | Static AWS credentials, if not using a role or profile |
337
+ | `GCS_HMAC_KEY_ID` / `GCS_HMAC_SECRET` | (unset) | HMAC credentials for GCS |
338
+ | `GOOGLE_APPLICATION_CREDENTIALS` | (unset) | Service-account JSON for GCS via ADC |
339
+
340
+ ## Development
341
+
342
+ ```bash
343
+ git clone https://github.com/glassity/focus-mcp.git
344
+ cd focus-mcp
345
+
346
+ uv sync # install, including dev tools
347
+ uv sync --extra gcs # + GCS ADC support
348
+
349
+ export FOCUS_DATA_LOCATION="/path/to/your/focus/data"
350
+ uv run focus-mcp
351
+ ```
352
+
353
+ Point a client at the source checkout instead of the Docker image:
354
+
355
+ ```json
356
+ {
357
+ "mcpServers": {
358
+ "focus": {
359
+ "command": "uv",
360
+ "args": ["run", "--directory", "/path/to/focus-mcp", "focus-mcp"],
361
+ "env": {
362
+ "FOCUS_DATA_LOCATION": "/path/to/your/focus/data",
363
+ "FOCUS_VERSION": "1.0"
364
+ }
365
+ }
366
+ }
367
+ }
368
+ ```
369
+
370
+ Build and run your own image:
371
+
372
+ ```bash
373
+ docker build -t focus-mcp:custom .
374
+ docker run -i --rm \
375
+ -v "/path/to/your/focus/data:/data:ro" \
376
+ -e FOCUS_DATA_LOCATION=/data \
377
+ focus-mcp:custom
378
+ ```
379
+
380
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for conventions and checks before
381
+ opening a pull request.
382
+
383
+ ## Roadmap
384
+
385
+ - Automated query synchronization from the FOCUS specification, so new
386
+ use-case pages land here without manual extraction
387
+ - Richer response formatting: citations and educational context inline in
388
+ query results
389
+ - Validation of every use-case query against real v1.1 and v1.2 exports
390
+ - Evaluate moving column and attribute definitions to MCP resources
391
+ - Surface conformance-gap notes from the spec in tool responses
392
+
393
+ ## Security
394
+
395
+ Report vulnerabilities to the address in [SECURITY.md](SECURITY.md), not the
396
+ issue tracker. Know the trust model: `execute_query` runs SQL that the AI
397
+ assistant writes, inside the server process. Your Parquet files are a query
398
+ source, not a writable database, and every example here mounts them `:ro`;
399
+ keep that. Run the Docker image rather than a bare process if you want a hard
400
+ boundary, and give the server only the object-store credentials it needs,
401
+ scoped to the billing bucket.
402
+
403
+ ## License
404
+
405
+ Apache-2.0. Copyright Glassity. See [LICENSE](LICENSE).
406
+
407
+ ---
408
+
409
+ <p align="center">
410
+ Built by <a href="https://glassity.cloud">Glassity</a>, cloud cost
411
+ visibility and optimization for AWS.
412
+ </p>