Prerequisites
Before starting, ensure you have:- Node.js 18+ installed (for NPM method) OR Docker installed
- Access to an AI tool (Claude Desktop, Claude Code, Cursor, or VS Code)
- Optionally: A PostgreSQL, MySQL, or other supported database
Step 1: Start DBHub in Demo Mode
Let’s start with demo mode to verify everything works:- NPM
- Docker
Demo mode includes a sample SQLite “employee” database with realistic data - perfect for testing without setting up a real database connection.
Step 2: Connect with Your AI Tool
Choose your AI tool and follow the setup instructions:Claude Desktop
Edit your Claude Desktop configuration file: macOS:~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
- Docker Demo
- NPX Demo
- NPX with Your Database
claude_desktop_config.json
Claude Desktop only supports
stdio transport.Cursor
Install DBHub in Cursor using the deeplink or manual configuration: Quick Install (Deeplink):Cursor supports both
stdio and http transports. Make sure to use Agent mode to access MCP tools.Claude Code
Create or update.claude/mcp.json in your project:
.claude/mcp.json
Claude Code uses HTTP transport. The server must be running before you can use it.
VS Code with Copilot
Create.vscode/mcp.json in your project:
.vscode/mcp.json
.github/copilot-instructions.md to provide context:
.github/copilot-instructions.md
VS Code with GitHub Copilot supports both
stdio and http transports.Step 3: Restart Your AI Tool
After updating the configuration:- Claude Desktop/Cursor: Completely quit and restart the application
- Claude Code/VS Code: Reload the window or restart VS Code
- Verify the MCP server appears in the tools/resources list
Step 4: Try It Out
Try these example prompts in your AI tool:List available schemas
List available schemas
db://schemas resource to list all schemas.Show tables in a schema
Show tables in a schema
db://schemas/public/tables resource.Query employee data
Query employee data
Analyze data
Analyze data
Step 5: Connect to Your Own Database
Once you’ve verified DBHub works in demo mode, connect it to your actual database:Update Your Configuration
- PostgreSQL
- MySQL
- SQLite
Using Environment Variables
For better security, avoid putting passwords in the config file:- Create a
.envfile:
.env
- Update your configuration to use environment variables:
Common Use Cases
Explore Database Schema
Generate SQL Queries
Data Analysis
Debug Issues
Next Steps
Multi-Database Setup
Connect to multiple databases simultaneously
Read-Only Mode
Secure your production databases
SSH Tunneling
Connect through bastion hosts
DSN Configuration
Database connection string formats
Troubleshooting
MCP Server Not Appearing
If the server doesn’t appear in Claude Desktop:- Check the configuration file syntax (valid JSON)
- Verify the file path is correct
- Restart Claude Desktop completely
- Check Claude Desktop logs for errors
Connection Errors
If you see database connection errors:- Verify your DSN is correct
- Test the connection using a database client
- Check firewall rules
- For Docker, use
host.docker.internalinstead oflocalhost
Permission Errors
If queries fail with permission errors:- Verify the database user has the necessary permissions
- Check if the database requires SSL (add
?sslmode=requireto DSN) - Ensure the user can access the schema you’re querying