Skip to main content
AllMCPs
BrowseBestCategoriesStackCompareToolsGuidesBlog Log in Submit MCP

Stay in the loop

Get new MCP servers and top picks in your inbox.

AllMCPs

The open directory for discovering and installing Model Context Protocol servers.

Explore

  • Browse servers
  • Best MCP servers
  • Categories
  • MCP clients
  • Agent prompts
  • Stack Builder
  • Compare servers
  • Tags index
  • Submit a server
  • Pricing

Learn

  • Guides hub
  • What is MCP?
  • Install guide
  • Troubleshooting
  • Security
  • Blog
  • Blog RSS

Tools

  • All tools
  • Config generator
  • Config validator
  • MCP playground
  • OpenAPI β†’ MCP
  • Badge generator

For agents

  • API docs
  • Trust & traffic
  • llms.txt β†— (opens in a new tab)
  • Catalog JSON β†— (opens in a new tab)
  • Remote MCP β†— (opens in a new tab)

Company

  • About
  • Contact
  • X (@AllMCPs) β†— (opens in a new tab)
  • GitHub β†— (opens in a new tab)
  • Terms
  • Privacy
AllMCPs VerifiedAllMCPs VerifiedFeatured on Nick LaunchesFeatured on Nick LaunchesLaunch Llama NewsletterLaunch Llama NewsletterVerified DR - allmcps.comVerified DR - allmcps.comFeatured on SaaSGrowFeatured on SaaSGrowFeatured on Twelve ToolsFeatured on Twelve ToolsFeatured on Saaspa.geFeatured on Saaspa.geFeatured on Findly.toolsFeatured on Findly.toolsFeatured on Startup FameFeatured on Startup FameFeatured on LaunchKiwiFeatured on LaunchKiwiFeatured on ScrollLaunchFeatured on ScrollLaunchFeatured on DailyPingsFeatured on DailyPingsFazier badgeFazier badgeFeatured on NewTool.siteFeatured on NewTool.siteFeatured on saasfame.comFeatured on saasfame.comDR Checker - Domain RatingDR Checker - Domain RatingListed on Turbo0Listed on Turbo0Launched on LaunchBoard - Product Launch PlatformLaunched on LaunchBoard - Product Launch PlatformList on SimilarlabsList on Similarlabshttps://codetrendy.comhttps://codetrendy.comListed on DevTool.ioFeatured on BuildlistFeatured on BuildlistAllMCPs VerifiedAllMCPs VerifiedFeatured on Nick LaunchesFeatured on Nick LaunchesLaunch Llama NewsletterLaunch Llama NewsletterVerified DR - allmcps.comVerified DR - allmcps.comFeatured on SaaSGrowFeatured on SaaSGrowFeatured on Twelve ToolsFeatured on Twelve ToolsFeatured on Saaspa.geFeatured on Saaspa.geFeatured on Findly.toolsFeatured on Findly.toolsFeatured on Startup FameFeatured on Startup FameFeatured on LaunchKiwiFeatured on LaunchKiwiFeatured on ScrollLaunchFeatured on ScrollLaunchFeatured on DailyPingsFeatured on DailyPingsFazier badgeFazier badgeFeatured on NewTool.siteFeatured on NewTool.siteFeatured on saasfame.comFeatured on saasfame.comDR Checker - Domain RatingDR Checker - Domain RatingListed on Turbo0Listed on Turbo0Launched on LaunchBoard - Product Launch PlatformLaunched on LaunchBoard - Product Launch PlatformList on SimilarlabsList on Similarlabshttps://codetrendy.comhttps://codetrendy.comListed on DevTool.ioFeatured on BuildlistFeatured on Buildlist
Β© 2026 Jackalope Digital LLC. All rights reserved.
  1. Home
  2. πŸ—„οΈ Databases
  3. MCP Database Server
M
Health: Not checked yetWe have not completed a health check for this listing yet.Last checked 8/11/2026, 12:15:38 AM

MCP Database Server

