{
  "markdown": "# Gemini CLI Extension - MySQL\n\n> [!NOTE]\n> This extension is currently in beta (pre-v1.0), and may see breaking changes until the first stable release (v1.0).\n\nThis Gemini CLI extension provides a set of tools to interact with [MySQL](https://dev.mysql.com/doc/) instances. It allows you to manage your databases, execute queries, and explore schemas directly from the [Gemini CLI](https://google-gemini.github.io/gemini-cli/), using natural language prompts.\n> [!IMPORTANT]\n> **We Want Your Feedback!**\n> Please share your thoughts with us by filling out our feedback [form][form]. \n> Your input is invaluable and helps us improve the project for everyone.\n\n[form]: https://docs.google.com/forms/d/e/1FAIpQLSfEGmLR46iipyNTgwTmIDJqzkAwDPXxbocpXpUbHXydiN1RTw/viewform?usp=pp_url&entry.157487=mysql\n\n## Why Use the MySQL Extension?\n\n* **Natural Language Management:** Stop wrestling with complex commands. Explore schemas and query data by describing what you want in plain English.\n* **Seamless Workflow:** As a Google-developed extension, it integrates seamlessly into the Gemini CLI environment. No need to constantly switch contexts for common database tasks.\n* **Code Generation:** Accelerate development by asking Gemini to generate data classes and other code snippets based on your table schemas.\n\n\n## Prerequisites\n\nBefore you begin, ensure you have the following:\n\n* One of the supported agent harnesses, installed and authenticated:\n  * [Gemini CLI](https://github.com/google-gemini/gemini-cli) (v0.6.0+)\n  * [Claude Code](https://code.claude.com)\n  * [Codex](https://developers.openai.com/codex) (v0.150.0+)\n  * [Antigravity CLI](https://antigravity.google)\n* [Node.js](https://nodejs.org/) (the MCP server runs via `npx`).\n* A running MySQL instance.\n* A user with database-level permissions to execute queries.\n\n## Getting Started\n\n### Installation\n\nAll harnesses use the same plugin; the MCP server runs via `npx` (no binary to download). Install with your harness of choice:\n\n**Gemini CLI**\n\n```bash\ngemini extensions install https://github.com/gemini-cli-extensions/mysql\n```\n\n**Claude Code**\n\n```bash\nclaude plugin marketplace add gemini-cli-extensions/mysql\nclaude plugin install mysql@mysql\n```\n\n**Codex**\n\n```bash\ncodex plugin marketplace add gemini-cli-extensions/mysql\ncodex plugin add mysql@mysql\n```\n\n**Antigravity**\n\n```bash\nagy plugin install https://github.com/gemini-cli-extensions/mysql\n```\n\nSee [Configuration](#configuration) for how each harness supplies the connection settings.\n\n### Configuration\n\nThe plugin connects to MySQL using these settings:\n\n*   `MYSQL_HOST`: (Optional) The MySQL host. Defaults to `localhost`.\n*   `MYSQL_PORT`: (Optional) The MySQL port. Defaults to `3306`.\n*   `MYSQL_DATABASE`: The name of the database to connect to.\n*   `MYSQL_USER`: The database username.\n*   `MYSQL_PASSWORD`: The password for the database user.\n\nHow you supply them depends on the harness:\n\n*   **Gemini CLI**: prompted on install and saved to the extension's `.env`. View or update later with `gemini extensions list` / `gemini extensions config mysql [setting] [--scope user|workspace]` (restart the CLI to apply).\n*   **Claude Code**: pass `--config KEY=VALUE` on install (repeatable), or run `/plugin` inside Claude Code.\n*   **Codex** and **Antigravity**: export the variables in your shell before starting:\n\n```bash\nexport MYSQL_HOST=\"<your-mysql-host>\"       # Optional, defaults to localhost\nexport MYSQL_PORT=\"<your-mysql-port>\"       # Optional, defaults to 3306\nexport MYSQL_DATABASE=\"<your-database-name>\"\nexport MYSQL_USER=\"<your-database-user>\"\nexport MYSQL_PASSWORD=\"<your-database-password>\"\n```\n\n> [!NOTE]\n> See [Troubleshooting](#troubleshooting) for debugging your configuration.\n\n### Start Gemini CLI\n\nTo start the Gemini CLI, use the following command:\n\n```bash\ngemini\n```\n\n> [!WARNING]\n> **Changing Instance & Database Connections**\n> Currently, the database connection must be configured before starting the Gemini CLI and can not be changed during a session.\n> To save and resume conversation history use command: `/chat save <tag>` and `/chat resume <tag>`.\n\n## Usage Examples\n\nInteract with MySQL using natural language right from your IDE:\n\n* **Explore Schemas and Data:**\n  * \"Show me all tables in the 'orders' database.\"\n  * \"What are the columns in the 'products' table?\"\n  * \"How many orders were placed in the last 30 days, and what were the top 5 most purchased items?\"\n* **Generate Code:**\n  * \"Generate a Python dataclass to represent the 'customers' table.\"\n\n## Supported Tools\n\n*  `list_tables`: Use this tool to list tables and descriptions.\n*  `execute_sql`: Use this tool to execute any SQL statement.\n*  `get_query_plan`: Use this tool to generate an execution plan.\n*  `list_active_queries`: Use this tool to lists top N (default 10) ongoing queries.\n*  `list_tables_missing_unique_indexes`: Use this tool to find tables that do not have primary or unique key constraint\n*  `list_table_fragmentation`: Use this tool to list fragmented tables\n\n## Additional Extensions\n\nFind additional extensions to support your entire software development lifecycle at [github.com/gemini-cli-extensions](https://github.com/gemini-cli-extensions), including:\n* [Cloud SQL for MySQL extension](https://github.com/gemini-cli-extensions/cloud-sql-mysql)\n* and more!\n\n## Troubleshooting\n\nUse `gemini --debug` to enable debugging.\n\nCommon issues:\n\n* \"✖ Error during discovery for server: MCP error -32000: Connection closed\": The database connection has not been established. Ensure your configuration is set via environment variables.\n* \"✖ MCP ERROR: Error: spawn npx ENOENT\": Node.js/`npx` is not installed or not on your `PATH`. Install Node.js (which provides `npx`).\n* \"npm error\"/network failures on first run: `npx` fetches `@toolbox-sdk/server` on first launch, so it needs network access. Retry once connectivity is available.\n",
  "bytes": 5892,
  "sha": "bbcbfac6765a99c2e5a7b3c1fb53e33f5851be2072deb2eb1335ad3589e009dc",
  "repo_slug": "gemini-cli-extensions/mysql",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_gemini_cli_extensions_mysql_6ee14398/readme"
}