# DBchat

> A powerful MCP server that lets you have natural language conversations with your database. Ask it to do complex analysis, generate beautiful visualizations, or build custom interactive dashboards based your data. Works with any JDBC-compatible database with support for most SQL DBs like PostgreSQL, MySQL, Oracle, SQL Server, SQLite, MongoDB, etc

- **Type:** MCP server
- **Install:** `agentstack add mcp-skanga-dbchat`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [skanga](https://agentstack.voostack.com/s/skanga)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [skanga](https://github.com/skanga)
- **Source:** https://github.com/skanga/DBchat

## Install

```sh
agentstack add mcp-skanga-dbchat
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# DBChat - Talk to Your Database using AI

Transform your database into an intelligent conversational partner. Ask questions in plain English, get instant answers, and create beautiful visualizations - all through Claude Desktop or any other MCP Client.

## 🌟 What is DBChat?

DBChat is a bridge that connects any MCP client like Claude Desktop, Gemini-CLI, etc to your database, enabling natural language database interactions. Instead of writing SQL queries, simply ask the chatbot questions about your data and get instant, intelligent responses.

If you want a guided product tour, see [TUTORIAL.md](TUTORIAL.md). But if you only want to see the results of a sample TUTORIAL run then see [TUTORIAL-DEMO.html](http://htmlpreview.github.io/?https://github.com/skanga/DBchat/blob/main/TUTORIAL-DEMO.html).

If you want to focus on charts and visual output, see [VISUALIZATION.md](VISUALIZATION.md).

**Before DBChat:**
```sql
SELECT c.name, COUNT(o.id) as order_count, SUM(o.total) as revenue 
FROM customers c 
LEFT JOIN orders o ON c.id = o.customer_id 
WHERE o.created_at >= '2024-01-01' 
GROUP BY c.id, c.name 
ORDER BY revenue DESC 
LIMIT 10;
```

**With DBChat:**
```
"Show me our top 10 customers by revenue this year"
```

## 🎯 Why Use DBChat?

### 🗣️ Natural Language Database Queries
- **Ask questions in plain English**: "How many customers signed up last month?"
- **Get conversational responses**: The LLM explains the data and provides business insights
- **No SQL knowledge required**: Perfect for business users and analysts

### 📊 Instant Data Visualizations
- **Automatic chart creation**: Claude generates beautiful charts from your data
- **Multiple chart types**: Line charts, bar charts, pie charts, scatter plots, and more
- **Interactive visuals**: Drill down into your data with follow-up questions

### 🔍 Smart Data Exploration
- **Database discovery**: "What tables do we have?" "Show me the customer table structure"
- **Relationship understanding**: The AI model explains how your tables connect
- **Data quality improvements**: Find duplicates, missing data, and anomalies

### 💼 Business Intelligence Made Easy
- **Executive dashboards**: "Create a sales summary for our board meeting"
- **Trend analysis**: "Show me user growth over the past 6 months"
- **Performance metrics**: "Which products are underperforming?"

## ✨ Advanced Features

DBChat now includes powerful features for interactive demos, onboarding, collaborative analysis, and sophisticated business intelligence workflows.

### 🚀 MCP Prompts Support
Revolutionary structured workflow system for guided database analysis and business intelligence.
- **Professional Business Scenarios**: Pre-built scenarios for Retail/E-commerce, Finance/Banking, and Logistics with realistic business contexts
- **Interactive Demo Templates**: Complete 15-20 minute guided workflows with:
  - Business narratives with protagonists and deadlines
  - Step-by-step analytical progression
  - Multiple choice decision points
  - Expected outcomes and insights for each step
- **Three Sophisticated Prompt Types**:
  - `mcp-demo` - Complete interactive demo with business scenarios
  - `business-intelligence` - Comprehensive BI analysis framework  
  - `database-analysis` - Enhanced database exploration workflow
- **MCP Protocol Integration**: Full compliance with MCP prompts protocol including `prompts/list` and `prompts/get` handlers
- **How to start**: Use any prompt-aware MCP client and select from available structured prompts for guided analysis

### 🎯 Interactive Multiple Choice Workflow System
Sophisticated workflow engine for structured data exploration and analysis.
- **Structured Progressions**: Step-by-step workflows with contextual multiple choice options
- **Scenario-Specific Content**: Tailored workflows for retail, finance, and logistics business domains
- **State Management**: Tracks user choices and workflow progression throughout analysis sessions
- **New MCP Tools**:
  - `start_workflow` - Initiates interactive analysis workflows with business context
  - `workflow_choice` - Processes user selections and advances workflow steps
- **MCP Resources**: `workflow://status` resource shows active workflow status and progress
- **Integration Ready**: Seamlessly works with demo data setup and insights collection systems

### 🛠️ Automatic Demo Data Setup
Intelligent database population system for demonstrations and onboarding.
- **Realistic Business Scenarios**: Choose from Retail, Finance, or Logistics domains
- **Database-Agnostic**: Works across all supported database types and configurations
- **Comprehensive Data Models**:
  - **Retail**: Customers, Products, Orders, Inventory with realistic relationships
  - **Finance**: Accounts, Transactions, Customers, Loans with financial data patterns
  - **Logistics**: Shipments, Routes, Warehouses, Deliveries with supply chain data
- **Instant Setup**: Creates five related tables per scenario with representative synthetic data sized for demos and guided analysis
- **Sample Analytics**: Pre-built queries and analysis examples for each scenario
- **Cleanup Capabilities**: Automatic reset and cleanup functionality for fresh demonstrations

### 🧠 Enhanced Insights Collection System
Professional business intelligence capture and reporting system.
- **Structured Insight Model**: Comprehensive insights with categories, priorities, timestamps, and metadata
- **`append_insight` Tool**: Advanced tool for capturing structured business findings with:
  - Content validation and sanitization
  - Automatic categorization with visual indicators
  - Priority assignment (high/medium/low)
  - Security audit logging
- **Professional Memo Generation**:
  - **Comprehensive Memos**: Executive summaries, categorized findings, priority insights, timeline analysis
  - **Quick Summaries**: Fast consumption format for rapid business updates
  - **Multi-format Support**: Both detailed and summary formats available
- **MCP Resources Integration**:
  - `insights://memo` - Professional business intelligence report
  - `insights://summary` - Quick overview of collected insights
  - Dynamic resource discovery as insights are captured
- **Persistent Storage**: Auto-save to JSON with load/restore capabilities and export functionality
- **Real-time Statistics**: Live tracking of insight counts, categories, and analytical progress

## 🗃️ Supported Databases

DBChat works with virtually any database (as long as it has a JDBC driver)

### Popular Databases
- **MySQL** / **MariaDB** - Web applications and e-commerce
- **Oracle** - Enterprise applications
- **PostgreSQL** - Advanced applications and analytics
- **SQL Server** - Microsoft environments
- **H2** - Testing and development
- **SQLite** - Local applications and prototypes
- **HSQLDB** - Testing and development

### NoSQL & Caching
- **Redis** - In-memory data store
- **MongoDB** - Document-oriented database
- **Cassandra** - Wide-column store

### Analytics & Cloud
- **Snowflake** - Cloud data platform
- **Databricks** - Cloud data platform
- **Amazon Redshift** - AWS data warehouse
- **Google BigQuery** - Google analytics
- **ClickHouse** - Real-time analytics

### Flat-file Based Data
- **CSV Files** - Spreadsheet data and exports
- **Excel Files** - Can be exported to CSV and queried

*See [INSTALL.md](INSTALL.md) for the complete list and build options.*

## 🚀 Quick Start

### Step 1: Download DBChat

Download the latest release from [GitHub Releases](https://github.com/skanga/dbchat/releases):
- [dbchat-4.2.1-basic.jar](https://github.com/skanga/dbchat/releases/download/v4.2.1/dbchat-4.2.1-basic.jar) - Basic version (PostgreSQL, SQLite, H2, HSQLDB, CSV). We recommend that you start here.
- [dbchat-4.2.1-standard.jar](https://github.com/skanga/dbchat/releases/download/v4.2.1/dbchat-4.2.1-standard.jar) - Standard version (add MySQL, MariaDB, ClickHouse)
- [dbchat-4.2.1-enterprise.jar](https://github.com/skanga/dbchat/releases/download/v4.2.1/dbchat-4.2.1-enterprise.jar) - Enterprise version (add Oracle, SQL Server, DB2)
- [dbchat-4.2.1-cloud-analytics.jar](https://github.com/skanga/dbchat/releases/download/v4.2.1/dbchat-4.2.1-cloud-analytics.jar) - Cloud Analytics version (add Redshift, Snowflake, BigQuery)
- [dbchat-4.2.1-all.jar](https://github.com/skanga/dbchat/releases/download/v4.2.1/dbchat-4.2.1-all.jar) - All databases included (400MB+)

In the examples below, replace `` with the jar you downloaded, such as `basic`, `standard`, `enterprise`, `cloud-analytics`, or `all`.

For a hands-on walkthrough after setup, see [TUTORIAL.md](TUTORIAL.md) and if you only want to see the results of a sample TUTORIAL run then see [TUTORIAL-DEMO.html](http://htmlpreview.github.io/?https://github.com/skanga/DBchat/blob/main/TUTORIAL-DEMO.html). For visualization-focused usage patterns, see [VISUALIZATION.md](VISUALIZATION.md).

NOTE: Advanced users can also build a custom jar with only the drivers you need. See [INSTALL.md](INSTALL.md) for details.

IMPORTANT: Make sure that you are properly LICENSED to use any JDBC driver you install. The DBChat license does not cover any third party code or binaries.

### Step 2: Install Claude Desktop (similar setup for any other MCP client)

1. Download [Claude Desktop](https://claude.ai/download) (free)
2. Sign in with your Claude account
3. **Important**: The Claude website does not support MCP. For MCP with Anthropic models you need to use Claude Desktop or Claude Code.

### Step 2 (alternate): 

If you are not using Claude Desktop but want to use another MCP client like Cursor, Windsurf, VS Code, Continue, etc then please refer to the [MCP Setup](MCP-SETUP.md) document for more details

### Step 3: Set Up Your Database Connection 

Create a configuration file `dbchat.conf`:

```properties
# Basic database connection
DB_URL=jdbc:mysql://localhost:3306/your_database
DB_USER=your_username
DB_PASSWORD=your_password
DB_DRIVER=com.mysql.cj.jdbc.Driver

# Optional: Enable web interface (not needed for Claude desktop)
HTTP_MODE=false
HTTP_PORT=8080
```

**Examples for Common/Popular Databases:**

**MySQL:**
```properties
DB_URL=jdbc:mysql://localhost:3306/your_database
DB_USER=your_username
DB_PASSWORD=your_password
DB_DRIVER=com.mysql.cj.jdbc.Driver
```

**PostgreSQL:**
```properties
DB_URL=jdbc:postgresql://localhost:5432/your_database
DB_USER=your_username
DB_PASSWORD=your_password
DB_DRIVER=org.postgresql.Driver
```

**SQLite:**
```properties
DB_URL=jdbc:sqlite:/path/to/your/database.db
DB_USER=
DB_PASSWORD=
DB_DRIVER=org.sqlite.JDBC
```

**H2 database (in memory - no database setup required):**
```properties
DB_URL=jdbc:h2:mem:testdb
DB_USER=sa
DB_PASSWORD=
DB_DRIVER=org.h2.Driver
```

**Oracle:**
```properties
DB_URL=jdbc:oracle:thin:@localhost:1521:xe
DB_USER=system
DB_PASSWORD=password
DB_DRIVER=oracle.jdbc.driver.OracleDriver
```

**Redis:**
```properties
DB_URL=jdbc:redis://localhost:6379
DB_USER=
DB_PASSWORD=your_redis_password
DB_DRIVER=com.dbvis.jdbc.redis.RedisDriver
```

### Step 4: Configure Claude Desktop

1. Open Claude Desktop
2. Go to **Settings** → **Developer** → **Edit Config**
3. Add your database server:

```json
{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": [
        "-jar", 
        "/absolute/path/to/dbchat-4.2.1-.jar",
        "--config_file=/absolute/path/to/dbchat.conf"
      ]
    }
  }
}
```

**Alternative without config file:**
```json
{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": ["-jar", "/absolute/path/to/dbchat-4.2.1-.jar"],
      "env": {
        "DB_URL": "jdbc:mysql://localhost:3306/your_database",
        "DB_USER": "your_username", 
        "DB_PASSWORD": "your_password",
        "DB_DRIVER": "com.mysql.cj.jdbc.Driver"
      }
    }
  }
}
```

**Windows Example:**
```json
{
  "mcpServers": {
    "database": {
      "command": "java",
      "args": [
        "-jar", 
        "C:/Users/YourName/Downloads/dbchat-4.2.1-.jar",
        "--config_file=C:/Users/YourName/dbchat.conf"
      ]
    }
  }
}
```
NOTE: If java is not in your PATH then use the full path to java (JDK 17+) in the command.

### Step 5: Connect Multiple Databases

You can use many databases concurrently!
```json
{
  "mcpServers": {
    "production-db": {
      "command": "java",
      "args": ["-jar", "/path/to/dbchat-4.2.1-.jar"],
      "env": {
        "DB_URL": "jdbc:mysql://prod-server:3306/production",
        "DB_USER": "readonly_user",
        "DB_PASSWORD": "secure_password",
        "DB_DRIVER": "com.mysql.cj.jdbc.Driver",
        "SELECT_ONLY": "true"
      }
    },
    "analytics-db": {
      "command": "java", 
      "args": ["-jar", "/path/to/dbchat-4.2.1-.jar"],
      "env": {
        "DB_URL": "jdbc:postgresql://analytics:5432/warehouse",
        "DB_USER": "analyst",
        "DB_PASSWORD": "password",
        "DB_DRIVER": "org.postgresql.Driver"
      }
    }
  }
}
```

### Step 6: Restart Claude Desktop

Close and reopen Claude Desktop. You should see a database connection indicator in the chat input.

## 💬 Start Talking to Your Database

### Data Exploration
```
"What tables do we have in the database?"
"Show me the structure of the customers table"
"How many records are in each table?"
```

### Business Questions
```
"How many new customers did we get last month?"
"What are our top 5 selling products this quarter?"
"Show me revenue by month for the past year"
```

### Data Analysis
```
"Find customers who haven't ordered in 6 months"
"Are there any duplicate email addresses?"
"What's the average order value by customer segment?"
```

### Visualizations
```
"Create a chart showing monthly sales trends"
"Make a pie chart of orders by product category"
"Show me a bar chart of customer signups by region"
```

### Advanced Analytics
```
"Calculate customer lifetime value for each segment"
"Identify seasonal trends in our sales data"
"Find correlations between customer age and purchase behavior"
```

## 📱 More Real-World Examples

### E-commerce Analytics
```
"Show me our conversion funnel from visitors to purchases"
"Which products have the highest return rates?"
"Create a dashboard showing daily sales performance"
```

### Customer Success
```
"Find customers at risk of churning"
"Show me customer satisfaction trends"
"Identify our most valuable customer segments"
```

### Financial Reporting
```
"Generate a P&L summary for this quarter"
"Show cash flow trends over the past 12 months"
"Create an expense breakdown by department"
```

### Operations Management
```
"Monitor inventory levels across all warehouses"
"Show shipping performance by carrier"
"Identify bottlenecks in our fulfillment process"
```

## 📊 Data Visualization Examples

DBChat enables Claude to create stunning visualizations directly from your database:

### Sales Dashboard
- **Monthly Revenue Trends**: Line charts showing growth over time
- **Top Products**: Bar charts of bestsellers
- **Regional Performance**: Heat maps of sales by location
- **Customer Segments**: Pie charts of revenue distribution

### Analytics Reports
- **User Growth**: Area charts showing acquisition trends
- **Performance Metrics**: Multi-axis charts combining different KPIs
- **Comparative Analysis**: Side-by-side visualizations of different periods

### Operational Dashboards
- **Inventory Levels**: Real-time stock visualization
- **System Performance**: Time-series charts of key metrics
- **Quality Metrics**: Statistical charts showing trends and outliers

## 🛡️ Security Features

### Read-Only Mode
Protect your data with read-only access:
```properties
SELECT_ONLY=true
```

### Query Limits
Control resource usage:
```properties
MAX_ROWS_LIMIT=1000
QUERY_TIMEOUT_SECONDS=30
MAX_SQL_LENGTH=10000
```

### Local Processing
- All data stays on your machine
- No external API calls
- Encrypted environment variables
- Secure local communication

## 🌐 Web Interface (Optional)

Enable HTTP mode for web-based access:

```properties
# Turn on

…

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [skanga](https://github.com/skanga)
- **Source:** [skanga/DBchat](https://github.com/skanga/DBchat)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-skanga-dbchat
- Seller: https://agentstack.voostack.com/s/skanga
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
