ktx
ktx is a TypeScript-based context layer that helps AI agents (Claude Code, Codex, etc.) query data warehouses accurately by automatically learning your company's metric definitions, business knowledge, and data relationships. It ingests schemas, documentation, and BI tools to build a searchable semantic layer that agents use to write correct SQL without reinventing metrics each time.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | Kaelio/ktx |
| Owner | Kaelio |
| Primary language | TypeScript |
| License | Apache-2.0 — OSI-approved |
| Stars | 1.5k |
| Forks | 87 |
| Open issues | 31 |
| Latest release | v0.16.0 (2026-07-03) |
| Last updated | 2026-07-07 |
| Source | https://github.com/Kaelio/ktx |
What ktx is
ktx is a local-first Node.js CLI and MCP server that ingests SQL warehouse metadata, dbt/MetricFlow semantic layers, and wiki content through connectors and context builders, then exposes a combined full-text and semantic search surface to LLM agents via CLI and MCP tools. It builds a join graph to resolve chasm and fan traps, compiles read-only SQL, and supports PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, SQLite, DuckDB, Athena, and MongoDB.
Get the ktx source
Clone the repository and explore it locally.
git clone https://github.com/Kaelio/ktx.gitcd ktx# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- Requires Node.js and global npm installation; `ktx setup` initializes local project with ktx.yaml, semantic-layer/, wiki/, and .ktx/ directories. Store .ktx/ locally and commit only ktx.yaml and semantic-layer/ to version control.
- Must configure LLM backend (Anthropic API, Google Vertex, Claude Code session, or Codex SDK) and database connections before building context. No SaaS signup required; all processing is local.
- Ingest sources (dbt, Looker, MetricFlow, Notion, Google Drive) are optional; basic ingestion requires warehouse connection and optional metadata sources. Incomplete ingestion still produces usable context.
- MCP server runs on-demand via `ktx mcp start`; agent client (Claude Code, Codex, Cursor) must be configured to communicate with the local MCP daemon. Requires agent SDK integration.
- Join graph resolution and contradiction flagging depend on schema quality and metadata completeness; sparse schemas or undocumented relationships may limit semantic layer effectiveness.
When to avoid it — and what to weigh
- No SQL Warehouse — ktx sits on top of a SQL data warehouse. If you query data via APIs, files, or non-SQL sources, ktx is not applicable.
- One-Off Ad Hoc Queries — If you need a single query answered, direct SQL access or a notebook is simpler. ktx's value accrues when agents run repeated analytical tasks.
- Manual Semantic Layer Maintenance Acceptable — ktx automates metric learning and contradiction detection. If your team prefers full control and manual curation, a lightweight YAML semantic layer may suffice.
- No Approved Metric Definitions Established — ktx ingests existing metric sources (dbt, Looker, MetricFlow). If you have no canonical metric definitions, ktx requires significant upfront schema and business knowledge input.
License & commercial use
ktx is licensed under Apache License 2.0 (Apache-2.0), an OSI-approved permissive license. Permits commercial use, modification, and distribution with attribution and liability disclaimer.
Apache 2.0 is a permissive OSI license that explicitly permits commercial use, modification, and distribution. No additional licensing fees or restrictions from ktx itself. Users are responsible for compliance with dependencies and their own LLM provider agreements (e.g., Anthropic, Google). Review your LLM provider's terms for any usage constraints.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Strong |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
ktx runs locally; no schema or query results are sent to hosted services (only to configured LLM provider as instructed by user). Database connections are read-only by design—no write access. Connection secrets stored in local .ktx/ directory (git-ignored). Users must secure their LLM API keys and database credentials in their environment. Ingestion of external sources (Notion, Google Drive, dbt Cloud) introduces trust dependencies on those integrations. No formal security audit data provided; requires review for production use.
Alternatives to consider
dbt Semantic Layer / MetricFlow
Mature metric definition layer for dbt projects. Requires manual maintenance; does not auto-ingest wiki or BI tool knowledge. Does not include agent-specific MCP runtime.
Langchain / LlamaIndex Loaders + Custom RAG
General-purpose LLM context frameworks. Require custom ingestion and search logic. No built-in join graph resolution, metric curation, or contradiction detection.
Looker / Metabase Semantic Layers
BI-tool-native semantic layers. Limited to single-source metric definitions; do not absorb wiki or dbt knowledge. Do not expose MCP tools for agent integration.
Build on ktx with DEV.co software developers
ktx automates semantic layer building and agent integration. Start with `npm install -g @kaelio/ktx` and `ktx setup` to enable Claude Code, Codex, and other agents to query your warehouse accurately.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
ktx FAQ
Does ktx send my data to a hosted service?
Which agents are supported?
Is my warehouse safe?
Can ktx work without dbt or Looker?
Custom software development services
Need help beyond evaluating ktx? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and mcp servers integrations — and maintain them long-term.
Ready to Connect Your Data Warehouse to AI Agents?
ktx automates semantic layer building and agent integration. Start with `npm install -g @kaelio/ktx` and `ktx setup` to enable Claude Code, Codex, and other agents to query your warehouse accurately.