StackMap
Subscribe
Explore / neocarta
neo4j-labs

neocarta

Neo4j Labs' semantic layer for data agents: ingest warehouse schema, business glossary, metrics and query history into one graph, then serve it over MCP so agents route queries and write grounded SQL.

98 26 Python Apache-2.0updated 4 days ago
View on GitHubDispute this mapping →
Curator's take

The honest fix for Text2SQL: the model is not bad at SQL, it is blind to your data landscape. Neocarta pulls schema metadata, foreign keys, sample values, glossary terms, governed metric definitions and real query history into a Neo4j graph — only metadata crosses over, data stays in the source — then serves it to agents over MCP with full-text, vector and hybrid search that returns columns, types, example values and the FK references needed to build a join. Embeddings are optional; catalog search works from schema alone. It ships a runnable LangGraph + BigQuery agent so you can see the routing loop end to end. Read the label though: Neo4j Labs, explicitly experimental, not a supported product, 98 stars, and it assumes you are willing to stand up and maintain a Neo4j instance next to your warehouse.

Mapped by ShipWithAI editors · links verified
README.md

Neocarta

An end-to-end library for building a semantic layer in Neo4j — giving AI agents systemic understanding of how your data is organized, what it means, and where it lives.

Note: This library is not a Neo4j product. It is a Neo4j Labs project supported by the Neo4j field team.

Neo4j Labs Status: Experimental CI PyPI version Python versions License

What it is

Neocarta builds a semantic layer in Neo4j from your data sources and serves it to your agents through an MCP server. The graph unifies more than raw schema — it brings together:

  • Schema metadata — tables, columns, foreign keys, and sample values
  • Business glossary — terms and categories linked to the columns and tables they describe
  • Metrics — governed metric definitions and their expressions
  • Query history — real queries and the tables and columns they touch

…with more on the way. Across a growing set of database types, only the metadata crosses into Neo4j; your data stays in the source.

This gives agents systemic familiarity with the data landscape — what data exists, what it means, how it joins, and which database holds it. Agents use the graph to discover insights, ground their answers, and route queries to the right database, making Text2Query, query routing, and data discovery reliable.

Neocarta builds a semantic layer in Neo4j from your data sources and serves it to your agents over MCP, so they can discover, understand, and query the underlying data

Quickstart

1. Ingest — read your source's schema into the semantic graph (your data stays in the source). Use the Python library or the CLI.

Python — this is the BigQuery connector example:

import os
from google.cloud import bigquery
from neo4j import GraphDatabase
from neocarta import NodeLabel as nl
from neocarta.connectors.bigquery import BigQuerySchemaConnector
from neocarta.enrichment.embeddings import LiteLLMEmbeddingsConnector

driver = GraphDatabase.driver(
    os.getenv("NEO4J_URI"),
    auth=(os.getenv("NEO4J_USERNAME"), os.getenv("NEO4J_PASSWORD")),
)
client = bigquery.Client(project=os.getenv("GCP_PROJECT_ID"))

# Extract, transform, and load BigQuery schema metadata into Neo4j
BigQuerySchemaConnector(
    client=client,
    project_id=os.getenv("GCP_PROJECT_ID"),
    neo4j_driver=driver,
).ingest(dataset_id=os.getenv("BIGQUERY_DATASET_ID"))

# Optional: generate embeddings to turn on semantic table/column search
LiteLLMEmbeddingsConnector(
    neo4j_driver=driver,
    embedding_model="text-embedding-3-small",
).run(node_labels=[nl.DATABASE, nl.SCHEMA, nl.TABLE, nl.COLUMN])

CLI — the same ingest without writing Python (--embeddings is optional):

pip install "neocarta[cli]"
# reads NEO4J_URI / NEO4J_USERNAME / NEO4J_PASSWORD / OPENAI_API_KEY from the environment or a .env file
neocarta bigquery schema --project-id my-proj --dataset-id sales --embeddings

See the Neocarta CLI section for the full command set.

2. Serve — expose the graph to your agent as tools:

pip install "neocarta[mcp]"
# reads NEO4J_URI / NEO4J_USERNAME / NEO4J_PASSWORD from the environment or a .env file
neocarta-mcp           # or, from the unified CLI: neocarta mcp serve

The server gives the agent retrieval tools — `list_s

Continue your stack

What teams reach for next — and why each earns a place beside neocarta. Ranked by curator confidence.

Alternative to See all + compare →
ktx

Self-improving context layer for data agents — ingests dbt/Looker/wikis, maps your warehouse, builds a semantic layer with approved metrics, and serves Claude Code/Codex via CLI and MCP.

Why it fitsSame job — a context layer so data agents stop guessing at your warehouse. KTX ingests dbt/Looker/wikis, builds a semantic layer with approved metrics and self-improves, serving coding CLIs directly. Neocarta materializes the layer as a Neo4j graph with hybrid search and FK-aware retrieval, and is a library you assemble rather than a running service.
OpenMetadata

Open metadata platform turned AI context layer: 130+ connectors feed a unified knowledge graph of lineage, quality, ownership, glossaries and contracts — served to agents via MCP and APIs.

Why it fitsOpenMetadata does the catalog-as-agent-context move at platform scale: 130+ connectors, lineage, ownership, quality and contracts in one graph served over MCP. Neocarta is a small focused library for the query-routing and Text2SQL slice — much less to run, much less covered.
ontobricks

Turns Databricks Unity Catalog tables into a materialized knowledge graph: OWL ontology design, R2RML mapping, OWL 2 RL/SWRL/SHACL reasoning, auto-generated GraphQL — exposed to agents over MCP.

Why it fitsThe same catalog → knowledge graph → MCP pipeline aimed at Databricks Unity Catalog, with OWL ontology design, R2RML mapping and OWL 2 RL/SHACL reasoning. Choose by stack and by taste: formal ontology and reasoning versus Neo4j property graph and hybrid search.