DEV Community

Cover image for How to Build an MCP Semantic Layer Server (Architecture, Code, and the No-Rip-and-Replace Case)
Mayank Mudgal
Mayank Mudgal

Posted on • Originally published at colrows.com

How to Build an MCP Semantic Layer Server (Architecture, Code, and the No-Rip-and-Replace Case)

3 agent frameworks. 4 data sources. 12 brittle connectors.

Then someone renames a column and three agents break at once. MCP fixes the wiring — but the wiring was the easy part.

What an MCP semantic layer server actually exposes

The design decision is what your tool surface represents. Expose tables and every agent infers meaning independently. Expose semantics and they all compile through the same graph.

A governed server exposes something closer to:

Tool Returns
list_concepts Typed entities and metrics the caller may see
describe_concept Definition, grain, filters, allowed dimensions
resolve_intent A typed plan — or a refusal with the reason
execute Governed result + the SQL + predicates applied

Notice there's no run_sql. That's deliberate — the moment you expose arbitrary SQL execution, every governance guarantee becomes advisory.

The request path

Intent → context resolution → constrained planning → governed execution.

  1. Agent sends intent plus caller identity
  2. Server resolves concepts against the versioned semantic graph
  3. Planner proves a join path — no path, compilation fails
  4. RBAC and ABAC predicates injected for that identity
  5. Dialect-perfect SQL emitted and executed
  6. Result returned with lineage and an audit record

The no-rip-and-replace part

This sits above your warehouse, not instead of it. Snowflake, Databricks, BigQuery and Postgres stay where they are; the layer reads your existing catalogs and BI models to build the graph, then compiles down to each engine's dialect.

The most common objection is migration fatigue — teams have spent millions consolidating and won't move again. They don't have to. Additive layers are the only ones that get deployed.

And because MCP and REST can front the same compiled core, switching protocols later never means re-proving your governance.


The full breakdown — the full architecture, code for the server, the tool schemas, and the integration path — is here:

👉 How to Build an MCP Semantic Layer Server (Architecture, Code, and the No-Rip-and-Replace Case)


Originally published at colrows.com/blogs/mcp-semantic-layer-integration

Top comments (0)