Semantic BI MCP
Model Context Protocol (MCP) server that gives AI assistants a safe, correct data-analyst capability over business metrics - without raw SQL improvisation.
README
Semantic BI MCP
Model Context Protocol (MCP) server that gives AI assistants a safe, correct data-analyst capability over business metrics - without raw SQL improvisation.
Talk to your data in plain English. Get answers that are always correct and can never break anything.
What makes this different
Most data MCPs expose a raw SQL runner and let the model improvise. That miscounts, mis-joins, ignores soft-deletes, and can mutate or leak data.
This project does the opposite: a semantic layer. Every business metric is defined once as vetted SQL in lib/metrics.ts and exposed as an MCP tool. The model assembles answers from correct building blocks. Guardrails (read-only, caps, PII masking, audit log) are first-class features.
Architecture
One Next.js app, four layers:
| Layer | Path | Purpose |
|---|---|---|
| MCP server | app/api/[transport]/route.ts |
Tools, resources, prompts at /api/mcp |
| Semantic layer | lib/ |
sql.js dataset, metrics, guards, audit, auth |
| LangChain agent | app/api/chat/route.ts |
gpt-4o-mini -> MCP over HTTP |
| Chat UI | app/page.tsx + components/ |
Live tool-call visualization |
Tech stack
- Next.js 15 (App Router), TypeScript, Tailwind CSS 4
- MCP:
mcp-handler+@modelcontextprotocol/sdk@^1.26 - Data:
sql.js(WASM SQLite, serverless-safe) - Agent:
@langchain/mcp-adapters,@langchain/langgraph,@langchain/openai - Deploy: Vercel Pro + Fluid compute
Quick start
See INSTALLATION.md for full setup including environment variables.
npm install
cp .env.example .env.local # fill in keys
npm run dev
- Chat UI: http://localhost:3000
- MCP endpoint: http://localhost:3000/api/mcp
- MCP Inspector:
npx @modelcontextprotocol/inspector
MCP capabilities
Tools (11)
| Tool | Description |
|---|---|
get_mrr |
Monthly Recurring Revenue |
get_arr |
Annual Recurring Revenue |
get_churn_rate |
Subscription churn % |
get_active_subscriptions |
Active/trialing count by tier |
get_new_customers |
New customer acquisitions |
get_revenue_by_plan |
Paid revenue by plan |
get_customer_count |
Active customer count |
get_net_revenue_retention |
NRR between two months |
safe_query |
Read-only SELECT on whitelisted views |
list_metrics |
Metric catalog |
get_audit_log |
Recent tool invocations |
Resources (3)
dataset://schema- table/view definitionssemantic-layer://catalog- metric catalog JSONdataset://stats- dataset overview
Prompts (3)
executive-summary- monthly SaaS health summarymrr-trend-analysis- compare two monthschurn-investigation- structured churn analysis
Security
See SECURITY.md for the full security audit and status.
Project docs
- INSTALLATION.md - setup and env var guide
- SECURITY.md - security posture and audit
License
Neural LB - portfolio / demo use. Dataset is fictional (Northwind SaaS).
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.