# semlayer

The semlayer MCP server for Claude Code derives a semantic layer from a data warehouse. Agents can use it to check SQL against the warehouse’s structure and rules.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 5 repo stars
- Author: semlayer-dev
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/semlayer-dev/semlayer
- Updated: 2026-11-14
- Security check: automated, 2026-11-17 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/semlayer

## What it does

semlayer examines a warehouse and produces a portable semantic layer with table and column descriptions, relationships, decoded status values, and business rules. Each inferred claim carries its confidence, source, and review state.

An agent accesses the layer over MCP. The `semlayer lint` command checks SQL for issues such as missing filters and unsafe joins; `semlayer drift` detects schema changes. Claude Code setup requires `ANTHROPIC_API_KEY`, and inference needs access to a data warehouse.

## Requirements
- Needs: Python and uv (commands run via uvx)
- Environment variables: `ANTHROPIC_API_KEY` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add mcp -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx semlayer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from semlayer <command>

### Codex

**Platform CLI**
```bash
codex mcp add semlayer --env ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx semlayer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from semlayer <command>

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "semlayer": {
            "command": "uvx",
            "args": [
                "semlayer"
            ],
            "env": {
                "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from semlayer <command>

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "semlayer": {
            "type": "stdio",
            "command": "uvx",
            "args": [
                "semlayer"
            ],
            "env": {
                "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
            }
        }
    }
}
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from semlayer <command>

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> semlayer uvx semlayer
```
Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from semlayer <command>

## When to use it
- describe warehouse tables and columns
- discover relationships without declared keys
- check SQL for missing filters and faulty joins
- detect changes to a warehouse schema

## Example prompts
- Infer a semantic layer from my Snowflake warehouse.
- Check `query.sql` against the semantic layer.
- Compare the layer with the current Snowflake schema and find changes.

## Similar
- [ktx-ai-data-agents-context-layer](https://affpapa.org/en/nevibecode/skills/ktx-ai-data-agents-context-layer.md) — skill · 157 installs
- [ktx-ai-data-agents-context](https://affpapa.org/en/nevibecode/skills/ktx-ai-data-agents-context.md) — skill · 145 installs
- [answering-natural-language-questions-with-dbt](https://affpapa.org/en/nevibecode/skills/answering-natural-language-questions-with-dbt.md) — skill · 1100 installs
- [setting-up-data-catalog](https://affpapa.org/en/nevibecode/skills/setting-up-data-catalog.md) — skill · 182 installs
- [mz-ontology-design](https://affpapa.org/en/nevibecode/skills/mz-ontology-design.md) — skill · 107 installs
- [sql-jdbc-access-design](https://affpapa.org/en/nevibecode/skills/sql-jdbc-access-design.md) — skill · 10100 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
