SmartDB_MCP
Universal database MCP server connecting to MySQL, PostgreSQL, SQL Server, MariaDB,DM8,Oracle,not only provides basic database connection such as OAuth 2.0 authentication , health checks, SQL optimization, and index health detection
claude mcp add --transport stdio wenb1n-dev-smartdb_mcp pipx run SmartDB-MCP \ --env CLIENT_ID="OAuth2 client ID" \ --env CLIENT_SECRET="OAuth2 client secret" \ --env OAUTH_USER_NAME="OAuth username" \ --env TOKEN_SECRET_KEY="Token encryption key" \ --env OAUTH_USER_PASSWORD="OAuth user password" \ --env DATABASE_CONFIG_FILE="Path to the database configuration file (JSON) used by SmartDB" \ --env REFRESH_TOKEN_EXPIRE_DAYS="OAuth2 refresh token expiration in days" \ --env ACCESS_TOKEN_EXPIRE_MINUTES="OAuth2 access token expiration in minutes"
How to use
SmartDB_MCP is a universal MCP gateway that exposes multiple database connections through a single MCP-compatible interface. It supports OAuth 2.0 authentication, health checks, and SQL optimization features to help clients securely connect to and explore supported databases (MySQL, PostgreSQL, Oracle, SQL Server, and Dameng). The server provides a suite of tools such as execute_sql, get_db_health, get_table_desc, get_table_index, get_table_name, get_db_version, sql_creator, and sql_optimize to manage and inspect database schemas, execute statements, and optimize queries. To run it, install the SmartDB-MCP package and start the service via the smartdb command exposed by the package. You’ll configure environments like the database connections, OAuth credentials, and token settings through environment variables and a JSON configuration file, enabling clients to connect using MCP-compatible requests.
How to install
Prerequisites:
- Python and pip (recommended) or use a Python environment manager
- Optional: Docker for containerized deployment
- Access to a database you want to connect to (MySQL, PostgreSQL, Oracle, SQL Server, or Dameng)
Installation steps:
-
Install the MCP package globally using pip: pip install SmartDB-MCP
-
(Optional) If you prefer using a isolated execution via pipx: pipx install SmartDB-MCP
-
Prepare configuration and environment variables. Create a JSON config for databases (as shown in the README) and set environment variables such as:
- DATABASE_CONFIG_FILE: path to your database config JSON
- OAuth-related variables: CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN_EXPIRE_MINUTES, REFRESH_TOKEN_EXPIRE_DAYS, TOKEN_SECRET_KEY
- OAUTH_USER_NAME, OAUTH_USER_PASSWORD for initial OAuth credentials if needed
-
Start the MCP server. The README indicates the CLI is exposed as smartdb. Using pipx, you can start it with: smartdb --envfile=/path/to/.env --oauth=true
If you installed via pipx, you can also run: pipx run SmartDB-MCP --envfile=/path/to/.env --oauth=true
Additional notes
Tips and common notes:
- Ensure the DATABASE_CONFIG_FILE JSON contains a valid default database configuration entry with the required fields (host, port, user, password, database, type, etc.). Additional databases (postgresql, oracle, mssql, etc.) can be added as needed.
- The OAuth settings enable secured access; keep CLIENT_ID and CLIENT_SECRET confidential and rotate them periodically.
- The START command references an environment file via --envfile. Use a .env file to centralize environment variables for convenience.
- If you encounter connectivity issues, verify database listener accessibility from the host running SmartDB-MCP and ensure proper pool_size, timeouts, and credentials.
- For debugging, check logs produced by the SmartDB-MCP process and ensure the environment variables described above are properly loaded.
Related MCP Servers
mysql_mcp_server_pro
Model Context Protocol (MCP) server that supports secure interaction with MySQL databases and has anomaly analysis capabilities.更加牛逼!更加好用!不仅止于mysql的增删改查功能; 还包含了数据库异常分析能力;且便于开发者们进行个性化的工具扩展
pluggedin-app
The Crossroads for AI Data Exchanges. A unified, self-hostable web interface for discovering, configuring, and managing Model Context Protocol (MCP) servers—bringing together AI tools, workspaces, prompts, and logs from multiple MCP sources (Claude, Cursor, etc.) under one roof.
us-census-bureau-data-api
The U.S. Census Bureau Data API MCP connects AI Assistants with official Census Bureau statistics.
neurondb
PostgreSQL extension for vector search, embeddings, and ML, plus NeuronAgent runtime and NeuronMCP server.
claude-code-agentic-semantic-memory-system
This guide provides complete instructions for implementing an **Agentic Semantic Memory System** that enables Claude agents to:
ai-create
ai-create-mcp is a Go-based tool that converts OpenAPI Specification (OAS) files into a Model Context Protocol (MCP) program.