Database Connection Configuration
Configuration File Location
The server searches for configuration files in this order:- Path specified by
MYSQL_MCP_CONFIGenvironment variable (absolute or relative to module directory) local_config.jsonin the module directory (default)config.jsonin the module directoryconfig.jsonin the current working directory
Basic Configuration Format
The configuration file uses JSON with the following structure:Required Fields
host: Hostname or IP address of the MySQL serveruser: Database usernamepassword: Database passworddatabase: Default schema/database nameport: MySQL port (typically 3306)
Example: Simple Local Connection
Example: Multiple Connections
SSH Bastion Configuration
For secure connections through an SSH bastion host, add abastion section:
Bastion Fields
Required:bastion_host: SSH bastion hostnamebastion_username: SSH usernameprivate_key_path: Path to SSH private keydb_host: Internal database hostname (accessible from bastion)
db_port: Database port (default: 3306)bastion_port: SSH port (default: 22)local_bind_host: Local interface to bind (default: “127.0.0.1”)local_bind_port: Local port for tunnel (default: 3306)
OCI Configuration
For OCI Object Storage features and MySQL HeatWave integration, configure OCI credentials.Default Location
The server looks for OCI config at~/.oci/config. See the OCI SDK documentation for setup instructions.
Example OCI Config File
Environment Variables
The server supports these environment variables:PROFILE_NAME: OCI configuration profile name (default: “DEFAULT”)TENANCY_ID_OVERRIDE: Override the tenancy ID from the config file
When is OCI Config Required?
The OCI config file is only required for:- Listing OCI compartments
- Accessing OCI Object Storage
- Loading files from Object Storage into vector stores (HeatWave)
MySQL AI connections work without OCI config for all database operations. Cloud-dependent features will fail gracefully with clear error messages if OCI config is missing.
MCP Client Configuration
Claude Desktop (Windows)
On Windows, you may need to use
oracle.mysql_mcp_server.exe as the command.Claude Desktop (macOS/Linux)
With Environment Variables
Override OCI settings using environment variables:Configuration Validation
The server validates configuration at startup:- Schema Validation: Ensures all required fields are present
- Default Application: Applies defaults for optional bastion settings
- Clear Error Messages: Raises exceptions for invalid or incomplete configurations
Common Configuration Errors
Missing required connection fields
Missing required connection fields
Ensure each connection in
server_infos has all required fields: host, user, password, database, and port.Invalid bastion configuration
Invalid bastion configuration
If a
bastion block is present, only allowed keys are permitted. Extra keys will cause validation errors.Allowed keys: bastion_host, bastion_username, private_key_path, db_host, db_port, bastion_port, local_bind_host, local_bind_portConfiguration file not found
Configuration file not found
If
MYSQL_MCP_CONFIG is set but the file doesn’t exist, or if none of the default locations contain a config file, the server will fail to start.Check:MYSQL_MCP_CONFIGenvironment variable points to an existing filelocal_config.jsonexists in the module directory- File permissions allow reading
Security Best Practices
- Use
.gitignoreto excludelocal_config.jsonand other credential files - Use environment variables for sensitive values in production
- Restrict file permissions:
chmod 600 config.json - Consider using SSH bastion hosts for remote database access
- Rotate passwords regularly
Next Steps
API Tools
Explore available database and ML tools
Vector Stores
Set up vector stores for RAG applications
