{
  "markdown": "# Gemini CLI Extension - SQL Server\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 [Microsoft SQL Server](https://docs.microsoft.com/en-us/sql/) 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\nLearn more about [Gemini CLI Extensions](https://github.com/google-gemini/gemini-cli/blob/main/docs/extensions/index.md).\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=sql-server\n\n## Why Use the SQL Server 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 SQL Server 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/sql-server\n```\n\n**Claude Code**\n\n```bash\nclaude plugin marketplace add gemini-cli-extensions/sql-server\nclaude plugin install sql-server@sql-server\n```\n\n**Codex**\n\n```bash\ncodex plugin marketplace add gemini-cli-extensions/sql-server\ncodex plugin add sql-server@sql-server\n```\n\n**Antigravity**\n\n```bash\nagy plugin install https://github.com/gemini-cli-extensions/sql-server\n```\n\nSee [Configuration](#configuration) for how each harness supplies the connection settings.\n\n### Configuration\n\nThe plugin connects to SQL Server using these settings:\n\n*   `MSSQL_HOST`: (Optional) The SQL Server host. Defaults to `localhost`.\n*   `MSSQL_PORT`: (Optional) The SQL Server port. Defaults to `1433`.\n*   `MSSQL_DATABASE`: The name of the database to connect to.\n*   `MSSQL_USER`: The database username.\n*   `MSSQL_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 sql-server [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#### PowerShell\n```powershell\n$env:MSSQL_HOST = '<your-sql-server-host>'  # Optional: defaults to localhost\n$env:MSSQL_PORT = '<your-sql-server-port>'  # Optional: defaults to 1433\n$env:MSSQL_DATABASE = '<your-database-name>'\n$env:MSSQL_USER = '<your-database-user>'\n$env:MSSQL_PASSWORD = '<your-database-password>'\n```\n\n#### Bash\n```bash\nexport MSSQL_HOST=\"<your-sql-server-host>\"  # Optional: defaults to localhost\nexport MSSQL_PORT=\"<your-sql-server-port>\"  # Optional: defaults to 1433\nexport MSSQL_DATABASE=\"<your-database-name>\"\nexport MSSQL_USER=\"<your-database-user>\"\nexport MSSQL_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 SQl Server 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`: lists schema information for all or specified tables in a SQL server database.\n* `execute_sql`: executes a SQL statement against a SQL Server database.\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 SQL Server extension](https://github.com/gemini-cli-extensions/cloud-sql-sqlserver)\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": 6166,
  "sha": "64f3a61b1dbfdd61fedf71a544af9861eaf03b556b98b1acaa28d732846e3079",
  "repo_slug": "gemini-cli-extensions/sql-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_gemini_cli_extensions_sql_server_5ebdb0ee/readme"
}