🗃️
💾
🔮
🌐
🔗
📊
🚀
🏛️ Historical Blueprint • Architectural Journey

From SQLite Proof-of-Concept to
Universal Database Mastery

Discover the epic journey of how PeopleWorks GPT evolved from a simple SQLite experiment into a multi-database powerhouse supporting SQL Server, PostgreSQL, MySQL, Oracle, MCP integration, and now exploring legacy database frontiers with Visual FoxPro.

SQ
SS
PG
MY
OR
MCP
🦊
5
Database Providers
17
Years SQL Server Support
8
MCP Tools
1
Universal Interface
Legacy Possibilities
🌱 The Beginning

The SQLite Origin Story

Every great journey begins with a single step. For PeopleWorks GPT, that step was SQLite – the simplest database that taught us the most.

💡

Why SQLite First?

SQLite was our laboratory – a zero-configuration, serverless database that let us focus purely on the AI-to-SQL translation challenge without infrastructure complexity. It taught us that simplicity enables innovation. Every line of code we wrote had to work; there was nowhere to hide mistakes.

🔬

Proof of Concept Success

With SQLite, we validated our core hypothesis: AI can reliably translate natural language to SQL when given proper schema context. Our SQLite provider achieved 94% accuracy on test queries, proving the concept was not just viable – it was transformative.

🏗️

Architecture Seeds

SQLite's simplicity forced us to create clean abstractions from day one. The IDatabaseGptProvider interface was born here – a contract that would later enable our multi-database revolution. What started as convenience became our greatest architectural asset.

