Skip to main content
Glama
by swoiow

database_mcp

Pluggable MCP servers for MySQL and PostgreSQL with a shared core. Each database has its own driver, prompts and server process. A gateway.py file exposes both servers under a single FastAPI app.

Features

  • MySQL / PostgreSQL split: independent servers, drivers and prompts.

  • Optional TTL cache: global .env switch and per-call use_cache/ttl parameters.

  • Gateway: /mysql/* and /pgsql/* routes served from one process.

  • Easy extension: add new drivers, prompts and server files for other databases.

Project Structure

core/ # Base driver & TTL cache base.py cache.py drivers/ # Pluggable DB drivers mysql_driver.py pgsql_driver.py prompts/ # Built-in prompts (bilingual) mysql_prompts.py pgsql_prompts.py server_mysql.py # MySQL MCP server server_pgsql.py # PostgreSQL MCP server gateway.py # FastAPI gateway exposing both servers requirements.txt Dockerfile .env.sample

Running

Local

  • MySQL server: uvicorn server_mysql:mcp.app --host 0.0.0.0 --port 8001

  • PostgreSQL server: uvicorn server_pgsql:mcp.app --host 0.0.0.0 --port 8002

  • Gateway (both): uvicorn gateway:app --host 0.0.0.0 --port 8000

Docker

Build image:

docker build -t db-mcp:latest .

Run gateway (default):

docker run --rm -p 8000:8000 db-mcp:latest

Run only MySQL server:

docker run --rm -p 8001:8001 -e TARGET=mysql db-mcp:latest

Run only PostgreSQL server:

docker run --rm -p 8002:8002 -e TARGET=pgsql db-mcp:latest

Environment variables for connection details and cache options are listed in .env.sample.

-
security - not tested
F
license - not found
-
quality - not tested

Related MCP Servers

  • -
    security
    A
    license
    -
    quality
    An MCP server that integrates with MySQL databases, enabling secure read and write operations through LLM-driven interfaces with support for transaction handling and performance monitoring.
    Last updated -
    202
    17
    MIT License
  • -
    security
    -
    license
    -
    quality
    Universal database MCP server connecting to MySQL, PostgreSQL, SQLite, DuckDB and etc.
    Last updated -
    1
    1,582
    MIT License
    • Linux
    • Apple
  • -
    security
    F
    license
    -
    quality
    An MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.
    Last updated -
    318
    4
  • -
    security
    F
    license
    -
    quality
    A FastMCP-based server that enables interaction with MySQL databases, supporting client-server communication for querying and analyzing MySQL data.
    Last updated -

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/swoiow/database_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server