Comprehensive database server supporting PostgreSQL, MySQL, and SQLite with natural language SQL query capabilities. Enables AI agents to interact with databases through both direct SQL and natural language queries.
7 Tools
Version 4.43 or later needs to be installed to add the server automatically
Use cases
About
Comprehensive database server supporting PostgreSQL, MySQL, and SQLite with natural language SQL query capabilities. Enables AI agents to interact with databases through both direct SQL and natural language queries.
query_database
Description: Execute natural language queries against the database and convert them to SQL
Usage: Ask questions like "Show me all users created in the last week" or "Find the top 10 products by sales"
Arguments:
query
(string): Natural language description of what you want to query from the databaselist_tables
Description: List all available tables in the current database
Usage: Ask "What tables are available?" or "Show me the database structure"
describe_table
Description: Get detailed schema information for a specific table including columns, types, and constraints
Usage: Ask "Describe the users table" or "What columns does the products table have?"
Arguments:
table_name
(string): Name of the table to describeexecute_sql
Description: Execute raw SQL queries with safety checks and validation
Usage: Execute specific SQL commands when you need precise control
Arguments:
query
(string): SQL query to executeconnect_to_database
Description: Connect to a new database using provided connection details
Usage: Switch between different databases during your session
Arguments:
connection_string
(string): Database connection stringget_connection_examples
Description: Get example connection strings for different database types (SQLite, PostgreSQL, MySQL)
Usage: Ask "How do I connect to a PostgreSQL database?" or "Show me connection examples"
get_current_database_info
Description: Get information about the currently connected database including type, version, and connection status
Usage: Ask "What database am I connected to?" or "Show me current connection details"
Here are some example questions you can ask your agent:
# Basic queries
"Show me all users in the database"
"What tables are available?"
"Describe the products table structure"
# Complex analysis
"Find the top 5 customers by total order value"
"Show me users who registered in the last month"
"What's the average product price by category?"
# Data exploration
"How many orders were placed yesterday?"
"List all products that are out of stock"
"Find duplicate email addresses in the users table"
The server requires a DATABASE_URL
environment variable with your database connection string:
DATABASE_URL=sqlite+aiosqlite:///data/mydb.db
DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/mydb
DATABASE_URL=mysql+aiomysql://user:password@localhost:3306/mydb
# Run with SQLite (simplest setup)
docker run -d \
-p 3000:3000 \
-e DATABASE_URL=sqlite+aiosqlite:///data/mydb.db \
souhardyak/mcp-db-server
# Run with PostgreSQL
docker run -d \
-p 3000:3000 \
-e DATABASE_URL=postgresql+asyncpg://user:password@host:5432/db \
souhardyak/mcp-db-server
# Run with persistent SQLite storage
docker run -d \
-p 3000:3000 \
-v /host/data:/data \
-e DATABASE_URL=sqlite+aiosqlite:///data/mydb.db \
souhardyak/mcp-db-server
The server provides a health endpoint at /health
that returns database connectivity status.
Full source code and documentation available at: https://github.com/Souhar-dya/mcp-db-server
Manual installation
You can install the MCP server using:
Installation for