AI Agents for SQL and Databases in DataGrip
In a Nutshell
DataGrip's AI agents connect directly to databases via MCP tools, letting users create data sources, query schemas, and run SQL through natural language conversation. The agent can discover connections from other tools, analyze database structure, execute read queries, and even drop objects after safety checks, with all permissions managed in IDE settings. Users can reference specific database objects or files using @mentions, and the AI provides detailed explanations while maintaining security by never receiving actual credentials.
These notes were generated by AI and may contain inaccuracies.
Once the AI assistant plugin is installed, the AI assistant button appears in the top toolbar. Clicking it opens the tool window, where users can choose between chat mode or any agent installed on the machine. Available agents include Claude, Codex, Gemini, or any other agent from the ACP registry. Claude is used for this demonstration.
There might be a need to configure the MCP server for the specific agent. Refer to DataGrip's documentation to accomplish this.
Method 1: Using JDBC URL
The simplest method to create a data source is to use a JDBC URL. Type "create data source from URL" and paste the URL into the agent chat. Claude first asks for permission to run a skill called database connection management. Once allowed, Claude requests permission to run the MCP tool called create database connection. After allowing this, it asks for credentials since they aren't transferred via the URL. After entering username and password, the data source is created and visible in the database explorer tool window, complete with all its objects.
A connection is created within DataGrip, and credentials are never passed to the AI agent.
Method 2: Providing Connection Details Directly
Another straightforward way to create a data source is to provide the agent with all known connection details. Type "create another data source" and specify the database type (MySQL), host (locally), port (33081), and database name (guest). Claude asks to use the database connection management skill, then prompts for credentials. After entering credentials and clicking okay, the second data source is created. All details are visible in the chat, the test connection is successful, and objects are visible in the database explorer.
Sign in to read the full notes
Get access to AI-generated notes, topic timestamps, and more.