Enrichment pendingWe haven’t run our AI enrichment pass on this listing yet, so the overview, use cases, and FAQ below may be sparse or missing. We work through the catalog over time β€” check back soon.
View Repository

MCP server for SQLite, PostgreSQL, and MySQL with natural language to SQL and direct SQL tooling.

Quick Install

Automated & IDE Setup

Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β€” or use 1-click editor setup below.

Add to CursorAdd to VS Code
Manual Client & Custom JSON ConfigExpand JSON β–Ύ

Install Config Generator

Choose your client
claude_desktop_config.json
{
  "mcpServers": {
    "mcp-database-server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-database-server"
      ]
    }
  }
}

πŸ’‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)

Install Directory Badge Claim listing AlternativesπŸ—„οΈ More in Databases

Documentation Overview

mcp-db-server

License Python mcpindex verdict

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.

Features

  • Multi-Database Support: Works with PostgreSQL and MySQL
  • Natural Language to SQL: Convert plain English queries to SQL using HuggingFace transformers
  • RESTful API: Clean FastAPI-based endpoints for database operations
  • Safety First: Read-only operations with query validation and result limits
  • Docker Ready: Complete containerization with Docker Compose
  • Production Ready: Health checks, logging, and error handling
  • AI Agent Friendly: Designed specifically for AI agent integration

API Endpoints

EndpointMethodDescription
/healthGETHealth check and service status
/mcp/list_tablesGETList all available tables with column counts
/mcp/describe/{table_name}GETGet detailed schema for a specific table
/mcp/queryPOSTExecute natural language queries
/mcp/tables/{table_name}/sampleGETGet sample data from a table

Quick Start

Option 1: Docker Compose (Recommended)

  1. Clone and start the services:

    bash
    git clone https://github.com/Souhar-dya/mcp-db-server.git
    cd mcp-db-server
    docker-compose up --build
    
  2. Test the endpoints:

    bash
    # Health check
    curl http://localhost:8000/health
    
    # List tables
    curl http://localhost:8000/mcp/list_tables
    
    # Describe a table
    curl http://localhost:8000/mcp/describe/customers
    
    # Natural language query
    curl -X POST "http://localhost:8000/mcp/query" \
      -H "Content-Type: application/json" \
      -d '{"nl_query": "show top 5 customers by total orders"}'
    

Option 2: Local Development

  1. Prerequisites:

    • Python 3.11+
    • PostgreSQL or MySQL database
  2. Install dependencies:

    Terminal
    pip install -r requirements.txt
    
  3. Set environment variables:

    server.ts
    export DATABASE_URL="postgresql+asyncpg://user:password@localhost:5432/dbname"
    # or for MySQL:
    # export DATABASE_URL="mysql+pymysql://user:password@localhost:3306/dbname"
    
  4. Run the server:

    bash
    python -m app.server
    

Sample Database

The project includes a sample database with realistic e-commerce data:

  • customers: Customer information (10 sample customers)
  • orders: Order records (17 sample orders)
  • order_items: Individual items within orders
  • order_summary: View combining order and customer data

Natural Language Query Examples

The server can understand various types of natural language queries:

bash
# Get all customers
curl -X POST "http://localhost:8000/mcp/query" \
  -H "Content-Type: application/json" \
  -d '{"nl_query": "show all customers"}'

# Count orders by status
curl -X POST "http://localhost:8000/mcp/query" \
  -H "Content-Type: application/json" \
  -d '{"nl_query": "count orders by status"}'

# Top customers by order value
curl -X POST "http://localhost:8000/mcp/query" \
  -H "Content-Type: application/json" \
  -d '{"nl_query": "top 5 customers by total order amount"}'

# Recent orders
curl -X POST "http://localhost:8000/mcp/query" \
  -H "Content-Type: application/json" \
  -d '{"nl_query": "show recent orders from last week"}'

Configuration

Environment Variables

