ktx
A context layer for data agents: semantic layer, company wiki and MCP so the agent writes correct warehouse queries
Install
npm install -g @kaelio/ktx
ktx setup
ktx statusIf ktx status prints ktx mcp start, run it before opening your agent.
This is third-party code. Review the repository files before installing.
What it does
ktx studies your warehouse: samples tables, captures metadata and query patterns, and detects joinable columns. From dbt, MetricFlow, LookML, Looker, Metabase, Sigma, Notion and Google Drive it builds a semantic layer with approved metrics and a local wiki, flagging contradictions for human review. The agent reaches it through CLI and MCP with full-text and semantic search and fetches metrics declaratively instead of rewriting SQL. It runs locally and read-only.
Who it is for. For analysts and data engineers who want agents to compute metrics by approved definitions.
Good fit when
- An agent in Claude Code or Codex must answer questions from warehouse data
- Metric knowledge is scattered across dbt, Looker and wikis
- The agent re-explores the schema every time and mixes up metric definitions
Not a fit when
- You have no SQL warehouse
- You need a single ad-hoc query; psql or a notebook will do
Example request
What was revenue by region last quarter using the approved revenue metric?Limitations
Needs an LLM provider key (Anthropic, Vertex AI, AI Gateway) or local Claude Code or Codex sign-in, plus an embeddings model. Schema and samples go to the chosen LLM provider. Initial context ingest can take a long time. The Anthropic API is not reachable from Russia without a VPN.
How to disable. Stop the ktx MCP server, remove the integration from agent settings and run npm uninstall -g @kaelio/ktx.
Security check
- Connects to databases with credentials
- Sends schema and samples to the LLM provider
README in short
The README explains why agents fail at data tasks and compares ktx with a plain agent and a classic semantic layer. Quick start is a global npm install, ktx setup and ktx status, or letting the agent install it via the skill. It lists core commands and project layout: ktx.yaml, semantic-layer, wiki and a local .ktx folder for secrets. Apache-2.0 licensed.
SKILL.md
--- name: ktx description: Installs and configures ktx, the open-source context layer for data agents — runs ktx setup non-interactively with hidden CLI flags, configures database connections and embeddings, installs agent integration, and verifies readiness. Use when the user asks an agent to add ktx to a project, connect data sources, install agent rules, ingest schema, or troubleshoot a local ktx install. --- # ktx Install and configure **ktx**, the open-source context layer for data agents. Use this skill when a user wants an agent to add **ktx** to a project, connect data sources, build initial context, install agent integration, or troubleshoot a local **ktx** setup. ## Operating rules - Act autonomously when the user asks you to install or configure **ktx**. The non-interactive scripted flow below is the canonical path — bare `ktx setup` is interactive (clack prompts) and an agent cannot drive it. - Setup's non-interactive flags are intentionally hidden from `--help`. Use the flags listed below; verify uncommon flags against the docs at `https://docs.kaelio.com/ktx/` or this skill — not against `--help` output. - Ask only for values you cannot infer: project directory, connection targets, credentials, account identifiers, and source selections.
FAQ
Does ktx send schema or results to a hosted service?
No, it runs locally. Only what goes to your configured LLM provider leaves the machine.
Which databases are supported?
PostgreSQL, Snowflake, BigQuery, ClickHouse, MySQL, SQL Server, SQLite, DuckDB, Amazon Athena and MongoDB.
Related
166 skills for scientific work: bioinformatics, cheminformatics, clinical data, geospatial analysis and 100+ databases
Google's open-source MCP server for databases: ready tools for Postgres, MySQL, BigQuery, Spanner and more, plus custom tools in tools.yaml
Official Hugging Face skills: Hub operations via the hf CLI, datasets, model training, Spaces, evals and deployment
A token-lean MCP server for PostgreSQL, MySQL, MariaDB, SQL Server and SQLite with a read-only mode