- Home
- MCP servers
- MySQL Navigator
MySQL Navigator
- python
6
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"medsaad-mcp-db-navigator": {
"command": "mcp-db",
"args": [
"--config",
"/absolute/path/to/your/.env"
],
"env": {
"DB_HOST": "db.example.com",
"DB_NAME": "mydb",
"DB_PORT": "3306",
"DB_USER": "dbuser",
"DB_SSL_CA": "/path/to/ssl/ca.pem",
"DB_PASSWORD": "p@ssw0rd",
"DB_MAX_RETRIES": "3",
"DB_RETRY_DELAY": "1.0"
}
}
}
}You can connect to MySQL or MariaDB databases, navigate schemas, run parameterized queries, and securely manage credentials using an MCP server dedicated to database navigation. This server provides safe query execution, dynamic database switching, and robust logging with SSL/TLS support for encrypted connections, making database management safer and more efficient.
How to use
To use this MCP server, start the MCP client and point it at the local stdio server you run. You will open a connection to a MySQL or MariaDB instance, switch databases as needed, and execute queries with built‑in parameter validation. The server validates inputs, protects credentials, and returns results along with useful schema information so you can inspect tables, columns, and relationships.
Typical workflows include establishing a connection using your .env file, selecting the target database, and issuing parameterized queries. You can retrieve the database schema to understand tables and columns, then run queries with specified fields, filters, ordering, and optional joins. All query parameters are validated to prevent invalid inputs and SQL injection, and you can rely on automatic retries and secure SSL/TLS connections when needed.
How to install
Prerequisites: you need Python and a working Python package manager to install and run the MCP server.
Install the MCP server package from PyPI.
pip install mcp-db-navigator
Create a configuration file containing your database credentials. Save this as a hidden file named .env in a location you will reference when starting the server.
DB_HOST=your_host
DB_PORT=your_port
DB_NAME=your_database_name
DB_USER=your_username
DB_PASSWORD=your_password
DB_SSL_CA=/path/to/ssl/ca.pem # Optional: for SSL/TLS connections
DB_MAX_RETRIES=3 # Optional: number of connection retries
DB_RETRY_DELAY=1.0 # Optional: delay between retries in seconds
Additional setup and usage notes
Log files are stored in your home directory by default to help you troubleshoot issues. The path is automatically created if it does not exist.
If you need to run the server from a script or integrate it with another tool, you can start it from the command line and supply the path to your .env file.
If you configure clients to talk to MCP servers, use the following standard MCP command structure to run this server locally.
All sensitive credentials are managed through the config file, and passwords are treated as secret values by the server’s validation logic. SSL/TLS is supported for encrypted connections and connection pooling helps optimize resource usage.
Security and reliability notes
Credentials are stored and used securely as secret values within the configuration. All query parameters are validated to prevent malformed input, and queries are executed using parameterized statements to mitigate SQL injection risks.
The server includes automatic retry logic for transient connection failures and supports configurable retry delays and maximum retry attempts. Connection pooling is used to improve throughput and reduce latency in high‑demand scenarios.
SSL/TLS support ensures encrypted connections to the database, helping protect data in transit and meeting common security requirements for database access.
Troubleshooting tips
If you encounter connection failures, verify that your .env file contains the correct host, port, database name, and credentials. Check the SSL_CA path if you are using SSL/TLS.
Ensure the .env file path you provide is absolute when configuring MCP clients to connect to the server. Look in the log file for detailed error messages and retry information.
Tools and capabilities overview
The server provides capabilities for connecting to a MySQL/MariaDB instance, switching databases on the fly, executing SQL queries with parameter validation, retrieving schema information, and secure credential management. It also includes comprehensive logging, connection pooling, retry mechanisms, and SSL/TLS support for secure operation.
Available tools
connect_database
Establishes a connection to the MySQL/MariaDB database using the provided host, port, database, and credentials.
switch_database
Switches the active database within the current connection without reconnecting.
execute_query
Executes a parameterized SQL query with support for select, insert, update, and delete operations, returning results.
get_schema
Retrieves schema information including tables, columns, and data types for the connected database.
validate_parameters
Validates query parameters against defined schemas (Pydantic models) to ensure proper types and values.
secure_credentials
Safely manages credentials, minimizing exposure in memory and logs.
logging
Provides structured, level-based logging for operations, errors, and performance metrics.
connection_pooling
Manages a pool of database connections to optimize resource usage and throughput.
ssl_tls
Configures and enforces SSL/TLS for encrypted database connections.