SmartDB
๐ ๐ - A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optimization, and more. Compatible with mainstream databases including MySQL, PostgreSQL,
What is SmartDB?
SmartDB is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ ๐ - a universal database mcp server supporting simultaneous connections to multiple databases. it provides tools for database operations, health analysis, sql optimization, and more. compatible wi...
๐ ๐ - A universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optimization, and more. Compatible with mainstream databases including MySQL, PostgreSQL,
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- ๐ ๐ - A universal database MCP server supporting simultaneou
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx smartdb-mcpConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use SmartDB
SmartDB MCP is a Python-based universal database MCP server that can maintain simultaneous connections to multiple databases โ MySQL, PostgreSQL, Oracle, SQL Server, and Dameng โ from a single running instance. It provides tools for executing SQL, generating optimized queries, analyzing table structures and indexes, checking database health, and running performance optimization with execution plan analysis, making it useful for database administrators and developers who work across heterogeneous database environments.
Prerequisites
- Python 3.10+ with pip or uv package manager
- Access credentials (host, port, user, password) for the databases you want to connect
- The target databases must be network-accessible from where the MCP server runs
- An MCP-compatible client such as Claude Desktop or Dify
Install SmartDB-MCP
Install the package from PyPI. Using pipx keeps it isolated from your system Python.
pip install SmartDB-MCP
# or with pipx:
pipx install SmartDB-MCPCreate a database configuration file
Create a JSON config file listing each database connection. Each entry requires host, port, user, password, database name, role (readonly/writer/admin), and type (mysql/postgresql/oracle/sqlserver/dameng).
[
{
"host": "localhost",
"port": 5432,
"user": "db_user",
"password": "db_password",
"database": "mydb",
"role": "readonly",
"type": "postgresql"
},
{
"host": "10.0.0.2",
"port": 3306,
"user": "root",
"password": "rootpass",
"database": "analytics",
"role": "writer",
"type": "mysql"
}
]Create a .env file for SmartDB configuration
Create a .env file that points to your database config and sets OAuth2 credentials for the server's own access control layer.
DATABASE_CONFIG_FILE=/absolute/path/to/db_config.json
CLIENT_ID=smartdb_client
CLIENT_SECRET=change_me_secret
ACCESS_TOKEN_EXPIRE_MINUTES=30
REFRESH_TOKEN_EXPIRE_DAYS=7
TOKEN_SECRET_KEY=a_random_32_char_secret_key_here
OAUTH_USER_NAME=admin
OAUTH_USER_PASSWORD=your_admin_passwordStart the SmartDB MCP server
Run the server pointing to your .env file. The --oauth=true flag enables the OAuth2 access control layer.
smartdb --envfile=/absolute/path/to/.env --oauth=trueAdd to your MCP client configuration
For Claude Desktop, configure the server to launch via Python module. Pass the env file path as an argument.
{
"mcpServers": {
"smartdb": {
"command": "smartdb",
"args": ["--envfile=/absolute/path/to/.env", "--oauth=true"]
}
}
}SmartDB Examples
Client configuration
claude_desktop_config.json entry for SmartDB MCP using the installed 'smartdb' CLI command with a custom env file.
{
"mcpServers": {
"smartdb": {
"command": "smartdb",
"args": [
"--envfile=/Users/yourname/smartdb/.env",
"--oauth=true"
]
}
}
}Prompts to try
Example prompts that use SmartDB's execute_sql, sql_optimize, get_db_health, and sql_creator tools across multiple databases.
- "List all tables in the PostgreSQL mydb database"
- "Generate a SQL query to find the top 10 customers by order value in the analytics MySQL database"
- "Check the health of all connected databases and report any issues"
- "Optimize this slow query and show me the execution plan: SELECT * FROM orders WHERE status = 'pending'"
- "Describe the schema of the users table in the PostgreSQL database"Troubleshooting SmartDB
Database connection refused or timeout
Verify that the host, port, user, and password in your db_config.json are correct and that the database server is reachable from the machine running SmartDB. Check firewall rules and that the database user has CONNECT privileges. Use a database client (psql, mysql CLI) to test credentials independently.
OAuth authentication errors when calling tools
Ensure OAUTH_USER_NAME, OAUTH_USER_PASSWORD, CLIENT_ID, and CLIENT_SECRET in your .env file are consistent. The default credentials in the README are admin/wenb1n โ change these for production. Restart the server after any .env changes.
Oracle or Dameng connections fail with missing driver errors
Oracle connections require cx_Oracle or oracledb and Oracle Instant Client installed on the system. Dameng requires the dmPython driver. Install them separately: 'pip install oracledb' for Oracle. Verify with 'python -c "import oracledb"' before starting the server.
Frequently Asked Questions about SmartDB
What is SmartDB?
SmartDB is a Model Context Protocol (MCP) server that ๐ ๐ - a universal database mcp server supporting simultaneous connections to multiple databases. it provides tools for database operations, health analysis, sql optimization, and more. compatible with mainstream databases including mysql, postgresql, It connects AI assistants to external tools and data sources through a standardized interface.
How do I install SmartDB?
Follow the installation instructions on the SmartDB GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with SmartDB?
SmartDB works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is SmartDB free to use?
Yes, SmartDB is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
SmartDB Alternatives โ Similar Databases Servers
Looking for alternatives to SmartDB? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
โ 20.6kGo language library for reading and writing Microsoft Excelโข (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
โ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
โ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
โ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
โ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
โ 1.7k๐๏ธ ๐ โ๏ธ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up SmartDB in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use SmartDB?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.