• DATA
  • METRICS
  • LIMITS
  • HUMAN

How to run SQL queries and monitor branches with your AI

Connect Xata to your AI client once. After that, you can query your data and check branch health using natural language.

Ask AI about this page

Short answer

How can I run SQL and check branch metrics with my AI?

Your AI client uses Xata tools to execute SQL commands and pull real-time metrics for your branches. You get direct access to your data and resource limits without leaving your chat interface.

The outcomes

Where your data and metrics land.

The AI handles the heavy lifting of querying and monitoring, delivering results straight to your chat.

DATA

SQL query results

The AI runs your SQL commands and presents the resulting rows or tables in your chat window.

METRICS

Branch health reports

Your agent pulls specific resource metrics for any branch to show you how it's performing.

LIMITS

Project capacity checks

The AI checks your current project limits so you know exactly how much headroom you have left.

HUMAN

Manual credential rotation

If you need to rotate branch credentials, you'll handle that through the Xata dashboard or via specific commands.

The workflow

What your AI does when you ask for data or metrics.

The AI translates your questions into specific tool calls to interact with your Xata environment.

  1. Querying data

    When you ask for specific records or summaries, the AI executes the necessary SQL against your database.

    execute_sql
  2. Checking performance

    The AI pulls usage data and resource stats for your specific branches.

    get_branch_metrics
  3. Verifying limits

    Your agent looks up the constraints and limits applied to your current project.

    get_project_limits
  4. Managing access

    The AI can retrieve the credentials needed for a branch or trigger a rotation if requested.

    get_branch_credentialsrotate_branch_credentials

Try it

Copy these to start.

Use these prompts to begin interacting with Xata.

Starting points

These are templates. Swap out the table names, branch names, or specific metrics to match your setup.

Xata Connector

You're all set. Choose your MCP client and follow the setup instructions.

Connector linkhttps://edge.vinkius.com/vk_preview_L1fPQpj7643i5hPrQ8OQthSyV0MvLkmkAt1FtqV6/mcp

Claude Desktop

Follow the steps below to connect in seconds.

  1. 1In Claude Desktop, open Settings → Connectors.
  2. 2Click “Add custom connector” and paste the connector link above as the remote MCP server URL.
  3. 3Click Add and start a new chat — Xata capabilities are ready to use.
Configuration · claude_desktop_config.jsonCopy
{
  "mcpServers": {
    "xata-mcp": {
      "url": "https://edge.vinkius.com/vk_preview_L1fPQpj7643i5hPrQ8OQthSyV0MvLkmkAt1FtqV6/mcp"
    }
  }
}
Copy into chat04
  • Run a SQL query to find the top 5 users in the 'customers' table.

  • What are the current resource metrics for the 'production' branch?

  • Check the project limits for my current Xata project.

  • Get the credentials for the 'staging' branch.

  • Claude
  • ChatGPT
  • Cursor
  • VS Code
  • Windsurf
  • Claude Code
  • JetBrains
  • Cline

Start here

Connect Xata once, then ask.

Follow the link to connect your account. Your credentials stay encrypted, and you can start querying immediately.

Connect Xata to your AI

FAQ

How the Xata MCP behaves

  • 01

    Can the AI delete my database tables?

    No. The available tools are limited to executing SQL, getting metrics, and managing credentials. It cannot drop tables or delete your database.

  • 02

    Can I use this to create new branches?

    No. The tools allow you to monitor and manage existing branches, but they do not include a capability to create new ones.

  • 03

    How does the AI get my database access?

    It uses the branch credentials provided through the connection to run commands securely.

  • 04

    Can the AI change my project billing settings?

    No. The AI can only check project limits; it has no access to your billing or subscription management.

  • 05

    Does the AI see all my data?

    The AI only sees the data returned by the specific SQL queries or metric requests you authorize it to run.

  • More questions about Xata? See everything the Xata Connector can do

Connect Xata to Claude, Cursor, ChatGPT & more