C# SqliteDatabaseGptProvider.cs - Where It All Began
public class SqliteDatabaseGptProvider(SqliteDatabaseGptProviderConfiguration settings) 
    : IDatabaseGptProvider
{
    private readonly SqliteConnection connection = new(settings.ConnectionString);

    public string Name => "SQLite";
    public string Language => "SQLite";

    // The elegance of simplicity: SQLite uses PRAGMA for schema discovery
    public async Task<IEnumerable<string>> GetTablesAsync(...)
    {
        var tables = await connection.QueryAsync<string>(@"
            SELECT TBL_NAME AS Tables
            FROM sqlite_schema
            WHERE type IN ('table','view') 
            AND name NOT LIKE 'sqlite_%'");
        
        return tables;
    }

    // PRAGMA_TABLE_INFO: SQLite's gift for schema introspection
    public async Task<string> GetCreateTablesScriptAsync(...)
    {
        var query = @"
            SELECT '[' || NAME || '] ' ||
                UPPER(TYPE) || ' ' ||
                CASE WHEN [NOTNULL] = 0 THEN 'NULL' ELSE 'NOT NULL' END
            FROM PRAGMA_TABLE_INFO(@table)";
        
        // Build CREATE TABLE script for AI context...
    }
}
📈 The Journey

Evolution Timeline

From proof-of-concept to enterprise-ready platform – every phase built upon the lessons of the last.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#4facfe', 'primaryTextColor': '#fff', 'primaryBorderColor': '#9d4edd', 'lineColor': '#00f5a0', 'secondaryColor': '#16213e', 'tertiaryColor': '#1a1a2e'}}}%% timeline title PeopleWorks GPT Database Evolution Journey Phase 1 : SQLite POC : Validated NL-to-SQL concept : Created provider abstraction : 94% accuracy achieved Phase 2 : SQL Server : Enterprise production deployment : 2008 R2 - 2025 compatibility : T-SQL dialect mastery Phase 3 : PostgreSQL : Open source expansion : PL/pgSQL support : Cloud-native readiness Phase 4 : MySQL : Web ecosystem integration : MySQL 5.7+ support : LAMP stack compatibility Phase 5 : Oracle : Enterprise tier complete : PL/SQL optimization : Oracle 12c+ support Phase 6 : MCP Server : Universal AI bridge : 8 specialized tools : Protocol standardization Phase 7 : Legacy Vision : Visual FoxPro exploration : dBASE compatibility : Data liberation mission
Phase 1

🌱 SQLite Foundation

Zero-configuration testing ground. Proved AI could reliably translate natural language to SQL. Established the provider pattern that would scale to enterprise databases.

Phase 2

🏢 SQL Server Enterprise

The enterprise leap. Full T-SQL support with intelligent version detection spanning 17 years of SQL Server releases. Foreign key relationship discovery for intelligent JOINs.

Phase 3

🐘 PostgreSQL Integration

Open source powerhouse. PL/pgSQL dialect support with cloud-native architecture for AWS Aurora, Google Cloud SQL, and Azure PostgreSQL deployments.

Phase 4

🐬 MySQL Mastery

Web ecosystem dominance. Complete MySQL dialect support with backtick identifier handling and GROUP_CONCAT for relationship queries.

Phase 5

🔶 Oracle Excellence

Enterprise tier completion. PL/SQL optimization with Oracle's unique dual-table queries and ALL_TAB_COLUMNS metadata extraction.

Phase 6

🌐 MCP Server Revolution

Universal AI bridge. 8 specialized tools exposing DatabaseGPT to any MCP-compatible AI assistant. The "USB-C for AI" architecture.

Phase 7

🦊 Legacy Vision

Data liberation mission. Exploring MCP-powered access to Visual FoxPro, dBASE, and other legacy systems. Decades of institutional knowledge unlocked.

🏗️ Core Architecture

The Provider Pattern

One interface to rule them all. The IDatabaseGptProvider contract enables universal database support without changing application code.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#4facfe', 'primaryTextColor': '#fff', 'primaryBorderColor': '#9d4edd', 'lineColor': '#00f5a0', 'secondaryColor': '#16213e'}}}%% flowchart TB subgraph Client["🎯 Application Layer"] NL[/"Natural Language Query"/] Client1["IDatabaseGptClient"] end subgraph Core["⚙️ DatabaseGPT Core"] AI["AI Query Generator"] Schema["Schema Context Builder"] Validator["Query Validator"] end subgraph Abstraction["🔌 Abstraction Layer"] Interface["IDatabaseGptProvider"] end subgraph Providers["💾 Provider Implementations"] SQLite["SqliteDatabaseGptProvider"] SQLServer["SqlServerDatabaseGptProvider"] PostgreSQL["NpgsqlDatabaseGptProvider"] MySQL["MySqlDatabaseGptProvider"] Oracle["OracleDatabaseGptProvider"] end subgraph Databases["🗄️ Database Engines"] DB1[("SQLite")] DB2[("SQL Server")] DB3[("PostgreSQL")] DB4[("MySQL")] DB5[("Oracle")] end NL --> Client1 Client1 --> AI AI --> Schema Schema --> Interface Interface --> SQLite & SQLServer & PostgreSQL & MySQL & Oracle SQLite --> DB1 SQLServer --> DB2 PostgreSQL --> DB3 MySQL --> DB4 Oracle --> DB5 Validator --> Interface style Client fill:#1e3a5f style Core fill:#2d1f5f style Abstraction fill:#1f5f3d style Providers fill:#5f3d1f style Databases fill:#3d1f5f
C# IDatabaseGptProvider.cs - The Universal Contract
namespace DatabaseGpt.Abstractions;

/// <summary>
/// The contract that enables universal database support.
/// Every database provider must implement these 6 methods.
/// </summary>
public interface IDatabaseGptProvider : IDisposable
{
    // Identity - What database is this?
    string Name { get; }      // e.g., "SQL Server", "PostgreSQL"
    string Language { get; }  // e.g., "T-SQL", "PL/pgSQL"

    // Schema Discovery - What tables exist?
    Task<IEnumerable<string>> GetTablesAsync(
        IEnumerable<string> includedTables,
        IEnumerable<string> excludedTables,
        CancellationToken cancellationToken);

    // Schema Context - Build CREATE TABLE scripts for AI
    Task<string> GetCreateTablesScriptAsync(
        IEnumerable<string> tables,
        IEnumerable<string> excludedColumns,
        CancellationToken cancellationToken);

    // Query Hints - Database-specific optimization tips
    Task<string?> GetQueryHintsAsync(CancellationToken cancellationToken);

    // Normalization - Pre-process queries before execution
    Task<string> NormalizeQueryAsync(string query, CancellationToken cancellationToken);

    // Execution - Run the generated SQL
    Task<DbDataReader> ExecuteQueryAsync(string query, CancellationToken cancellationToken);
}
💾 Provider Implementations

Five Engines, One Interface

Each provider speaks its database's native language while presenting a unified face to the application layer.

SQLite

SQLite Dialect
  • Zero configuration required
  • PRAGMA-based schema discovery
  • sqlite_schema system table
  • Perfect for testing & POC
  • In-memory database support

SQL Server

T-SQL Dialect
  • 2008 R2 - 2025 support
  • INFORMATION_SCHEMA queries
  • FK relationship discovery
  • Schema.Table notation
  • Primary key detection

PostgreSQL

PL/pgSQL Dialect
  • Cloud-native ready
  • Schema filtering (pg_catalog)
  • UNNEST array handling
  • Aurora/Cloud SQL compatible
  • Advanced type support

MySQL

MySQL Dialect
  • Backtick identifier quoting
  • System schema filtering
  • GROUP_CONCAT for FKs
  • KEY_COLUMN_USAGE queries
  • MariaDB compatible

Oracle

PL/SQL Dialect
  • ALL_TAB_COLUMNS metadata
  • ALL_CONSTRAINTS for FKs
  • USER schema filtering
  • Precision/scale handling
  • Oracle 12c+ optimized

Schema Discovery SQL Comparison

Database Table Discovery Method System Schema Exclusion Identifier Quoting
SQLite sqlite_schema WHERE type IN ('table','view') name NOT LIKE 'sqlite_%' [brackets]
SQL Server INFORMATION_SCHEMA.TABLES None (user tables by default) [brackets]
PostgreSQL INFORMATION_SCHEMA.TABLES NOT IN ('pg_catalog', 'information_schema') [brackets] or "quotes"
MySQL INFORMATION_SCHEMA.TABLES NOT IN ('information_schema', 'mysql', ...) `backticks`
Oracle ALL_TABLES WHERE owner = USER USER filter excludes system "quotes" or none

Feature Support Matrix

Feature SQLite SQL Server PostgreSQL MySQL Oracle
Schema Discovery
Column Metadata
Primary Key Detection
Foreign Key Discovery
Schema.Table Support
Type Precision Basic Full Full Full Full
Query Hints Planned Planned Planned Planned
⚡ Processing Flow

The 5-Step NL2SQL Pipeline

From natural language question to executed SQL results – a journey through intelligent processing.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#4facfe', 'primaryTextColor': '#fff', 'primaryBorderColor': '#9d4edd', 'lineColor': '#00f5a0'}}}%% sequenceDiagram participant U as 👤 User participant C as 🎯 Client participant P as 💾 Provider participant AI as 🤖 AI Model participant DB as 🗄️ Database U->>C: "Show top 10 customers by revenue" Note over C: Step 1: Session Init C->>P: GetTablesAsync() P->>DB: Query system catalog DB-->>P: Available tables P-->>C: [Customers, Orders, Products...] Note over C: Step 2: Table Selection C->>AI: Which tables for this query? AI-->>C: [Customers, Orders] Note over C: Step 3: Schema Context C->>P: GetCreateTablesScriptAsync([Customers, Orders]) P->>DB: Query column metadata + FKs DB-->>P: Schema details P-->>C: CREATE TABLE scripts + relationships Note over C: Step 4: SQL Generation C->>AI: Generate SQL with schema context AI-->>C: SELECT TOP 10 c.Name, SUM(o.Total)... Note over C: Step 5: Execution C->>P: ExecuteQueryAsync(sql) P->>DB: Run validated SQL DB-->>P: Result set P-->>C: DbDataReader C-->>U: Formatted results
1

Session Initialization

Establish database connection and retrieve available tables using GetTablesAsync(). Respect inclusion/exclusion filters to focus the AI on relevant data.

2

Intelligent Table Selection

AI analyzes the natural language query against available tables to determine which tables are needed. This step prevents overwhelming the AI with unnecessary schema information.

3

Schema Context Retrieval

Build detailed CREATE TABLE scripts via GetCreateTablesScriptAsync(), including column names, data types, nullability, primary keys, and foreign key relationships for intelligent JOIN suggestions.

4

SQL Query Generation

AI generates database-specific SQL using the schema context and database hints. The generated query is optimized for the target dialect (T-SQL, PL/pgSQL, MySQL, PL/SQL).

5

Query Validation & Execution

Validate the generated SQL, normalize if needed via NormalizeQueryAsync(), then execute with ExecuteQueryAsync(). Return results through a standard DbDataReader interface.

🌐 Universal Bridge

MCP Server Integration

The Model Context Protocol Server exposes DatabaseGPT capabilities to any MCP-compatible AI assistant – the "USB-C for AI".

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#9d4edd', 'primaryTextColor': '#fff', 'primaryBorderColor': '#4facfe', 'lineColor': '#00f5a0'}}}%% flowchart LR subgraph Clients["🤖 AI Clients"] Claude["Claude Desktop"] STR["STRPlatform"] Custom["Custom Apps"] end subgraph MCP["🌐 MCP Server"] Auth["🔐 Auth Tool"] Query["📊 Query Tool"] Schema["📋 Schema Tool"] Hints["💡 Hints Tool"] Connect["🔌 Connection Tool"] Explain["📖 Explain Tool"] Suggest["❓ Suggest Tool"] Analyze["📈 Analyze Tool"] end subgraph Core["⚙️ DatabaseGPT Core"] Provider["IDatabaseGptProvider"] AI["AI Providers"] end subgraph DB["🗄️ Databases"] SS[("SQL Server")] PG[("PostgreSQL")] MY[("MySQL")] OR[("Oracle")] end Claude & STR & Custom --> MCP Auth & Query & Schema & Hints & Connect & Explain & Suggest & Analyze --> Provider Provider --> AI Provider --> SS & PG & MY & OR style Clients fill:#1e3a5f style MCP fill:#3d1f5f style Core fill:#1f5f3d style DB fill:#5f3d1f

8 Specialized MCP Tools

🔐

AuthenticationTool

Secure JWT-based authentication with session management

🔌

ConnectionManagementTool

List and manage available database connections

📊

QueryExecutionTool

Execute natural language queries with full audit trail

📋

SchemaManagementTool

Explore database structure, tables, and relationships

💡

HintsManagementTool

Access and manage database-specific query hints

SuggestedQuestionsTool

Get AI-powered question suggestions based on schema

📖

ExplainQueryTool

Detailed explanations of generated SQL queries

📈

DataAnalysisTool

Advanced analytics and pattern discovery

C# QueryExecutionTool.cs - MCP Tool Implementation
[McpServerToolType]
public sealed class QueryExecutionTool
{
    private readonly SessionManager _sessionManager;
    private readonly QueryExecutionService _queryExecutionService;
    private readonly AuditLogger _auditLogger;

    [McpServerTool(Name = "ExecuteQueryAsync")]
    [Description("Execute a natural language query against a database")]
    public async Task<string> ExecuteQueryAsync(
        [Description("Session token from authenticate()")] string sessionToken,
        [Description("Database connection ID")] long connectionId,
        [Description("Natural language query")] string query,
        [Description("Include hints in context")] bool includeHints = true)
    {
        // Validate session
        var (isValid, userId, _) = _sessionManager.ValidateToken(sessionToken);
        if (!isValid)
            return JsonSerializer.Serialize(new { success = false, error = "Invalid token" });

        // Execute query through DatabaseGPT infrastructure
        var (sql, results) = await _queryExecutionService
            .ExecuteNaturalLanguageQueryAsync(connection, query, includeHints);

        // Log audit trail
        await _auditLogger.LogQueryAsync(userId, connectionId, query, sql, ...);

        return JsonSerializer.Serialize(new {
            success = true,
            generated_sql = sql,
            results = results,
            row_count = results.Count
        });
    }
}
🦊 The Next Frontier

Legacy Database Vision

Decades of institutional knowledge locked in legacy databases. MCP opens the door to data liberation.

🔮 Exploring: Visual FoxPro & Beyond

The Data Liberation Mission

Millions of records sit in legacy systems like Visual FoxPro, dBASE, and Paradox – systems that powered businesses for decades. Through MCP, we envision giving AI assistants the ability to query these treasure troves of historical data, without requiring migration or modernization.

%%{init: {'theme': 'dark', 'themeVariables': { 'primaryColor': '#8b4513', 'primaryTextColor': '#fff', 'primaryBorderColor': '#d4a76a', 'lineColor': '#ffd700'}}}%% flowchart TB subgraph Future["🔮 Future MCP Legacy Support"] MCP["MCP Server"] FoxPro["🦊 Visual FoxPro Provider"] dBase["📂 dBASE Provider"] Paradox["💾 Paradox Provider"] Access["📊 Access Provider"] end subgraph Legacy["🗄️ Legacy Data Sources"] DBF[(".DBF Files")] FPT[(".FPT Memo Files")] CDX[(".CDX Indexes")] MDB[(".MDB Files")] end subgraph AI["🤖 AI Assistants"] Claude["Claude Desktop"] GPT["ChatGPT"] Custom["Enterprise Apps"] end AI --> MCP MCP --> FoxPro & dBase & Paradox & Access FoxPro --> DBF & FPT & CDX dBase --> DBF Paradox --> Legacy Access --> MDB style Future fill:#5f3d1f style Legacy fill:#3d2d1f style AI fill:#1f3d5f

Legacy Databases Under Exploration

🦊
Visual FoxPro

.DBF + .FPT + .CDX

📂
dBASE

.DBF Files

💾
Paradox

.DB Files

📊
MS Access

.MDB / .ACCDB

📁
Clipper

.NTX Indexes

💡 The Vision

Imagine asking Claude: "Show me customer trends from our 1998 FoxPro database compared to current SQL Server data" – and getting instant, unified answers without any migration effort. That's the power of MCP-enabled legacy access.

Ready to Explore the Journey?

Experience universal database support firsthand. From SQLite to Oracle, from MCP integration to legacy data liberation – PeopleWorks GPT opens every door.