field-analytics
Reads John Deere Operations Center API resources (equipment, hours of operation, and alerts) to build fleet engine-hours and alerts tables for machine telemetry, with live OAuth support for a real organization.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@field-analytics What was output per hour by shift in September?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Field analytics assistant
A small, working example of how I build AI analytics: governed metrics, an MCP server that puts them in front of Claude, skills that tell Claude how to answer, a screen people can use, and an evaluation set that has to pass before any change ships.
New here, or not an engineer? Start with the plain language guide (PDF). It explains what this is, why it exists, and how to use it, with no code.

The data is synthetic. My production work lives in private company repositories, so I wrote this sample to show the same way of working on numbers I can publish. It covers three subjects I know well: harvesting machines running two shifts across three sites, the telemetry of those machines in the shape of the John Deere Operations Center API, and machine sales through a dealer channel in three regions.
The problem it solves
People stop using an assistant the first time it gives a number that disagrees with the report they already trust. I've watched two departments bring two different production totals for the same day to the same meeting. The cause was small. The night shift crosses midnight, and one side counted those hours on the next calendar day.
So this project starts with the definition and works outward:
semantic/metrics.yamlholds one written definition per metric, with an owner.src/field_analytics/metrics.pyimplements each definition once, in SQL.The MCP server serves both the number and the definition, so the model reads the rule before it reports.
evals/expected.pyrecomputes every expected value from the raw file with separate code. If the two disagree, the build fails.
Related MCP server: factory-floor-mcp
What the business gets
Each piece is here because of something a person in the business feels.
A supervisor gets an answer in the time it takes to ask, with the rule behind the number shown next to it, and without waiting for an analyst.
The screen, the assistant, and the Spark build all read one definition, so a meeting starts from one total.
When the answer calls for action, the person asks for it on the same screen. A maintenance window becomes a pending request, and a person approves it.
The usage log shows what people ask most, so the next thing to build is chosen by use.
A source file that changes without warning stops at the door. Nobody presents a number built on a column that quietly changed its meaning.
The data here is synthetic, so this repository has no results of its own to report. The gains I have measured in real use are in my Unity Catalog field guide.
How the pieces fit
flowchart LR
person([Person]) --> front[Screen or Claude]
front --> tools[MCP tools]
tools --> access[Access by role]
tools --> defs[Written definitions]
access --> sql[Metric SQL]
defs --> sql
sql --> data[(Accepted data)]
source([Source file]) --> contract{Data contract}
contract -- meets it --> data
contract -- breaks it --> quarantine[Quarantine and proposed repair]
quarantine -- a person approves --> data
tools --> log[Usage log]
log -- repeated requests --> proposed[Proposed evaluation cases]
proposed -- a person reviews --> evals[Evaluation set]
evals -. gates every change .-> toolsTwo loops keep it healthy. What people ask repeatedly becomes a proposed test, so the next change cannot break what they depend on. A source file that breaks its contract stops at the door, a repair is proposed, and a person decides.
What is in here
Path | What it does |
| Metric definitions and written rules: production and machine telemetry (by site), dealer sales (by region) |
| Which sites and regions each role may read, and who may request actions |
| The metric SQL (DuckDB), with every model supplied argument validated |
| Access by role, applied to every query |
| The MCP server: five tools over stdio |
| The data contract: columns, types, and ranges each source promised |
| Check a file against its contract, quarantine it, propose a repair, load it after approval |
| Actions create a pending request. A person approves it |
| The tool loop that asks Claude, shared by the app and the evaluation set |
| The usage log: what people ask for and what gets refused |
| Reads John Deere Operations Center responses (equipment, hours of operation, alerts) and builds the two fleet tables |
| Synthetic API responses in the published shapes, the script that generates them, and the machine to site list |
| The control room view: one row per machine for one production day |
| The Streamlit screen, ready to deploy as a Databricks App |
| Three Agent Skills: how Claude should answer on production, on machine telemetry, and on dealer sales, and what it must never do |
| The evaluation set, the independent expected values, the grader, and the script that proposes new cases from usage |
| A plain language guide to the whole thing |
| The same rules in PySpark, writing a Delta table on Databricks |
| Unit tests, access tests, and a parity test between PySpark and the metric layer |
| The project instructions Claude Code reads when I work here |
Run it
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest # 76 tests (the Spark parity test is skipped without PySpark)
python evals/run_evals.py # 17 evaluation cases, graded against the toolsThe screen
pip install -e ".[dev,app]"
streamlit run app/app.pyPick a role in the sidebar. Without an API key the screen runs with no model: a few selectors call the same tools Claude would, and every result shows what the number covers and how the metric is defined. Set ANTHROPIC_API_KEY and the selectors give way to a question box.
To run it as a Databricks App, create an app in your workspace from this repository. app.yaml starts the screen and requirements.txt lists what Databricks needs to install. To turn on the question box there, add the API key as a secret resource on the app and uncomment the two lines in app.yaml.
Machine telemetry from John Deere Operations Center

