# semlayer

> semlayer is a free MCP server for databases. Infers a semantic layer from your data warehouse and serves it to agents. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, self-hosted
- **Website:** https://semlayer.dev
- **Repository:** https://github.com/semlayer-dev/semlayer
- **MCP Registry name:** dev.semlayer/mcp
- **Categories:** databases, analytics and data
- **Listing updated:** 2026-11-14

## About

semlayer reads a warehouse and writes down what AI agents are usually missing: what tables and columns mean, undeclared foreign keys, the filters summary tables silently apply, and metric definitions. The result is one open file served over MCP.

It infers all this from the data, with no hand-written model. Statistics-only inference works without any key, while column descriptions and LLM-validated joins use an optional Anthropic API key. On the authors' messy-warehouse benchmark, text-to-SQL accuracy rose from 42% to 82%; treat that as the vendor's own measurement.

It is a Python package at a beta version, licensed Fair Source and free for internal use.

## Features

- **Undeclared joins:** Finds foreign keys nobody declared.
- **Hidden filters:** Recovers filters baked into summary tables.
- **Metric definitions:** Captures how measures like average order value are computed.
- **Open file output:** One file readable by any agent.
- **Optional LLM step:** Descriptions and join validation use an API key.

## Good for

- Give a text-to-SQL agent warehouse context
- Document an undocumented schema
- Standardize metric definitions
- Reduce wrong answers from AI analytics

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp --env ANTHROPIC_API_KEY='<ANTHROPIC_API_KEY>' -- uvx semlayer
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "semlayer"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "semlayer"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "semlayer"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "semlayer"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp": {
      "command": "uvx",
      "args": [
        "semlayer"
      ],
      "env": {
        "ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
      }
    }
  }
}
```

## FAQ

### Does it need an API key?

Only optionally, for descriptions and LLM-validated joins.

### What is the license?

Fair Source, free for any internal use.

### Where does it run?

As a CLI in your own environment with your own keys.

### Is semlayer free?

Yes. semlayer is free to use.

### How do I add semlayer to Claude Code?

Run this command in your terminal: claude mcp add mcp --env ANTHROPIC_API_KEY='<ANTHROPIC_API_KEY>' -- uvx semlayer

### What are the best alternatives to semlayer?

The closest alternatives to semlayer are Agent-Native Analytics, Google Ads + Meta Ads + SEO/GEO MCP, Tapetide - Indian Stock Market MCP, Midplane and World Monitor.

## Alternatives

- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Google Ads + Meta Ads + SEO/GEO MCP](https://ai-powered.com/mcp/google-ads-meta-ads-seo-geo-mcp): Google Ads + Meta Ads + SEO/GEO MCP is a freemium MCP server for marketing and seo.
- [Tapetide - Indian Stock Market MCP](https://ai-powered.com/mcp/tapetide-indian-stock-market-mcp): Tapetide - Indian Stock Market MCP is a freemium MCP server for finance and payments.
- [Midplane](https://ai-powered.com/mcp/midplane): Midplane is an open-source MCP server for databases.
- [World Monitor](https://ai-powered.com/mcp/world-monitor): World Monitor is a freemium MCP server for analytics and data.
- [CompanyData](https://ai-powered.com/mcp/companydata): CompanyData is a paid MCP server for analytics and data.
- [ChartAnt](https://ai-powered.com/mcp/chartant): ChartAnt is a freemium MCP server for design and media.
- [Quantivex Research](https://ai-powered.com/mcp/quantivex-research): Quantivex Research is a free MCP server for finance and payments.

---
Source: https://ai-powered.com/mcp/semlayer