VariableDescriptionDefault
DATABASE_URLFull database connection URLpostgresql+asyncpg://postgres:postgres@localhost:5432/postgres
DB_HOSTDatabase hostlocalhost
DB_PORTDatabase port5432
DB_USERDatabase usernamepostgres
DB_PASSWORDDatabase passwordpostgres
DB_NAMEDatabase namepostgres
HOSTServer host0.0.0.0
PORTServer port8000

Database Connection Examples

bash
# PostgreSQL
DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/mydb

# MySQL
DATABASE_URL=mysql+pymysql://user:pass@localhost:3306/mydb

# PostgreSQL with SSL
DATABASE_URL=postgresql+asyncpg://user:pass@localhost:5432/mydb?sslmode=require

### Database Connection Examples

```bash
# PostgreSQL (local or cloud)
DATABASE_URL=postgresql+asyncpg://user:password@host:5432/dbname

# MySQL (local or cloud)
DATABASE_URL=mysql+aiomysql://user:password@host:3306/dbname

# PostgreSQL with SSL (cloud, e.g. Neon, Supabase, Aiven)
DATABASE_URL=postgresql+asyncpg://user:password@host:5432/dbname?sslmode=require

# MySQL with SSL (cloud, e.g. Aiven, PlanetScale)
DATABASE_URL=mysql+aiomysql://user:password@host:3306/dbname?ssl-mode=REQUIRED

Note:

  • For MySQL cloud providers, the ssl-mode parameter in the URL is ignored by the driver, but SSL is always enabled in the MCP server for cloud connections.
  • For PostgreSQL, use sslmode=require for cloud DBs. For MySQL, just use the standard URL; SSL is handled automatically.
  • If you see errors about ssl-mode or sslmode, check your URL and ensure you are using the correct driver prefix (mysql+aiomysql or postgresql+asyncpg).

Cloud Database Examples

bash
# Neon (PostgreSQL)
DATABASE_URL=postgresql+asyncpg://username:password@ep-xxxxxx-pooler.us-east-2.aws.neon.tech/dbname

# Aiven (MySQL)
DATABASE_URL=mysql+aiomysql://avnadmin:yourpassword@mysql-xxxxxx-username-xxxx.aivencloud.com:11079/defaultdb?ssl-mode=REQUIRED

Docker Usage with Cloud DB

Terminal
docker run -d \
  -p 8000:8000 \
  -e DATABASE_URL="<your_cloud_database_url>" \
  souhardyak/mcp-db-server:latest

Troubleshooting

  • If you get connect() got an unexpected keyword argument 'ssl-mode', ignore it: SSL is still enabled.
  • For network errors, check firewall and DB credentials.
  • For MySQL, always use mysql+aiomysql in the URL for async support.
Code

## Security Features

- **Read-Only Operations**: Only SELECT queries are allowed
- **Query Validation**: Automatic detection and blocking of dangerous SQL operations
- **Result Limiting**: Maximum 50 rows per query (configurable)
- **Input Sanitization**: Protection against SQL injection
- **Safe Defaults**: Secure configuration out of the box

## Architecture

mcp-db-server/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ init.py # Package initialization β”‚ β”œβ”€β”€ server.py # FastAPI application and endpoints β”‚ β”œβ”€β”€ db.py # Database connection and operations β”‚ └── nl_to_sql.py # Natural language to SQL conversion β”œβ”€β”€ .github/workflows/ β”‚ └── docker-publish.yml # CI/CD pipeline β”œβ”€β”€ docker-compose.yml # Docker Compose configuration β”œβ”€β”€ Dockerfile # Container definition β”œβ”€β”€ init_db.sql # Sample database schema and data β”œβ”€β”€ requirements.txt # Python dependencies └── README.md # This file

Code

## Model Context Protocol (MCP) Integration

This server is designed to work seamlessly with MCP-compatible AI agents:

1. **Standardized Endpoints**: RESTful API following MCP conventions
2. **Structured Responses**: JSON responses optimized for AI consumption
3. **Error Handling**: Consistent error messages and status codes
4. **Documentation**: OpenAPI/Swagger documentation available at `/docs`

## Publish To VS Code MCP Store (Registry)

VS Code MCP gallery uses MCP Registry metadata. This repository now includes
`server.json` for registry publication.

### 1) Build and publish Docker image

```bash
docker build -t souhardyak/mcp-db-server:1.3.1 .
docker push souhardyak/mcp-db-server:1.3.1

