Skip to main content
A FastMCP-based server that provides tools for managing MySQL connections, executing SQL, using MySQL AI or MySQL HeatWave ML/GenAI features, and working with OCI Object Storage.
This MCP server is not intended for production use but as a proof of concept for exploring models using MCP Servers. MySQL MCP Server is the recommended server to get started with MySQL HeatWave or MySQL AI and the only server in this repository that supports MySQL AI.

Features

Database Connection Management

  • Load connection configs from JSON or environment variables
  • List all configured database connections
  • Validate connectivity and resolve provider mode (MySQL AI vs. MySQL HeatWave)

Database Operations

  • Execute SQL queries with parameterized statements
  • Support for multiple connection configurations

MySQL AI and HeatWave ML/GenAI

  • Text Generation: Generate text using GenAI models
  • Vector Embeddings: Create and populate vector columns for semantic search
  • RAG (Retrieval-Augmented Generation): Query vector stores with natural language
  • NL2SQL: Convert natural language questions into SQL queries and execute automatically
  • HeatWave Help: Get answers about using HeatWave ML features

Vector Store Management

  • List files in secure_file_priv directory (local mode)
  • Load documents into vector stores from local filesystem
  • Load documents from OCI Object Storage into vector stores

OCI Object Storage Tools

  • List all compartments in your tenancy
  • Get compartment by name
  • List buckets in a compartment
  • List objects in a bucket

MySQL AI vs MySQL HeatWave

The server automatically detects which MySQL provider you’re connected to:

MySQL AI

  • Cloud-native MySQL service with integrated AI capabilities
  • Runs on MySQL Database Service instances
  • Vector processing happens within the database service
  • Supports local filesystem for document loading
  • Works without OCI config for pure database operations

MySQL HeatWave

  • In-memory analytics engine on Oracle Cloud Infrastructure
  • Distributed cluster architecture for high performance
  • Vector operations executed on HeatWave cluster
  • Integrates with OCI Object Storage for document loading
  • Requires OCI config for cloud features
Many tools work with both MySQL AI and HeatWave, but some are platform-specific. The server provides clear error messages when a tool is used with an unsupported connection type.

Prerequisites

  • Python 3.8+ with uv package manager
  • Database connection file: JSON file with connection details
    • Path from MYSQL_MCP_CONFIG environment variable (absolute or relative)
    • Or local_config.json (default)
  • OCI configuration file (~/.oci/config) - only required for OCI Object Storage features

Quick Start

  1. Create a connection configuration file (see Configuration)
  2. Install dependencies and run:
uv run oracle.mysql_mcp_server
  1. Configure in your MCP client (e.g., Claude Desktop):
{
  "mcpServers": {
    "mysqltools": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/mysql-mcp-server",
        "run",
        "oracle.mysql_mcp_server"
      ]
    }
  }
}

Example Use Cases

Database Operations

"List all configured database connections"
"Execute 'SELECT * FROM employees' on my connection"

ML and GenAI

"Generate a summary of error logs"
"Add embeddings for 'body' column into 'embedding' column in docs table"
"Ask ml_rag: Show me refund policy from the vector store"
"What is the average delay incurred by flights?"

Object Storage

"List all compartments in my tenancy"
"Show all buckets in the development compartment"
"List objects in my 'docs-bucket'"

Vector Store

"Load all documents with prefix 'manuals/' into schema hr, table product_docs"
"List local files for vector store ingestion"

Next Steps

Configuration

Set up database connections and OCI config

API Tools

Explore all available tools and their parameters

Vector Stores

Load documents and perform RAG queries

ML & GenAI

Use text generation, NL2SQL, and embeddings

Build docs developers (and LLMs) love