MCP server for SQLite, PostgreSQL, and MySQL with natural language to SQL and direct SQL tooling.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent — or use 1-click editor setup below.
One-click editor setup isn’t available for this listing yet — we don’t have a confirmed install command, and we’d rather show nothing than point your editor at the wrong package or host. Follow the project’s own setup instructions, linked above.
An MCP (Model Context Protocol) server that exposes relational databases (PostgreSQL/MySQL) to AI agents with natural language query support. Transform natural language questions into SQL queries and get structured results.
X-API-Key authentication for all database HTTP endpoints; /health remains public for health checks.127.0.0.1.sslmode=require compatibility for asyncpg connections.souhardyak/mcp-db-server:1.4.0souhardyak/mcp-db-server:latestghcr.io/souhar-dya/mcp-db-server:1.4.0ghcr.io/souhar-dya/mcp-db-server:latest| Endpoint | Method | Description |
|---|---|---|
/health | GET | Health check and service status |
/mcp/list_tables | GET | List all available tables with column counts |
/mcp/describe/{table_name} | GET | Get detailed schema for a specific table |
/mcp/query | POST | Execute natural language queries |
/mcp/tables/{table_name}/sample | GET | Get sample data from a table |
Clone and start the services:
Test the endpoints:
Prerequisites:
Install dependencies:
Set environment variables:
Run the server:
The project includes a sample database with realistic e-commerce data:
The server can understand various types of natural language queries:
| Variable | Description | Default |
|---|---|---|
DATABASE_URL | Full database connection URL | postgresql+asyncpg://postgres:postgres@localhost:5432/postgres |
DB_HOST | Database host | localhost |
DB_PORT | Database port | 5432 |
DB_USER | Database username | postgres |
DB_PASSWORD | Database password | postgres |
DB_NAME | Database name | postgres |
HOST | Server host | 127.0.0.1 |
PORT | Server port | 8000 |
MCP_API_KEY | Required API key for database HTTP routes | Not set (API disabled) |
CORS_ALLOW_ORIGINS | Comma-separated allowed browser origins | Empty (disabled) |
Note:
- For MySQL cloud providers, the
ssl-modeparameter in the URL is ignored by the driver, but SSL is always enabled in the MCP server for cloud connections.- For PostgreSQL, use
sslmode=requirefor cloud DBs. For MySQL, just use the standard URL; SSL is handled automatically.- If you see errors about
ssl-modeorsslmode, check your URL and ensure you are using the correct driver prefix (mysql+aiomysqlorpostgresql+asyncpg).
GitHub Container Registry is also available:
Images are published automatically when a v*.*.* tag is pushed. The workflow also creates the matching GitHub Release. To publish an existing tag such as v1.4.0, open the workflow's Run workflow action and enter 1.4.0. Set the GHCR package visibility to Public in the repository's Packages settings if unauthenticated pulls should be allowed.
connect() got an unexpected keyword argument 'ssl-mode', ignore it: SSL is still enabled.mysql+aiomysql in the URL for async support.The server normalizes sslmode=require to the ssl option expected by asyncpg. A temporary PostgreSQL verification was completed successfully against a compatible cloud database using CREATE, INSERT, SELECT, UPDATE, DELETE, and DROP; no test data was retained. Never commit or share a connection URL containing a real password.
Factual signals from GitHub, npm, and our automated checks — not a rating.
No reviews yet — be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/mcp-database-server)<a href="https://allmcps.com/mcp/mcp-database-server"><img src="https://allmcps.com/api/badge/mcp-database-server?style=directory" alt="MCP Database Server on AllMCPs" /></a>