2) Validate server metadata

server.json is configured for an OCI package and stdio transport:

  • name: io.github.Souhar-dya/mcp-db-server
  • registryType: oci
  • identifier: docker.io/souhardyak/mcp-db-server:1.3.1

The Dockerfile includes registry ownership annotation:

  • io.modelcontextprotocol.server.name=io.github.Souhar-dya/mcp-db-server

3) Publish to MCP Registry

Install publisher and publish metadata:

bash
mcp-publisher login github
mcp-publisher publish

After publishing, users can discover/install it from MCP-compatible clients, including VS Code MCP experiences that read from the registry.

4) Local VS Code config example

config.json
{
  "servers": {
    "mcp-db-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "DATABASE_URL=sqlite+aiosqlite:////data/default.db",
        "souhardyak/mcp-db-server:1.3.1"
      ]
    }
  }
}

Docker Smoke Test

Use the dedicated Docker smoke test in tests/docker:

bash
python tests/docker/smoke_test.py

This verifies Docker daemon access, image build, container startup, and health status.

Deployment

Docker Hub

bash
# Pull the latest image
docker pull souhardyak/mcp-db-server:latest

# Run with your database
docker run -d \
  -p 8000:8000 \
  -e DATABASE_URL="your_database_url_here" \
  souhardyak/mcp-db-server:latest

Kubernetes

yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mcp-db-server
spec:
  replicas: 3
  selector:
    matchLabels:
      app: mcp-db-server
  template:
    metadata:
      labels:
        app: mcp-db-server
    spec:
      containers:
        - name: mcp-db-server
          image: souhardyak/mcp-db-server:latest
          ports:
            - containerPort: 8000
          env:
            - name: DATABASE_URL
              valueFrom:
                secretKeyRef:
                  name: db-secret
                  key: url
---
apiVersion: v1
kind: Service
metadata:
  name: mcp-db-server-service
spec:
  selector:
    app: mcp-db-server
  ports:
    - port: 80
      targetPort: 8000
  type: LoadBalancer

Testing

Run Tests Locally

bash
# Start test database
docker-compose up postgres -d

# Wait for database to be ready
sleep 10

# Run tests
python -m pytest tests/ -v

Manual Testing

bash
# Test health endpoint
curl http://localhost:8000/health

# Test table listing
curl http://localhost:8000/mcp/list_tables

# Test natural language query
curl -X POST "http://localhost:8000/mcp/query" \
  -H "Content-Type: application/json" \
  -d '{"nl_query": "show me all customers from California"}'

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

πŸ“ Changelog

v1.3.0 (2025-12-24) - Docker Path Fix

  • Fixed: Resolved import path issues in Docker container causing from db import DatabaseManager to fail
  • Fixed: Changed relative paths to absolute paths in Dockerfile and docker-compose.yml healthchecks
  • Improved: mcp_server.py now uses robust path resolution that works both locally and in Docker containers
  • Updated: Docker image rebuilt and pushed with all path fixes

v1.2.0 (2025-11-03) - MySQL Column Access Fix

  • Fixed: Resolved Could not locate column in row for column 'column_name' error with MySQL databases
  • Fixed: Changed describe_table method to use index-based row access for better SQLAlchemy compatibility
  • Improved: Enhanced cross-database compatibility for schema introspection
  • Resolved: GitHub Issue #1

v1.1.0 (2025-09-28) - Async Bug Fix

  • Fixed: Resolved str can't be used in 'await' expression error in MCP server
  • Improved: NLP query processing now works correctly with Claude Desktop integration
  • Enhanced: Added comprehensive test database setup scripts
  • Updated: Docker image rebuilt with bug fixes and updated dependencies

