An expressive, embeddable semantic layer for AI agents and humans.
SLayer enables AI-powered data analytics on top of your warehouse. Agents get a governed, shared surface through which they access your data and metrics and give you reliable answers.
SLayer handles database connectivity (read-only), SQL translation, common data transformations, and row-level security, so LLMs and humans don't have to. Adapt it to your workflows, not the other way around. Manage definitions easily with an agent or by yourself.
SLayer can be used as a standalone tool or imported as a Python library, easily embeddable into any Python app. Use it for powering analytical MCP servers or APIs or simply to query databases semantically.
Traditionally, semantic layers were a part of the BI stack, where every metric and its aggregation had to be predefined. Agents need more flexibility because users ask questions that involve metric combinations (like ratios), transforms (like time shifts), or different aggregations of the same metric (like average instead of sum).
SLayer allows to define a column revenue once and query it using expressions like revenue:sum, revenue:avg, revenue:sum / *:count, time_shift(revenue:sum, -1, 'year') etc.; multi-stage queries are also supported.
SLayer is focused on the common agentic search → inspect → query flow. It has a search tool for efficient discovery and a memory store for linking the relevant business context.
Agents, apps and humans can talk to SLayer via MCP, REST API, CLI, Python, Flight SQL, or Postgres-based SQL API. SLayer supports most popular databases.
SLayer fits next to your existing data stack. It also provides importers for dbt, Cube, and Ossie configs.
See docs for more.
Question (run on the built-in demo Jaffle Shop database): "show monthly revenue by store, with month-over-month % change"
Side by side, here's LLM-generated SQL and the equivalent SLayer query.
We recommend using uv, especially if you don't work in a Python project.
uv tool install 'motley-slayer[all]'If slayer isn't found on PATH afterwards, run uv tool update-shell and reopen your terminal.
# With the Jaffle Shop demo preloaded (zero-config quickstart)
claude mcp add slayer_demo -- slayer mcp --demoSet up your datasource, substituting the correct database, username, hostname, and db_name.
slayer datasources create 'postgresql://user:${DB_PASSWORD}@hostname/db_name'The password will be read by SLayer at init time, not saved to disk nor exposed to Claude.
Then add SLayer to Claude Code:
claude mcp add slayer -- slayer mcp --ingest-on-startupNow SLayer MCP will be visible in Claude Code next time you start it. Make sure to launch Claude Code from a shell where DB_PASSWORD is exported — the MCP subprocess inherits its environment from the launching process.
Read more on how to get started with MCP, CLI, REST API, Python in the docs.
MIT

