Database Intelligence Layer

by terno-ai

203 downloads
Not rated
GitHub

About

TernoDBI is a database intelligence layer designed for Security and Accuracy, bridging the gap between AI Agents and Enterprise Data. It acts as a powerful standalone Model Context Protocol (MCP) server, or it can be directly embedded into your existing Django projects. Either wa

Details

Author
terno-ai
Downloads
203
Categories
Database, AI, Security, Other

- Multi-database support: Postgres, MySQL, Snowflake, BigQuery, Databricks, Oracle, SQLite
- Split MCP architecture: Query Server (read-only) and Admin Server (write/management)
- Enterprise-grade security: Row-Level Security, Privacy-by-Default, SQLShield AST validation
- LLM-ready schema enrichment with semantic metadata and statistical profiling
- High-performance cursor-based pagination (HMAC) with ~28x speedup
- Direct integration into existing Django projects as an embedded app

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Database Intelligence Layer
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install via pip install terno-dbi, run ternodbi start, configure datasources in the admin panel, generate an access token with the CLI (ternodbi manage issue_token), then connect MCP clients like Claude Desktop using the provided JSON configuration. The server runs on 127.0.0.1:8376.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "database intelligence layer": {
            "ternodbi-query": {
                "command": "uvx",
                "args": [
                    "--from",
                    "terno-dbi",
                    "dbi-mcp",
                    "query"
                ],
                "env": {
                    "TERNODBI_API_URL": "http://127.0.0.1:8376",
                    "TERNODBI_API_KEY": "dbi_query_YOUR_TOKEN_HERE"
                }
            },
            "ternodbi-admin": {
                "command": "uvx",
                "args": [
                    "--from",
                    "terno-dbi",
                    "dbi-mcp",
                    "admin"
                ],
                "env": {
                    "TERNODBI_API_URL": "http://127.0.0.1:8376",
                    "TERNODBI_API_KEY": "dbi_admin_YOUR_TOKEN_HERE"
                }
            }
        }
    }
}

McpServers

{
    "ternodbi-query": {
        "command": "uvx",
        "args": [
            "--from",
            "terno-dbi",
            "dbi-mcp",
            "query"
        ],
        "env": {
            "TERNODBI_API_URL": "http://127.0.0.1:8376",
            "TERNODBI_API_KEY": "dbi_query_YOUR_TOKEN_HERE"
        }
    },
    "ternodbi-admin": {
        "command": "uvx",
        "args": [
            "--from",
            "terno-dbi",
            "dbi-mcp",
            "admin"
        ],
        "env": {
            "TERNODBI_API_URL": "http://127.0.0.1:8376",
            "TERNODBI_API_KEY": "dbi_admin_YOUR_TOKEN_HERE"
        }
    }
}

TernoDBI: Database Intelligence Layer

License
Python
Django

TernoDBI is a database intelligence layer designed for Security and Accuracy, bridging the gap between AI Agents and Enterprise Data. It acts as a powerful standalone Model Context Protocol (MCP) server, or it can be directly embedded into your existing Django projects. Either way, it provides a unified, secure API for interacting with warehouse-scale databases while enforcing strict access controls and optimizing the database schema context for LLMs.

Quick Start: Chat with your DB in 5 Minutes

The easiest way to get started is to run TernoDBI locally and connect your favorite AI agent.

1. Install TernoDBI

   pip install terno-dbi

2. Start the Server
   ternodbi start

(This automatically runs migrations, creates a default admin/admin user, and starts the server securely on 127.0.0.1:8376)
3. Configure your Database
Open the admin panel at http://127.0.0.1:8376/admin and add your datasource connections.
4. Generate an Access Token
Generate a token from the Admin UI or via the CLI:
   ternodbi manage issue_token --name "My Agent" --type query

5. Configure MCP (See MCP Integration below)
6. Start chatting with your enterprise data!

Key Features

Multi-Database Support: Out-of-the-box unified connection handling for Postgres, MySQL, Snowflake, BigQuery, Databricks, Oracle, and SQLite.
Split MCP Architecture:
Query Server: Read-only operations (list tables, schema info, execute SELECT queries) highly optimized for AI agents.
Admin Server: Write/Management operations (rename tables, update metadata, manage descriptions) designed for human-in-the-loop workflows.
Enterprise-Grade Security:
Row-Level Security (RLS): Define strict SQL-based filters (e.g., department_id = 5) that are automatically injected into every executed query.
Privacy-by-Default: Hide sensitive tables or columns from the LLM's context window unless explicitly exposed to specific Roles.
SQLShield: Automatic AST-based SQL validation preventing prompt injection and destructive operations.
LLM-Ready Schema Enrichment:
Semantic Metadata: Decouple physical database names (e.g., t_users_v2_fnl) from clean, user-facing semantic names (Customers).
Statistical Profiling: Automatic cardinality and distribution statistics injection to help LLMs consistently generate correct SQL filters.
High-Performance Pagination:
Cursor-Based (HMAC): $O(1)$ performance. Benchmarks demonstrate a ~28x speedup over offset pagination.
Server-Side Streaming: Effortlessly export millions of rows via server-side cursors.

Usage & Core APIs

Running the API Server

ternodbi start

Management Commands (CLI)

Automate your credential and access management simply via the built-in CLI:

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.