v1.0.0 (2025-09-25) - Initial Release

  • Initial: Full MCP Database Server implementation
  • Added: RESTful API with FastAPI
  • Added: Natural language to SQL conversion
  • Added: Docker containerization and deployment
  • Added: Multi-database support (PostgreSQL, MySQL, SQLite)

Acknowledgments

  • FastAPI for the excellent web framework
  • HuggingFace Transformers for NL to SQL capabilities
  • SQLAlchemy for database abstraction
  • The Model Context Protocol (MCP) community

Support

  • Report Issues
  • Discussions
  • Documentation

⭐ If this project helped you, please consider giving it a star!

Related MCP Servers

View all in Databases View all alternatives
  • AllMCPs Server logoAllMCPs Server
    β˜… Featured

    The official MCP server for AllMCPs.com - submit and manage tools directly from your AI. The open directory for MCP servers. Connect Claude, Cursor, Windsurf, and AI agents to databases, tools, files, and APIs. Explore 3,181+ servers. AllMCPs is the premier, open directory for discovering, evaluating, and installing Model Context Protocol (MCP) servers to equip AI agents and LLMs with real-world superpowers.

    πŸ—„οΈ Databases7 views
    Compare vs AllMCPs Server β†’
  • Genai Toolbox logoGenai Toolbox

    Open source MCP server specializing in easy, fast, and secure tools for Databases.

    πŸ—„οΈ Databases3 views
    Compare vs Genai Toolbox β†’
  • D
    DBHub Analytics

    MCP server for Databricks, BigQuery, PostgreSQL, MySQL, SQL Server, SQLite, MariaDB

    πŸ—„οΈ Databases0 views
    Compare vs DBHub Analytics β†’
  • Z
    Zotero Bridge

    MCP Server for Zotero SQLite Database - collection, tagging, PDF reading and more.

    πŸ—„οΈ Databases0 views
    Compare vs Zotero Bridge β†’

Frequently Asked Questions about MCP Database Server

Add the following block to your claude_desktop_config.json under mcpServers: "mcpServers": { "mcp-database-server": { "command": "npx", "args": ["-y", "MCP Database Server"] } }

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Database Server AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/mcp-database-server?style=directory)](https://allmcps.com/mcp/mcp-database-server)
HTML Embed
<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>

Technical Specs & Signals

CategoryπŸ—„οΈDatabases
More technical detailsExpand β–Ύ
TransportSTDIO
RuntimeNode.js
Views0
Unique ViewsTotal visits recorded for this listing page on AllMCPs.
Installs0
Installs & Copy ActionsTotal times users copied install commands or configuration snippets for this server.
27Quality signal: Emerging Β· 27/100How this signal is calculated β–Ύ
Server availabilityNot measured

Not scored for repo-hosted servers β€” we can't reach the running server, only its GitHub page. Hosted MCP endpoints are health-checked live.

Verified ownership8/20
Documentation & tools11/30
Adoption & activity1/15
Community engagement0/10

A guidance signal from public completeness & health data β€” not a user rating. New listings start lower and rise as they add docs, get verified, and grow adoption. Signals we can't observe for a listing are skipped, not counted against it.

β˜… FeaturedAllMCPs Server logo

AllMCPs Server

The official MCP server for AllMCPs.com - submit and manage tools directly from your AI. The open directory for MCP servers. Connect Claude, Cursor, Windsurf, and AI agents to databases, tools, files, and APIs. Explore 3,181+ servers. AllMCPs is the premier, open directory for discovering, evaluating, and installing Model Context Protocol (MCP) servers to equip AI agents and LLMs with real-world superpowers.

Explore Server β†’

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Free dofollow backlink: after claiming, verify your product site and place a dofollow AllMCPs badge β€” we recheck it stays live.

Claim & get free dofollow

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.

Explore more

More in πŸ—„οΈ Databases β†’Best MCP servers for Databases β†’Alternatives to MCP Database Server β†’Install in Claude DesktopInstall in CursorInstall in VS Code