Skip to content

Foggy Data MCP BridgeAI-Native Semantic Layer Framework

Enable AI assistants to query business data safely and accurately through MCP protocol

Why This Project?

❌ The Problem: Letting AI Write SQL Directly is Dangerous

ProblemImpact
Security RisksAI may generate DELETE, UPDATE, or access sensitive tables
Schema ExposureMust share complete database schema with AI
No Business SemanticsWhat does order_status=3 mean? AI doesn't know
Complex JOINsMulti-table relationships and aggregations are fragile

✅ Our Solution: Semantic Layer with DSL Query Language

AI → JSON DSL Query → Semantic Layer → Safe SQL → Database

                    • Prevents SQL injection
                    • Enforces access control
                    • Handles multi-table JOINs
                    • Abstracts database dialects

Example: AI only needs to know semantic meaning, not database internals

json
{
  "model": "FactSalesQueryModel",
  "columns": ["customer$name", "sum(totalAmount)"],
  "filters": [{"field": "orderDate", "op": ">=", "value": "2024-01-01"}],
  "orderBy": [{"field": "totalAmount", "dir": "DESC"}],
  "limit": 10
}

🎯 Use Cases

📊 Business Intelligence

  • Ad-Hoc Queries - Business users ask questions in natural language
  • Multi-Dimensional Analysis - Group by dimensions, aggregate measures
  • KPI Dashboards - Track metrics with calculated fields

🔍 Data Analysis Platform

  • Self-Service Analytics - Non-technical users query data without SQL
  • Dynamic Filtering - Flexible conditions without schema knowledge
  • Data Exploration - AI helps discover insights

🏢 Enterprise Data Gateway

  • Unified Data Access - Single semantic layer across multiple databases
  • Access Control - Role-based field-level permissions
  • Audit Logging - Track all data access

🚀 Quick Start

Docker One-Click Start:

bash
git clone https://github.com/foggy-projects/foggy-data-mcp-bridge.git
cd foggy-data-mcp-bridge/docker/demo
docker compose up -d

Claude Desktop Configuration:

json
{
  "mcpServers": {
    "foggy-dataset": {
      "url": "http://localhost:7108/mcp/analyst/rpc"
    }
  }
}

Then query data using natural language:

  • "Show me sales by brand for the last week"
  • "Which products had the highest return rate last month?"
  • "Generate a chart comparing revenue by region"

📦 Core Modules

ModuleDescriptionDocs
foggy-dataset-modelSemantic layer engine - TM/QM modeling, DSL query executionGuide
foggy-datasetDatabase abstraction - Multi-database dialect supportQuery Layer
foggy-fsscriptScript engine - JavaScript-like syntax for TM/QM filesFSScript Guide
foggy-dataset-mcpMCP server - AI assistant integrationMCP Service

📘 TM/QM Modeling

📗 FSScript Engine