Skip to main content
Kai Walker

Hertfordshire, UK

← All workAnalytics platforms · 03 / 19

Governed metrics semantic layer and MCP server

Metric definitions moved out of BI-tool code into dbt and MetricFlow, and opened up to AI agents

Role
Partner / stakeholder priorities
Stack
dbt / MetricFlow / MCP / Python / GCP Cloud Functions Gen2 / GitLab CI/CD / BigQuery
Domain
Platform / Semantic layer

Problem

The same metric could be defined several times inside BI-tool code, so two dashboards could disagree and an AI agent had no reliable definition to work from.

Constraints

Agents had to go through the access controls people already have, not around them, and the work is still at proof-of-concept stage.

My role

Core contributor on a wider team. I built the MCP server and I'm building the metric catalogue interface.

  • Data Modeling
  • Data Governance
  • Software Engineering
  • SQL & Databases

Approach

Definitions move into dbt and MetricFlow as one governed layer. My self-hosted MCP server lets AI agents search for a metric, describe it and query it under existing permissions, through a single dispatch endpoint, with CI/CD deploys. I later migrated it to Cloud Functions Gen2.

This is a team effort to move metric definitions out of BI-tool code and into dbt and MetricFlow, so a metric is defined once and means the same thing everywhere. I'm a core contributor rather than the lead. My main piece is the self-hosted MCP server that lets AI agents search for a metric, read its definition and query it, all under the access controls people already have. It runs through one dispatch endpoint, deploys through CI/CD, and I moved it onto Cloud Functions Gen2. I'm now building the metric catalogue interface on top. It's still a proof of concept.

Result

Agents can now ask for a governed metric by name and get the same answer a person would.

  • Self-hosted MCP server for metric search, describe and query
  • Queries run under existing access controls
  • CI/CD deploys, migrated to Cloud Functions Gen2
  • Building the metric catalogue interface (proof of concept)

What I'd do differently

I first built the server to deploy on Cloud Run, then found our project's permissions only allowed Cloud Functions, which other services on the team had already hit. The move worked, but the first version crashed on its health check and needed a second fix the same day. I'd check what the target project actually allows before choosing how to deploy, and copy what neighbouring services already do.

Next project04 / 19AI analytics assistant and portal