Klarova
A governed context layer for internal data exposed over MCP, enabling agents to query governed definitions, retrieve grounded data, and execute scoped actions with citations and auditing.
README
<div align="center">
Klarova
The trust layer between AI agents and your company's data.
Correct, cited, access-scoped answers β served to any agent over MCP.
</div>
| β Correct | π Cited | π Scoped |
|---|---|---|
| Grounded in governed definitions of what your numbers and terms actually mean. | Every answer traces to the exact query or source span it came from. | Every access is limited to what the asker is allowed to see β and audited. |
The problem
A generic agent β Claude, Cursor, ChatGPT β can already plug into your database or document store. But it doesn't understand your business, so it's confidently wrong: it writes SQL that misreads your schema, answers from whatever it happened to retrieve, cites nothing, and respects no rule about who may see which row or document. That's unshippable anywhere a wrong number or a leaked row has real cost.
The fix
Klarova is a governed context layer that sits between any agent and your data. It does no reasoning of its own β it's the trustworthy foundation an agent stands on. It holds your governed definitions, the grounding that lets an agent query accurately, and governed execution that scopes, runs, and audits every access. It's exposed over MCP, so any agent gets the same correct, cited, scoped answer.
The agent is replaceable; the context layer is the moat.
β¨ What it does
- π§ Semantic layer β governed metric definitions, so an agent picks a metric by name instead of guessing the maths.
- ποΈ Text-to-SQL, governed β validated read-only queries, executed and returned with the exact SQL that produced each number.
- π Governed enterprise search β hybrid (dense + sparse) retrieval over your documents, reranked and multi-hop, every answer citing its source span.
- π Cross-source synthesis β combine a governed warehouse number and a document fact into one answer that carries both citations.
- π‘οΈ Governed access β identity-scoped rows and documents, enforced inside execution and written to an audit trail.
- π MCP-native β plug in Claude, Cursor, or Klarova's own copilot; all get the same governed result.
- π An evaluation harness β every capability has an objective test (execution accuracy, retrieval recall, citation match), reported as a number.
π§© How it works
Two things sit between a person and their data, and keeping them cleanly separate is the whole design.
<p align="center"> <img src="docs/architecture.svg" alt="Klarova architecture β generic agents and the Klarova copilot query the context layer (semantic model Β· grounding & memory Β· governed execution) over MCP; the layer returns scoped, cited results from your data." width="820"> </p>
- The context layer (the moat) β passive, reusable, MCP-exposed. A semantic model, grounding & memory, and governed execution. Does no reasoning.
- The agent (the copilot) β the reasoning consumer that turns a question into an answer by consuming the layer: plan β generate β execute β investigate β verify β synthesize β act β remember. Klarova ships its own reference copilot, but it sits in the same position as Claude or Cursor.
Because the layer holds no agent logic, any agent gets the same governed answers β which is exactly why it, not the chat, is the durable asset.
π Quickstart
Requirements: Python 3.12+ and
uv.
git clone git@github.com:samson-ailabs/Klarova.git
cd Klarova
uv sync # install dependencies into .venv
cp .env.example .env # then add your OpenRouter + embedder keys
uv run klarova # the development CLI/REPL
Development workflow:
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy # type-check (strict, src + tests)
uv run pytest # tests
πΊοΈ Status & roadmap
β οΈ Early stage β the bootstrap is in place; the walking skeleton is next.
The build follows a walking skeleton, then deepen plan: the thinnest slice that runs and is measured first, then one capability at a time, with every step leaving the system running and re-measured.
Vertical 1 grounds the layer over a warehouse (the numbers) and internal documents (the knowledge), and across both. The same engine-core later serves other domains (data-ops, CRM) by swapping connectors, not the core.
| Ship | Delivers | Milestone |
|---|---|---|
| 1 | the governed context layer (warehouse + docs) + eval report, over MCP | v0.1 |
| 2 | the full reference copilot (investigate β verify β approve β act β remember) | v0.2 |
| 3 | embedded in a host app + a public hosted demo | v1.0 |
Full plan in docs/ROADMAP.md Β· design in
docs/ARCHITECTURE.md Β· decisions in docs/decisions/.
π οΈ Built with
Python 3.12+ Β· LangChain / LangGraph v1 (primitives only) Β· DuckDB + sqlglot (governed
SQL) Β· Qdrant + FastEmbed (hybrid retrieval) Β· the official mcp SDK Β· OpenRouter (model
gateway) Β· ruff Β· mypy Β· pytest.
π License
Apache-2.0. Every source file carries an SPDX header.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.