by ralforion
Analyzes relational database schemas and generates RDF/OWL ontologies with embedded SQL mappings, delivering fan‑trap‑free Text‑to‑SQL, GraphRAG‑driven schema discovery, and interactive Plotly charting through any MCP‑compatible AI client.
OrionBelt Analytics is an MCP server that inspects the structure of supported relational databases (PostgreSQL, Snowflake, ClickHouse, Dremio, BigQuery, DuckDB, MySQL, Databricks) and automatically creates W3C‑compliant RDF/OWL ontologies. The ontologies contain oba: namespace annotations that map OWL classes and properties to actual tables, columns, and foreign‑key relationships, enabling deterministic, fan‑trap‑free Text‑to‑SQL generation.
git clone https://github.com/ralforion/orionbelt-analytics && cd orionbelt-analytics && uv sync (Python 3.13+ required)..env.template to .env and fill in the credentials for the target database.uv run server.py. The service listens on http://localhost:9000 by default.mcp-remote example or any MCP‑compatible SDK.discover_schema, generate_ontology, execute_sql_query, graphrag_search, and generate_chart to explore data, validate queries, and visualise results.oba: SQL annotations.sampling/createMessage tool.Q: Which databases are supported? A: PostgreSQL, MySQL, Snowflake, ClickHouse, Dremio, BigQuery, DuckDB/MotherDuck, and Databricks SQL.
Q: Do I need a GPU or heavy hardware? A: No. The server runs on CPU; only the LLM client (e.g., Claude Desktop) performs inference.
Q: How does OBQC differ from typical LLM‑only validation? A: OBQC is rule‑based and deterministic – it cross‑checks every SQL element against the loaded ontology without invoking an LLM, blocking execution on hard errors and emitting warnings for potential issues.
Q: Can I import a custom ontology?
A: Yes. Use the load_my_ontology tool to load a .ttl file from the import folder, then query it via SPARQL or generate SQL against it.
Q: Is there a Docker image?
A: A Docker Hub image (ralforion/orionbelt-analytics) is provided; you can run it with docker run -p 9000:9000 ralforion/orionbelt-analytics after setting environment variables.
Q: How is security handled?
A: The server isolates each session, supports optional HTTPS via transport configuration, and sanitises SQL inputs through sqlglot before execution.
OrionBelt Analytics is an MCP server that analyzes relational database schemas and generates RDF/OWL ontologies with embedded SQL mappings. It provides relationship-aware Text-to-SQL with automatic fan-trap prevention, GraphRAG for intelligent schema discovery, and interactive charting -- all accessible through any MCP-compatible AI client.
| Project | Purpose |
|---|---|
| OrionBelt Analytics (this) | Schema analysis, ontology generation, GraphRAG, Text-to-SQL |
| OrionBelt Semantic Layer | Declarative YAML models compiled into dialect-specific, fan-trap-free SQL |
| OrionBelt Ontology Builder | Visual OWL ontology editor with reasoning and graph visualization (live demo) |
| OrionBelt Chat | AI chat UI for Analytics + Semantic Layer (Chainlit, multiple LLM providers) |
Run Analytics and Semantic Layer side-by-side in Claude Desktop for schema-aware ontology generation and guaranteed-correct SQL compilation.
oba: namespace SQL annotations and W3C R2RML mappingssuggest_semantic_names asks the host LLM to pre-fill rename suggestions for cryptic identifiers via sampling/createMessage, collapsing the previous review-then-apply flow into a single tool call. Clients without sampling support (e.g. Claude Desktop) silently fall back to the manual review pathA key differentiator of OrionBelt is OBQC (Ontology-Based Query Check), a deterministic, rule-based SQL validator that catches errors before queries reach the database. Unlike LLM-only approaches that rely on the model "getting it right," OBQC cross-references every generated SQL statement against the loaded RDF/OWL ontology to enforce structural correctness.
What OBQC validates:
| Check | What it catches |
|---|---|
| Table existence | References to tables that don't exist in the schema |
| Column existence | References to columns not present in their table, ambiguous unqualified columns |
| Join validity | Missing join conditions (Cartesian products), join columns that don't match declared foreign keys |
| Type compatibility | WHERE/ON comparisons between incompatible types (e.g. string vs. integer) |
| Aggregation correctness | SELECT columns missing from GROUP BY when aggregates are used |
| Fan-trap detection | Aggregations across multiple one-to-many joins that silently multiply results |
How it works:
generate_ontology or load_my_ontology creates/loads an ontology with oba: namespace annotations that map OWL classes and properties to actual database tables, columns, types, and foreign keys.execute_sql_query is called, OBQC parses the SQL with sqlglot and validates every table, column, join, and aggregation against the ontology's schema model.OBQC is fully deterministic -- no LLM calls, no probabilistic reasoning. It acts as a safety net that complements the LLM's SQL generation with hard structural guarantees. Errors block query execution; warnings are attached to the response for the LLM to act on. See OBQC documentation for the full rule reference, severity behavior, and annotation requirements.
git clone https://github.com/ralforion/orionbelt-analytics
cd orionbelt-analytics
uv sync
Requires Python 3.13+ and uv.
cp .env.template .env
Edit .env with your database credentials. At minimum, set the variables for one database (e.g. POSTGRES_HOST, POSTGRES_PORT, POSTGRES_DATABASE, POSTGRES_USERNAME, POSTGRES_PASSWORD).
See docs/configuration.md for all environment variables, transport options, and troubleshooting.
uv run server.py
The server starts on http://localhost:9000 (HTTP transport, configurable via MCP_SERVER_PORT).
Start the server, then add to your claude_desktop_config.json:
{
"mcpServers": {
"OrionBelt-Analytics": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:9000/mcp",
"--transport",
"http-only"
]
}
}
}
claude mcp add orionbelt-analytics http://localhost:9000/mcp
Set MCP_TRANSPORT=sse in .env, restart the server, then add to librechat.yaml:
mcpServers:
OrionBelt-Analytics:
url: "http://host.docker.internal:9000/sse"
timeout: 60000
startup: true
OrionBelt works with LangChain, OpenAI Agents SDK, CrewAI, Google ADK, Vercel AI SDK, n8n, and ChatGPT Custom GPTs. See docs/integrations.md for setup examples.
OrionBelt exposes 26 MCP tools. Here is a summary by category:
| Tool | Description |
|---|---|
connect_database |
Connect to any supported database using .env credentials |
list_schemas |
List available schemas in the connected database |
reset_cache |
Clear cached schema and ontology data for the current session |
discover_schema |
Analyze schema structure with automatic GraphRAG + ontology generation |
get_table_details |
Get detailed column, key, and constraint info for a specific table |
cleanup_workspace |
Delete all workspace files for the current connection and start fresh |
| Tool | Description |
|---|---|
generate_ontology |
Generate RDF/OWL ontology from schema with SQL mapping annotations |
suggest_semantic_names |
Detect abbreviations and cryptic names for business-friendly renaming |
apply_semantic_names |
Apply LLM-suggested semantic names and descriptions to ontology |
load_my_ontology |
Load a custom .ttl ontology file from an import folder |
download_artifact |
Download ontology or R2RML mapping as a Turtle file |
| Tool | Description |
|---|---|
sample_table_data |
Preview table data with row limit and injection protection |
execute_sql_query |
Execute SQL with OBQC validation, security checks, and fan-trap detection |
generate_chart |
Generate Plotly charts (bar, line, scatter, heatmap) with MCP-UI rendering |
| Tool | Description |
|---|---|
graphrag_search |
Semantic search + schema overview (auto-initialized by discover_schema) |
graphrag_query_context |
Get optimized context for SQL generation (85-95% token reduction) |
graphrag_find_join_path |
Discover join paths between tables via graph traversal |
reachable_from |
Dimension-capable tables for an anchor grain (many-to-one closure) |
measurable_from |
Measure-capable tables for an anchor grain (one-to-many closure) |
plan_composite_query |
Advise a fan-trap-safe Composite Fact Layer (UNION ALL) decomposition |
| Tool | Description |
|---|---|
store_ontology_in_rdf |
Persist ontology in Oxigraph for SPARQL access |
query_sparql |
Execute SPARQL queries (SELECT, ASK, CONSTRUCT — auto-detected) |
add_rdf_knowledge |
Add custom metadata triples to the RDF store |
| Tool | Description |
|---|---|
save_semantic_model |
Save a semantic model (e.g., OBML YAML) to the workspace |
get_semantic_model |
Retrieve a stored semantic model by name |
list_semantic_models |
List all stored semantic models for the current connection |
For full parameter details, return values, and examples, see docs/tools-reference.md.
Full analysis session:
connect_database("postgresql") -> discover_schema("public") -> generate_ontology() -> execute_sql_query(...)
Quick data exploration:
connect_database("duckdb") -> list_schemas() -> sample_table_data("events")
Query with visualization:
execute_sql_query(query) -> generate_chart(data, "bar", ...)
execute_sql_query runs OBQC validation, security checks, and fan-trap detection before executing — no separate validation step is needed.
Resume a previous session (auto-restores workspace):
connect_database("postgresql") -> execute_sql_query(...)
| Document | Contents |
|---|---|
| Tools Reference | Full parameter docs, return values, and usage examples |
| Configuration | Environment variables, transport setup, troubleshooting |
| GraphRAG | Graph-based schema intelligence and OBML workflow |
| OBQC Overview | Short explanation of how OBQC works inside OrionBelt Analytics |
| OBQC | Validation rules, severity levels, blocking behavior, annotation requirements |
| Fan-Trap Prevention | The fan-trap problem, detection, and safe SQL patterns |
| Integrations | LangChain, OpenAI, CrewAI, Google ADK, Vercel, n8n, ChatGPT |
| Development | Project structure, testing, contributing |
Copyright 2025-2026 RALFORION d.o.o.
Licensed under the Business Source License 1.1. The Licensed Work will convert to Apache License 2.0 on 2030-03-16.
By contributing to this project, you agree to the Contributor License Agreement.
For commercial licensing inquiries, contact: licensing@ralforion.com
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by mindsdb
Enables humans, AI agents, and applications to retrieve highly accurate answers across large‑scale data sources, unifying heterogeneous databases, warehouses, and SaaS platforms.
by mckinsey
Build high-quality data visualization apps quickly using a low-code toolkit that leverages Plotly, Dash, and Pydantic.
by antvis
Offers over 25 AntV chart types for automated chart generation and data analysis, callable via MCP tools, CLI, HTTP, SSE, or streamable transports.
by dbt-labs
Provides a Model Context Protocol server that exposes a rich set of dbt‑related tools—SQL execution, semantic‑layer queries, discovery APIs, dbt CLI commands, admin operations, code generation, lineage analysis, and product documentation retrieval—so AI agents can safely interact with dbt projects and platforms.
by reading-plus-ai
A versatile tool that enables interactive data exploration through prompts, CSV loading, and script execution.
by Canner
Provides a semantic engine that lets MCP clients and AI agents query enterprise data with contextual understanding, precise calculations, and built‑in governance.
by surendranb
Provides natural‑language access to Google Analytics 4 data via MCP, exposing over 200 dimensions and metrics for Claude, Cursor and other compatible clients.
by ergut
Provides secure, read‑only access to BigQuery datasets, allowing large language models to query and analyze data through a standardized interface.
by isaacwasserman
Provides an interface for LLMs to visualize data using Vega‑Lite syntax, supporting saving of data tables and rendering visualizations as either a full Vega‑Lite specification (text) or a base64‑encoded PNG image.