mcp-database-universal
Enables the MCP server to connect to MySQL databases, providing tools for schema introspection, safe querying, data profiling, and relationship visualization.
Enables the MCP server to connect to PostgreSQL databases, providing tools for schema introspection, safe querying, data profiling, and relationship visualization.
Enables the MCP server to connect to SQLite databases, providing tools for schema introspection, safe querying, data profiling, and relationship visualization.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-database-universallist all tables with row counts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Database Server
A reasoning interface for databases for MCP-capable AI agents — not a thin SQL wrapper.
mcp-database-universal gives AI agents a set of 7 reasoning tools to explore and query a database safely, understand its schema and data shape, run natural-language questions, and visualize relationships — all without exposing raw connection internals.
Features
7 reasoning tools designed for AI agents: test connection, list tables, inspect a table, run parameterized SQL, ask questions in plain language, profile data, and render an ER diagram.
Multi-engine: SQLite (built-in) plus optional PostgreSQL, MySQL, and MSSQL.
Safety first: read-only by default, parameterized queries, statement validation, row/time/output limits.
LLM-friendly output: types translated,
NULLs handled, results formatted in Markdown tables with context.Schema introspection: auto-discover tables, columns, indexes, foreign keys, and relationships.
Natural language queries: translate plain-text questions into SQL and return results.
Related MCP server: Universal Database MCP Server
Supported engines
Engine | Requirement | Install extra |
SQLite | built-in | — |
PostgreSQL | psycopg |
|
MySQL | PyMySQL |
|
MSSQL | pyodbc + ODBC driver |
|
all | — |
|
Install
pip install mcp-database-universal
# With optional engines:
pip install "mcp-database-universal[postgres]"
pip install "mcp-database-universal[mysql]"
pip install "mcp-database-universal[mssql]"
# or everything:
pip install "mcp-database-universal[all]"Quick start
Run the server over STDIO (the default transport for MCP clients):
DATABASE_URL=sqlite:///app.db python -m mcp_database_universalConnection URLs:
sqlite:///path/to/db.db SQLite (file)
sqlite:///:memory: SQLite (in-memory)
postgresql://user:pass@host:5432/db PostgreSQL
mysql://user:pass@host:3306/db MySQL
mssql://user:pass@host:1433/db MSSQL (uses ODBC Driver 18)Docker
docker build -t mcp-db .
# Mount a SQLite database read-only:
docker run --rm -i \
-v /host/path/app.db:/data/app.db:ro \
-e DATABASE_URL=sqlite:////data/app.db \
mcp-db
# Or in-memory:
docker run --rm -i -e DATABASE_URL=sqlite:///:memory: mcp-dbConfiguration
All configuration is done through environment variables.
Variable | Default | Description |
| (required) | Database connection URL. |
|
| Enforce read-only mode (blocks writes even if |
|
| Allow write statements when |
|
| Maximum rows returned per query. |
|
| Query timeout in seconds. |
|
| Cap on result payload size. |
|
| Number of sample rows shown in table/column stats. |
|
| Top-N value distribution entries in profiling. |
| — | API key for the LLM-backed |
| — | API key for the LLM-backed |
Tools
Tool | Description |
| Test DB connectivity; report engine, version, name, size, table count. |
| Overview of all tables with row counts, column counts, FK relationships. |
| Full structure of one table: columns, types, indexes, FKs, sample data. |
| Run a safe, parameterized SQL query and get Markdown results. |
| Ask a question in plain text; get generated SQL + results. |
| Data profile: distributions, NULL rates, relationships, sizes. |
| Mermaid ER diagram of table relationships. |
Example: query with parameters
{
"sql": "SELECT * FROM users WHERE id = :id AND active = :active",
"params": "{\"id\": 42, \"active\": true}"
}Parameters use :name placeholders; pass the values as a JSON string in params.
Example: natural_query
question: "How many users are there?"
-> SELECT COUNT(*) FROM users
question: "Show me all orders"
-> SELECT * FROM orders LIMIT 100How the question is translated:
If
OPENAI_API_KEY(orANTHROPIC_API_KEY) is set, the question is sent to an LLM that returns a single read-only SQL statement. The result always passes through the safety validator before execution.Otherwise a built-in rules-based parser handles common English question shapes ("how many X", "show me X", "top N in X", "X where column = value"). It matches table names against the database's real schema.
A working example against a small sample database is in examples/ together with ready-to-use configuration snippets for common MCP clients.
MCP client configuration
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"database": {
"command": "python",
"args": ["-m", "mcp_database_universal"],
"env": {"DATABASE_URL": "sqlite:///C:/data/app.db"}
}
}
}Cursor / other CLI-based clients
{
"mcpServers": {
"database": {
"command": "uvx",
"args": ["mcp-database-universal"],
"env": {"DATABASE_URL": "sqlite:///C:/data/app.db"}
}
}
}Windows note: the async Postgres driver requires the Windows selector event loop. The package sets this policy automatically on
win32, so no extra configuration is needed.
Development
pip install -e ".[dev]"
pytestIntegration tests for PostgreSQL/MySQL use Docker Compose and are skipped automatically if the servers are unreachable:
docker compose -f tests/integration/docker-compose.yml up -d
pytestSafety model
The server is read-only by default;
INSERT/UPDATE/DELETE/DROP/ALTERand other write statements are blocked.Writes are only possible when the operator explicitly sets
DATABASE_READ_ONLY=falseandDATABASE_WRITE_ENABLED=true.Query results are capped by row count, timeout, and output size — runaway queries are prevented.
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to query and explore databases including SQLite, PostgreSQL, MySQL, and SQL Server through a secure, read-only workflow. It provides tools for listing connections, inspecting table schemas, and executing SELECT statements directly within VS Code.1
- AlicenseNot gradedqualityAmaintenanceConnect AI agents to SQL databases (SQLite, PostgreSQL, MySQL) with a unified interface for querying data, exploring schemas, inserting rows, and exporting results to CSV. Includes safety features like dangerous query blocking and write guards.13MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to connect to and interact with PostgreSQL, MySQL, SQLite, and MongoDB databases through natural language, supporting schema exploration, query execution, data export, and more.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to interact with PostgreSQL or MySQL databases using natural language. Supports SQL queries, schema discovery, and pre-built aggregations without writing SQL.289MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Give your agent live data from Twitter, Reddit, the web and GitHub. No API keys, no scraping stack.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/kobramantra-debug/mcp-database-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server