Featured

Deploy OpenClaw in 60 seconds — 20% off logoDeploy OpenClaw in 60 seconds — 20% off

Launch OpenClaw on Hostinger in about 60 seconds and keep your agent live 24/7. Our referral link gives you 20% off, no coupon code needed.

Launch on Hostinger
Run your Hermes agent on Hostinger, fully managed logoRun your Hermes agent on Hostinger, fully managed

Launch Hermes on Hostinger in one click, fully managed, no VPS knowledge needed. Use code ZACAARON10 for 10% off.

Launch on Hostinger
Crawl and scrape any site into clean data, 10% off logoCrawl and scrape any site into clean data, 10% off

Firecrawl crawls and scrapes any site into clean markdown for your agent. Get 1,000 free credits, and new users get 10% off their first purchase.

Try Firecrawl free
Your own AI agent, running 24/7 with QwikClaw logoYour own AI agent, running 24/7 with QwikClaw

QwikClaw sets up and runs an always-on OpenClaw agent for you. One click, no config files, no server setup.

Deploy now
One API to scrape, enrich, and extract the internet. logoOne API to scrape, enrich, and extract the internet.

Context.dev gives your agents a single API to scrape, enrich, and extract live web data — no proxies, no parsers, no maintenance.

Start building free
SetupClaw: done-for-you OpenClaw for founders & exec teams logoSetupClaw: done-for-you OpenClaw for founders & exec teams

White-glove OpenClaw for founders and exec teams (4–50+ employees): we install, harden, integrate your tools, and maintain it — secured from day one.

Get it set up for you
SEO data APIs for your agent, $1 free credit logoSEO data APIs for your agent, $1 free credit

DataForSEO gives your agent live access to SERP results, keyword data, backlinks, and on-page SEO data through one API. New accounts get a $1 credit, good for up to 20,000 keyword or backlink lookups.

Try DataForSEO free
Reach 47,000+ AI builders

A flat monthly placement in front of developers actively installing AI tools. No lock-in, cancel anytime.

Advertise here

Works with

Claude CodeClaude DesktopCursorVS CodeClineCodex CLIOpenClaw+ any MCP client

Install to Claude Code

This server doesn't publish a one-line install command. Follow the setup in the source repository.

Summary

Enables secure, runtime-authenticated MySQL database querying and mutation through dynamic tools, allowing AI assistants to list databases/tables, describe schemas, and perform CRUD operations.

README.md

Dynamic MySQL MCP Server

Model Context Protocol (MCP) server for MySQL, enabling AI assistants to query and mutate MySQL data safely through tools.

Features

  • 🔧 Tool-based MySQL access (no required env vars)
  • 🔐 Runtime authentication via auth_mysql
  • 🗂️ List databases and tables
  • 🧱 Describe table schemas
  • 📄 CRUD-like row operations (select_rows, insert_row, update_rows, delete_rows)
  • 🧾 Custom SQL execution (execute_sql) with optional parameters
  • 🌐 MCP resources for table schema discovery

Why Dynamic (vs static MySQL MCP servers)

Many MySQL MCP servers are configured statically (fixed host/user/password via env or config file). This project is intentionally dynamic.

  • Runtime auth via tool calls (auth_mysql) instead of requiring credentials at server boot
  • Switch database context during a session using use_database (or per-call database override)
  • Work across multiple databases/environments from one running MCP server session
  • Better fit for agent workflows where connection details change per task
  • No required auth environment variables for normal use

| Capability | Dynamic MySQL MCP Server | Typical static MySQL MCP | | --- | --- | --- | | Credentials | Provided at runtime with auth_mysql | Fixed in env/config at startup | | Environment switching | Re-auth per task/session | Usually restart/reconfigure | | Database switching | use_database + per-call database | Often single default DB | | Agent workflow fit | High (task-driven connections) | Medium (preconfigured only) | | Secrets handling model | No required auth env vars | Often relies on persistent env secrets |

Installation

npm install dynamic-mysql-mcp
# or
bun install dynamic-mysql-mcp

Usage

With Claude Desktop

{
  "mcpServers": {
    "mysql": {
      "command": "npx",
      "args": ["dynamic-mysql-mcp"]
    }
  }
}

Direct Usage

npx dynamic-mysql-mcp

Authentication Flow (via tools)

  1. auth_mysql (host default 127.0.0.1, pass user/password and optional host/port/database/ssl)
  2. Optional: use_database to switch default DB like SQL USE <db>
  3. get_auth_status
  4. Use schema/data tools
  5. logout

No environment variable is required for auth.

Quick Tutorial

Use prompt-style language like this when chatting with an AI connected to this MCP:

  1. "Log in to local MySQL using root with an empty password."
  2. "Set the active database to my_app."
  3. "Show all tables in the active database."
  4. "Describe the users table, including column names and data types."
  5. "Fetch the 10 most recent rows from users, ordered by id descending."
  6. "Insert one new user into users with email test@example.com."
  7. "Update the user with id 1 and set the name to Budi."
  8. "Delete the user row with id 1."
  9. "Switch the active database to analytics."
  10. "Run custom SQL: SELECT id, email FROM users WHERE created_at >= ? with params [\"2026-01-01\"]."

Tip: if you want to run an operation on a specific database without switching the active database, mention the database directly in your prompt, for example: "Fetch 5 rows from analytics.events".

More Prompt Examples

  • Date filters:
  • "Fetch orders from the last 30 days based on created_at."
  • "Show payments between 2026-02-01 and 2026-02-10."
  • Pagination:
  • "Fetch 20 users starting from row 21."
  • "Show page 3 of products with 10 rows per page."
  • Keyword search:
  • "Find users whose email contains admin."
  • "Fetch posts whose title contains promo."
  • Combined filter + sort:
  • "Fetch 10 paid invoices, ordered by id descending."
  • "Show error-level logs, newest first, limited to 50 rows."

Available Tools

  • health
  • auth_mysql
  • get_auth_status
  • logout
  • list_databases
  • use_database
  • list_tables
  • describe_table
  • select_rows
  • insert_row
  • update_rows
  • delete_rows
  • execute_sql

Development

bun install
bun run dev
bun run typecheck
bun run test
bun run build

License

MIT

See related servers & alternatives →

Related MCP servers

Browse all →

Related guides

Hand-picked reading to help you choose and use Databases servers.