The control room tab reads machine telemetry in the shape the John Deere Operations Center API returns it. I use three resources: equipment, hours of operation, and alerts.
The responses in data/deere/responses are synthetic. I generated them from the shapes published at developer.deere.com, and no customer organization was read to build this sample. A customer's machine data belongs to the customer.
python data/deere/generate_responses.py # writes the synthetic responses again, same seed, same files
python scripts/pull_deere.py # builds data/fleet_engine_hours.csv and data/fleet_alerts.csvThe API hands you facts about an engine. The supervisor asks about a shift. Four things sit between the two, and each one is a written rule in semantic/metrics.yaml:
UTC to local time. The API answers in UTC. An interval that starts at 11:00 UTC started at 06:00 in Chicago, which is the first minute of the day shift.
Intervals cross shifts. One engine interval can start on the day shift and end on the night shift.
deere.pycuts it at 06:00 and 18:00, so each part counts where it happened. This is the same production day rule the production numbers use, which is why the two subjects can sit side by side.Silence is not a stopped engine. When the terminal is powered off, the API records nothing. That time counts as neither on nor off. It lowers reported hours and leaves utilization alone.
The API does not know your sites.
data/deere/machine_sites.csvsays which machine works where, and operations owns it. A machine the API returns with no site is reported and left out, so it never shows up under the wrong supervisor.
The expected values for these metrics are computed from the raw API responses, one minute at a time, and not from the tables built from them. So the evaluation set checks the flattening step too.
To read a real organization, get an access token through the OAuth 2 authorization code flow with scope eq1, then:
export DEERE_ACCESS_TOKEN=...
export DEERE_ORG_ID=...
python scripts/pull_deere.py --liveThe live path is covered by tests with a stand in for the HTTP call: paging through nextPage links, the seven day limit on alert requests, and the token on every request. I have not run it against an organization from this repository. The engine state mapping (1 is on, 0 is off) is the first thing I would confirm when I do, because the public documentation shows the field without listing its values.
What people ask
Every query is logged with the role, the metric, the grouping, and whether it was refused. The person and the rows are never logged.
python scripts/top_questions.pyThe same summary is the second tab of the screen. I read it as a backlog: the view people request most is the next dashboard worth building, and a refusal that keeps repeating is either missing access or a question nobody has defined yet.
Why did it change
"How much" is half of what people ask. The other half is "why". The explain_change tool compares two periods and returns the groups that moved the number most, by site, shift, and machine, or by region, dealer, and product line. The arithmetic is SQL through the same definitions and access rules. Claude reports it and does not compute it. For a rate such as output per hour, the tool says that the changes by group do not add up, so the answer does not pretend they do.
When a source changes without warning
Every source has a contract in semantic/contracts.yaml. Two sample files break it in different ways:
python scripts/load_source.py machine_hours data/samples/machine_hours_after_upgrade.csvThree columns were renamed by an upgrade. The file goes to quarantine and a rename is proposed. The proposal is applied and the contract is checked again before anyone is asked to approve it:
python scripts/approve.py <id> approveAfter approval the file loads, and the rename is recorded in semantic/source_mappings.yaml. The next file with the same change loads on its own.
python scripts/load_source.py machine_hours data/samples/machine_hours_unit_change.csvHere moisture arrives as a fraction where the contract says percent. No rename explains that, so nothing is proposed and the file waits for a person to call the source owner. Add --with-claude and Claude proposes the rename instead of the name matcher. Its answer is filtered and checked the same way.
Tests that grow from what people ask
python evals/propose_cases.pyThis reads the usage log, finds requests that repeat and that no evaluation case covers, builds a case for each, and keeps only the ones that pass against the independent calculation. The result is evals/proposed_cases.yaml. A person rewords the questions and moves the cases into the evaluation set.
Claude through MCP
To ask questions in plain language, connect the server to Claude Desktop or Claude Code:
{
"mcpServers": {
"field-analytics": {
"command": "field-analytics-mcp",
"env": { "FIELD_ANALYTICS_ROLE": "north_supervisor" }
}
}
}Then try "What was output per hour by shift in September?" As north_supervisor you get the north site only, and the answer says so. Ask about the river site and the tool refuses.
To grade Claude's own answers instead of the tools:
pip install -e ".[app]"
export ANTHROPIC_API_KEY=...
python evals/run_evals.py --mode claudeTo build the gold table with PySpark locally (needs Java):
pip install -e ".[spark]"
python databricks/build_gold_production.pyOn Databricks, import the same file as a notebook. It writes main.field.gold_production as a Delta table.
Decisions I would defend in a review
The model never picks its own role. The role is set by whoever starts the server or the session for a person. Every tool call is checked against it, and a request for another site or region is refused out loud, not returned empty. An empty answer looks like "no production", which is worse than a refusal.
A new subject is a definition, a query, and an access scope. Dealer sales went in as a block in metrics.yaml, one base query, and a regions list on the roles. The server, the skills, the screen, and the grader did not need a second code path.
Model input is untrusted input. Metric and dimension names are checked against a fixed list before any SQL exists. Dates and sites are bound as parameters. There is a test that sends site; drop table x as a dimension.
Expected values are computed, not typed. A typed expected value goes stale the day the data changes. Here the grader recomputes each one from the raw file with code that shares nothing with the metric layer.
The source's shape stops at the door. Nothing past deere.py knows what an Operations Center response looks like. The metric layer reads two flat tables with a contract each. When the API changes, and John Deere is moving machine endpoints to the newer equipment API, one file changes.
Actions wait for a person. The assistant can ask for a maintenance window. That writes a pending request and stops. scripts/approve.py is the human step.
A proposal is checked before it is trusted, whoever made it. A proposed column rename, from the matcher or from Claude, is applied to the file and the contract is run again. A proposed evaluation case has to pass the independent calculation. What fails the check never reaches a person as a recommendation.
Renames can be proposed. Values cannot. A column that arrives under a new name is a mapping problem. A column that arrives in another unit is a conversation with the source owner, and the system says so instead of guessing.
Refusals and bad arguments come back as answers. The model gets {"ok": false, "error": "..."} and can tell the person what happened, instead of the server crashing mid conversation.
What I would add for production
This is a sample, so a few things are simpler than what I run at work:
The role would come from the signed in user, which Databricks Apps passes to the app, not from a selector or an environment variable.
The metric layer would read the Delta gold table through a SQL warehouse, not a CSV through DuckDB.
The usage log would be a Delta table, and accepted files would land in a bronze table instead of a folder.
Quarantine and pending requests would raise a ticket for the source owner named in the contract.
The Operations Center pull would run on a schedule and load only what is new, with the token refreshed from a secret store. Engine hours meter readings and location history would come in next, for service intervals and for the map.
How this was built
I built it with Claude Code, the way I work every day: I write the definitions and the review rules, Claude Code writes much of the code and tests with me, and I read every line before it is committed. CLAUDE.md is the instruction file from that process.
License
MIT
Available Tools
5 toolsdescribe_metricC
Return the full definition of one metric, plus the written rules of its subject.
Inputs: name (required).
explain_changeA
Compare a metric between two periods and return the groups that moved it most.
Period A is the baseline (start_a to end_a) and period B is the period being explained. Use this when someone asks why a number went up or down. Report the movers it returns and read its notes. Do not work out contributions yourself.
Inputs: end_a (required), end_b (required), metric (required), start_a (required), +3 more.
list_metricsA
List the metrics this server can answer, with unit, owner, and written definition.
Inputs: no named parameters.
query_metricA
Query a metric for days from start_day to end_day (YYYY-MM-DD, both included).
Production metrics are scoped by site and group by: site, machine_id, shift, production_day. Fleet hours metrics (engine on hours, utilization) are scoped by site and group by the same four. Fleet alert metrics are scoped by site and group by: site, machine_id, severity, production_day. Dealer sales metrics are scoped by region and group by: region, dealer_id, product_line, sale_day. site or region limits the query to one of them. The caller's role limits what can be read.
Inputs: metric (required), end_day (required), start_day (required), site, +2 more.
request_maintenance_windowB
Ask for a maintenance window on a machine. This creates a pending request.
Nothing is scheduled until a person approves it. Tell the person the request id and that it is waiting for approval.
Inputs: day (required), site (required), shift (required), reason (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct action: listing metrics, describing one metric, querying a time range, explaining period-over-period change, and requesting maintenance. The boundary between query_metric and explain_change is explicitly clarified by the descriptions, so an agent should not confuse them.
All tool names follow a consistent snake_case verb_noun pattern: list_metrics, describe_metric, query_metric, explain_change, request_maintenance_window. There are no mixed conventions or vague standalone verbs.
Five tools are well-scoped for a focused metric analytics server: discovery (list/describe), querying, explanation, and a maintenance side action. Each tool has a clear purpose and none feels redundant.
The core read-only analytics surface is covered, but there is no way to discover valid site/region/machine dimension values required by query_metric. Maintenance requests can be created but not checked or cancelled, creating a lifecycle dead end.
Maintenance
Related MCP Connectors
Connect your ads, shop, analytics, social, CRM and finance platforms once, then let Claude, ChatGPT, Cursor or any MCP client read, join and explain your numbers. Public statistics from the World Bank, IMF, Eurostat, OECD, WHO and SEC filings come as context, searchable and chartable from the same tools. Read-only by design, every number carries its source.
Read-only analytics for Convex apps, queryable via MCP from Claude, Cursor, and other clients.
GA4, Google Ads and Search Console in Claude. Read-only OAuth, multi-account for agencies.
Read-only access to a company's ERP for Claude, ChatGPT and Gemini, with OAuth and an audit trail.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables agents and Claude Desktop to query a single canonical source for multifamily marketing metrics, with 22 tools for retrieving metric definitions and values from a synthetic portfolio database.MIT
- AlicenseAqualityCmaintenanceProvides read-only access to manufacturing plant data from Excel or SAP S/4HANA, enabling natural-language queries for OEE, downtime Pareto, late work orders, scrap, and inventory alerts. It enforces data classification, masking, row limits, and audit logging for safe Claude/MCP client access.10MIT
- AlicenseNot gradedqualityBmaintenanceEnables Claude to answer plain-English metric questions by selecting validated metrics, dimensions, filters, and dates from a MetricForge semantic layer, ensuring answers use only controlled definitions and never model-written SQL.MIT
- AlicenseNot gradedqualityCmaintenanceGives Claude governed access to a curated registry of go-to-market KPIs, with definitions, sources, and formulas, so it can draft a leadership business review from approved numbers rather than pasted-in data. It also validates every figure in the draft against its source KPI and flags anything unsupported before the review or 5-slide deck reaches leadership.MIT