데이터 웨어하우스에서 이식 가능한 시맨틱 레이어를 추론하고, 이를 MCP를 통해 AI agent에 제공하여 쿼리 정확도와 비즈니스 로직 준수 능력을 향상합니다.
다른 이름 semlayer-dev/semlayer
- 스타
- 4
- Tools
- —
- 다운로드, 30일
- 607
- 최신 버전
- 0.7.0b6
- 마지막 커밋
- 2026년 11월 14일
- 라이선스
- —
semlayer MCP란?
semlayer은(는) MCP server입니다. 데이터 웨어하우스에서 이식 가능한 시맨틱 레이어를 추론하고, 이를 MCP를 통해 AI agent에 제공하여 쿼리 정확도와 비즈니스 로직 준수 능력을 향상합니다.
프로젝트 README에서 생성된 요약
semlayer MCP server 정보
Semlayer는 기존 데이터 웨어하우스로부터 이식 가능한 시맨틱 레이어를 자동으로 생성하는 방법을 제공합니다. YAML 파일이나 LookML을 수동으로 작성하는 대신, 이 도구는 컬럼을 프로파일링하고 선언되지 않은 외래 키를 발견하며 집계 테이블에 숨겨진 비즈니스 규칙을 식별합니다. 이를 통해 시맨틱 타입, enum 디코딩, 메트릭 정의를 포함하는 데이터의 구조화된 표현을 생성하며, 생성된 레이어는 Model Context Protocol (MCP)을 통해 AI agent에 제공될 수 있습니다.
개발자는 CLI를 사용하여 Snowflake, BigQuery, PostgreSQL 또는 DuckDB 연결을 초기화할 수 있습니다. 시스템은 dbt manifest나 wiki 파일과 같은 기존 문서를 가져와 추론 과정에서 사전 정보로 활용할 수 있습니다. 레이어가 생성되고 검토되면 Claude Desktop, Cursor 또는 Claude Code와 같은 클라이언트에 제공할 수 있습니다. 이를 통해 AI agent는 기저의 비즈니스 로직과 스키마 제약 조건을 이해함으로써 웨어하우스에 대해 훨씬 높은 정확도로 쿼리할 수 있습니다.
사용자는 --no-llm 플래그를 사용하여 LLM 호출 없이 엔진을 완전 결정론적 모드로 실행할 수 있습니다. 개인정보 보호가 중요한 환경에서는 --no-sample-egress 옵션을 통해 추론 과정에서 실제 셀 값이 모델로 전송되지 않도록 보장할 수 있습니다.
활용 사례
- 1시맨틱 레이어 생성 자동화수동으로 dbt YAML을 작성하는 번거로움 없이 웨어하우스로부터 이식 가능한 시맨틱 레이어를 생성합니다.
- 2AI 쿼리 정확도 향상AI agent에 비즈니스 컨텍스트를 제공하여 취소된 주문을 합산하는 등의 오류를 방지합니다.
- 3비즈니스 로직 기반 SQL 검증시맨틱 레이어를 사용하여 SQL 쿼리에 누락된 필터나 잘못된 조인이 있는지 확인합니다.
- 4스키마 변경 감지웨어하우스의 스키마 드리프트를 모니터링하여 시맨틱 레이어를 최신 상태로 유지합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
semlayer MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 semlayer MCP 설치
$ claude mcp add --env 'ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY>' semlayer -- uvx semlayerCursor에 semlayer MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"semlayer": {
"command": "uvx",
"args": [
"semlayer"
],
"env": {
"ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>"
}
}
}
}VS Code에 semlayer MCP 설치
.vscode/mcp.json
{
"servers": {
"semlayer": {
"type": "stdio",
"command": "uvx",
"args": [
"semlayer"
],
"env": {
"ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>"
}
}
}
}VS Code CLI에 semlayer MCP 설치
$ code --add-mcp '{"name":"semlayer","type":"stdio","command":"uvx","args":["semlayer"],"env":{"ANTHROPIC_API_KEY":"<YOUR_ANTHROPIC_API_KEY>"}}'Claude Desktop에 semlayer MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"semlayer": {
"command": "uvx",
"args": [
"semlayer"
],
"env": {
"ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>"
}
}
}
}Codex에 semlayer MCP 설치
$ codex mcp add semlayer --env 'ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY>' -- uvx semlayerCodex config.toml에 semlayer MCP 설치
~/.codex/config.toml
[mcp_servers.semlayer] command = "uvx" args = ["semlayer"] [mcp_servers.semlayer.env] ANTHROPIC_API_KEY = "<YOUR_ANTHROPIC_API_KEY>"
Gemini CLI에 semlayer MCP 설치
$ gemini mcp add -s user -e 'ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY>' semlayer uvx -- semlayerGemini settings.json에 semlayer MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"semlayer": {
"command": "uvx",
"args": [
"semlayer"
],
"env": {
"ANTHROPIC_API_KEY": "<YOUR_ANTHROPIC_API_KEY>"
}
}
}
}구성
ANTHROPIC_API_KEY비밀Optional. Descriptions and LLM-validated joins need it; statistics-only inference works without it.
| 이름 | 설명 | 유형 |
|---|---|---|
| ANTHROPIC_API_KEY | Optional. Descriptions and LLM-validated joins need it; statistics-only inference works without it. | 비밀 |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능semlayer-dev/semlayer is public and reachablegithub.com/semlayer-dev/semlayer ↗통과
- 패키지가 이 저장소를 소스로 명시semlayer names semlayer-dev/semlayer as sourcepypi.org/project/semlayer/ ↗통과
- 빌드 출처(Sigstore 증명)Sigstore attestation for semlayerpypi.org/project/semlayer/ ↗통과
- 오픈 소스 라이선스 (OSI)No license결함 발견
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-13github.com/semlayer-dev/semlayer ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from semlayer통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음the package checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기semlayer
The semantic layer that infers itself — skip the quarter of hand-writing dbt YAML. Fair Source (FSL-1.1-ALv2); the format and its schemas are Apache-2.0.
Point it at your warehouse. It profiles every column, discovers the foreign keys nobody declared, decodes the status columns, finds the business rules hiding in your aggregate tables, and writes the whole thing down as a portable semantic layer in an openly licensed format — with confidence, provenance, and lifecycle on every single claim — ready for any AI agent to consume over MCP.
pip install "semlayer[warehouses]"
semlayer init snowflake # generates the minimal-grant setup script
# `snowflake` reads the environment; `snowflake:<connection>` reads
# ~/.snowflake/connections.toml; `snowflake://user@account/db?role=..` is a URL
semlayer infer snowflake -o layer.yaml \
--context ./docs/ --context ./etl-repo/CLAUDE.md # optional: your wikis/dictionaries as priors
semlayer review layer.yaml # accept/reject what the engine inferred
semlayer mcp layer.yaml # serve it to Claude, Cursor, or any MCP client
semlayer lint layer.yaml query.sql # check any SQL (yours or an agent's) against the layer
semlayer drift layer.yaml snowflake # catch schema changes (cron- and CI-friendly)
Or start from an agent instead of a terminal: add the MCP server to Claude Desktop, Claude Code or Cursor and ask it what it can see — it discovers the warehouses configured on your machine and says what to do next, with no layer built yet. See docs/mcp.md.
In VS Code and Cursor, the same layer underlines the fan-out joins and missing required filters as you type — docs/vscode.md.
From a checkout (to develop on semlayer itself): pip install -e ".[warehouses]".
Why
AI agents fail on real warehouses: frontier models solved just 21.3% of Spider 2.0's enterprise-warehouse tasks at publication (vs ~91% on the earlier academic Spider 1.0) — and even today's best agentic scaffolds only reach ~30%. The fix is a semantic layer — but every existing tool (dbt, LookML, Cube, Snowflake semantic views) makes humans write it by hand, and it goes stale the day someone runs an ALTER TABLE.
On our messy-warehouse benchmark (cryptic names, zero declared constraints, hidden business rules), an agent using the inferred layer answers 82% of business questions correctly vs 42% from the raw schema (+95% relative), with or without the layer's SQL linter — and the errors it fixes are the silent kind: raw-schema "total revenue" happily sums cancelled orders; a fan-out join quietly triples a total. Full benchmark, methodology changes included, and where we DON'T help →
What gets inferred
| Examples from the test suite | |
|---|---|
| Semantic types + roles | sts_cd → status code; tot_amt → monetary measure with sum/avg aggregations; PII flagged recall-first |
| Keys & joins | 104/104 undeclared FKs on TPC-DS-style naming, F1 = 1.0 on our messy fixture — with zero of the seeded false-FK traps accepted (statistics alone never auto-include; naming + LLM must corroborate) |
| Enum decodes | C=Completed, X=Cancelled — joined from the decode dimension the engine itself discovered |
| Business rules | "these aggregate tables reconcile only when sts_cd <> 'X'" — found by hypothesis-testing, scoped to revenue metrics (scope: measures), never to counts; inherited by a child fact only when its line amounts provably sum to the parent's total |
| Grain, SCD2, ratios | "one row per ord_id"; cust_mstr is SCD2 with eff_start_dt/eff_end_dt/is_curr_flg and an as-of join rule; avg_tot_amt_per_order = revenue / orders |
| SQL linting | check_sql (MCP) / semlayer lint (CLI): deterministic checks of any SQL against the layer — missing required filters, fan-out sums, deprecated tables, SCD2 without a validity window, hallucinated columns, vacuous correlated subqueries — each with a fix hint |
| Metrics, routing, deprecation | revenue/count metrics with contract-legal filters; "use ord_hdr, avoid ord_hdr_legacy (superseded)" |
| Descriptions | every table + column, LLM-written from evidence via join-graph context propagation, judged 0.82–0.89 correct+useful by an independent model |
| Your docs as priors | --context ingests data dictionaries, wiki exports, CLAUDE.md files — and tells you where they're wrong: doc-vs-data contradictions go to review, never silent override (guide) |
Everything lands with confidence (calibrated, with the misses published), provenance (which signals produced it), and lifecycle (inferred → reviewed → certified, plus deprecated/orphaned), governed by a normative consumer contract that makes silent misuse — summing across a fan-out, joining SCD2 at current-row, filtering on guessed decodes — non-conforming, not merely unwise.
Cost & privacy
- ~$0.70 per 100 tables end-to-end on the cheap model tier, with your own API key (measured cost model). LLM calls are escalation-only; ~80% of columns resolve from statistics alone.
- Several teams, one surface: each team infers its own schema into its own file; an analyst's hub lists them as
membersand holds the cross-document relationships,semlayer stitchinfers those through the analyst's own connection, and every command takes the hub (docs/sets.md). - Tiers: every table carries a
tier(core, staging, raw, scratch) inferred from its name and ETL columns; raw and scratch tables aremodeling: inventory_only-- listed with their shape, never joined, described, metricised or queued for review column by column. On a 2,000-table synthetic estate that is 62% of tables set aside, the review queue cut 4.4x and foreign-key precision 0.31 → 0.94 (measured). --no-llm: fully deterministic mode, zero API calls, still useful (0.780 typing / 0.834 role across 7 fixtures, against 0.809 / 0.838 with the model) — for orgs where LLM access needs procurement.--no-sample-egress: no value read from a warehouse cell is sent to the LLM, at no net accuracy cost across our 7 fixtures (0.809 typing / 0.842 role, versus 0.809 / 0.838 with samples). Per warehouse it trades rather than being uniformly free — up to a point better or worse. Re-measured 2026-10-03; see docs/cost-model.md.- Two knobs for speed, output identical at any value:
--llm-workers N(default 4) runs that many model calls at once (typing escalation, foreign-key validation, both Describe passes; bounded by your API rate limit, measured 7.2x at 8) and--query-workers Nruns that many foreign-key queries at once in your warehouse (default 4 on a network warehouse, since it spends your compute: measured 3.3x at 4 and 6.7x at 8 on BigQuery; every core on an in-process DuckDB file).--no-llmbuilds still use--query-workers. (measured) - Read-only, minimal-grant:
semlayer initgenerates the grant script; the reader persona is proved unable to write — on PostgreSQL by a test that runs in ordinary CI against a real server (tests/test_postgres.py, no credentials needed), and on Snowflake by a live suite runnable against your own account (tests/test_snowflake_live.py). - Model-response cache, on your disk and nowhere else: each model response is cached in
semlayer/cassettesunder your platform cache directory ($XDG_CACHE_HOMEor~/.cache,~/Library/Cacheson macOS,%LOCALAPPDATA%on Windows), so an interrupted whole-warehouse run resumes without paying for the same prompts twice. The files hold what the model wrote about your schema — descriptions, inferred types, and the enum decodes it returned, which do quote the coded values it was shown (X=Cancelled). No credentials, no result sets, and nothing is sent to us. Switch it off with--no-llm-cacheorSEMLAYER_LLM_CACHE=off, move it withSEMLAYER_LLM_CACHE=<dir>, or keep cell values out of the prompts entirely with--no-sample-egress. - Telemetry: anonymous usage statistics — command, duration, outcome, warehouse type, bucketed table/column counts, version, OS, whether an
inferwas started from the CLI or from an agent, and forsemlayer mcpwhich MCP client connected and which of our tools it called (one of seven fixed words for the client, never its own name; tool names only, never their arguments). Never names, SQL, or data. See exactly what is sent withsemlayer telemetry --show; opt out withsemlayer telemetry --off, or per-shell withSEMLAYER_TELEMETRY=off. (what and why)
Honest scope (beta)
- Best on messy warehouses. On clean, well-named schemas our benchmark shows raw DDL is already sufficient — we publish that negative result rather than hide it. If your warehouse is tidy TPC-DS, you may not need us.
- ETL input: dbt (
--manifest target/manifest.json) -- reads the model DAG to settle join targets statistics cannot. Catalog comments and--contextdocs are read as priors on every run. - Verify it yourself, free:
ANTHROPIC_API_KEY= pytest -qreplays recorded model responses, so every accuracy floor and benchmark number above is checkable with no API key and no spend — including from a fork, where CI has no secrets (what those recordings are, and what is still untidy about them). The warehouses behind the numbers, with sources, pinned versions and licences, are listed in docs/warehouses.md. - Scale: measured to 50,000 tables, as one file or as one layer per team stitched into a hub; the largest real warehouse run so far is about 2,000. Data VOLUME is not the limit -- 4TB and 45TB are the same architecture. The ladder, and how to make it fast.
- Warehouses: Snowflake, BigQuery, PostgreSQL, DuckDB (+ Iceberg on S3 via the DuckDB bridge). PostgreSQL also reaches Redshift and other Postgres-protocol engines, whose catalogs differ in places and are untested. Exporter: dbt (losses reported, never silent). LLM: Anthropic API (Bedrock/Vertex routing is next).
- Not included: hosted service, ontology enrichment (it failed our own ablation gate — receipts), LookML/RDF exporters.
- The eval harness ships in this repo — fixtures, gold layers, competency questions, benchmark runner. Run our numbers yourself:
python fixtures/build.py && pytest tests/ -q.
Beta feedback
Running the beta? File the Beta feedback form. GitHub issues are public and permanent, so the form asks only for numbers you are happy to say out loud — don't paste schema names, role names or the *.report.json the CLI writes next to your output. That file stays on your machine; it records which tables and schemas you scoped the run to, so it is yours, not ours. If you want us to see it, email hello@semlayer.dev — same address for anything else sensitive.
Layout
spec/ format schema + consumer contract · src/semlayer/ the engine · fixtures/ 9 eval warehouses + golds + CQ suites · docs/ benchmark, cost model, spike reports · ARCHITECTURE.md how it works
Licence
Fair Source, not open source. The engine and CLI are FSL-1.1-ALv2: free for any internal use, including in production and CI, with no fee or key; the one prohibition is offering semlayer to third parties as a competing product or service. Every release converts to Apache-2.0 two years after it is published.
The format specification, its JSON Schemas and the exporters are Apache-2.0 — a semantic layer nobody else can read is worth nothing.
Releases 0.1.0b1 through 0.4.0b5 were published under Apache-2.0 and remain so permanently. LICENSING.md has the paths table, the conversion dates, and policy text for security teams.
semlayer MCP 질문
semlayer MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add --env 'ANTHROPIC_API_KEY=<YOUR_ANTHROPIC_API_KEY>' semlayer -- uvx semlayer를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
semlayer MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
사용 비용은 얼마인가요?
자체 API key를 사용하고 저렴한 모델 티어를 이용할 경우, 테이블 100개당 약 $0.70의 비용이 발생합니다.
LLM 없이 사용할 수 있나요?
네, API 호출이 전혀 필요 없는 --no-llm이라는 완전 결정론적 모드를 지원합니다.
실제 데이터를 LLM으로 전송하나요?
--no-sample-egress 플래그를 사용하면 웨어하우스 셀의 값이 LLM으로 전송되지 않도록 보장할 수 있습니다.