Read-Only SQL Database Access for AI Agents (MCP)

    by Prakash Reddy Chandupatla

    1

    This skill takes the other route: your agent only ever calls named, reviewed queries with typed, validated values, through the open-source mcp-sql-connector MCP server.

    $9

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned

    Works with the AI Agents you already use

    Read-Only SQL Database Access for AI Agents (MCP)

    Example session with this skill installed

    Connect my shop's SQLite database at ./shop.db to my agent and tell me which city brought in the most revenue in March 2026.

    • Read your context and instructions
    • Compiled the read-only sql database

    Summary

    Mapped the schema read-only, built and linted a 4-query catalogue with you, registered the server, and answered from the revenue_by_city query.

    Hyderabad led March 2026 with ₹3,398 from 2 orders.

    1. Schema (via discovery tools list_tables, table_columns, table_foreign_keys)

    TableKey columnsNotes
    customersid, name, email (PII), city, created_at
    ordersid, customer_id → customers.id, status, total_paise, placed_atstatus ∈ pending, paid, shipped, refunded (from CHECK constraint); money stored in paise
    support_notesorder_id → orders.id, notenot needed for your questions, left out

    2. Proposed catalogue entry (approved by you)

    {
      "name": "revenue_by_city",
      "description": "Paid and shipped revenue (INR) and order count per customer city for orders placed between two dates, inclusive. One row per city, highest revenue first.",
      "sql": "SELECT c.city, COUNT(*) AS orders, SUM(o.total_paise) / 100.0 AS revenue_inr FROM orders o JOIN customers c ON c.id = o.customer_id WHERE o.status IN ('paid','shipped') AND o.placed_at BETWEEN :from AND :to GROUP BY c.city ORDER BY revenue_inr DESC",
      "params": {
        "from": { "type": "date", "required": true },
        "to":   { "type": "date", "required": true }
      },
      "maxRows": 50
    }
    

    3. Lint

    $ node scripts/lint_catalog.mjs queries.json
    4 queries, 0 error(s), 0 warning(s)
    

    4. Registered

    claude mcp add shop-sql -- node ~/.mcp-sql-connector/src/server.ts --catalog /abs/queries.json --sqlite /abs/shop.db
    

    5. Answer

    Called revenue_by_city with from: 2026-03-01, to: 2026-03-31 (whole of March, inclusive; paid + shipped only):

    CityOrdersRevenue (INR)
    Hyderabad23,398
    Chennai1399

    Hyderabad brought in the most, about 89% of March revenue. Pending and refunded orders are excluded by the query definition. Result was not truncated.

    Next steps

    • Want revenue by month for the whole year? revenue_by_month is already in your catalogue.
    • To compare cities over a custom range, ask with dates and I'll use the same tool.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Database answers your agent can't turn into a DROP TABLE

    Text-to-SQL means trusting a model with every table and column. This skill takes the other route: your agent only ever calls named, reviewed queries with typed, validated values, through the open-source mcp-sql-connector MCP server. Nothing the model sends can change the SQL.

    What the skill makes your agent do

    1. Install & verify the server (Node 22.18+, no other dependencies for SQLite; pg for Postgres).
    2. Discover the schema read-only using bundled discovery catalogues: tables, columns, foreign keys, indexes, CHECK constraints, Postgres enum types, row estimates. No ad-hoc SQL, no pasting dumps.
    3. Interview you for the 5-15 questions you actually need answered.
    4. Draft the catalogue: one query per question, typed params with enums from your real data, min/max, maxLength, PII masking, row caps, units in column names.
    5. Lint it with the bundled offline checker (the server's own start-up rules plus 15 quality checks), show you every query, and wait for your approval.
    6. Register it with Claude Code, Claude Desktop, Cursor, VS Code/Copilot or any MCP client.
    7. Answer questions only through the catalogue, resolving "last month" to explicit dates, flagging truncated results, and proposing a new reviewed query when nothing fits instead of improvising.

    Guarantees from the server

    • Values bound as positional parameters: no SQL injection.
    • One statement per query; anything that looks like a write must be explicitly marked and enabled.
    • SQLite opened read-only; Postgres reads run in BEGIN READ ONLY with a statement timeout.
    • Row caps on every query; database errors are never echoed to the model.
    • JSON audit log per call, with personal-data params masked.

    What's in the ZIP

    • SKILL.md: the step-by-step workflow and ground rules.
    • scripts/lint_catalog.mjs: offline catalogue linter (no dependencies, no network, no DB access).
    • templates/: schema-discovery catalogues for SQLite and Postgres, plus a starter catalogue (time series, optional filters, lookups, top-N).
    • reference/: query patterns, per-client MCP setup, and SQL for a least-privilege Postgres role.

    Good fit for

    Analysts, founders and support/ops teams who want to ask their database questions in plain English, and engineers who need to give an agent data access that a security review will accept.

    Network use

    Step 1 clones the open-source server from its public GitHub repository (the skill tells the user first). Nothing else in the skill makes network calls.

    Requires Node.js 22.18+. Does not support ad-hoc SQL execution. Write operations are disabled by default. Database errors are suppressed for security; logs must be checked via stderr.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 7 days ago

    Software
    Node.js 22.18+
    SQLite
    orPostgreSQL database
    MCP-capable agent (Claude Code, Cursor, Copilot, etc.)Sql Connector MCPGit
    Optional
    pg npm package (Postgres only)

    Permissions

    Terminal / Shell
    Read Files
    Write Files
    Network Access

    Shell: runs node to start the MCP server and the offline catalogue linter. Read/Write files: reads the user's catalogue JSON and writes catalogue and MCP config files after the user approves them. Network: a one-time git clone of the open-source server from GitHub, disclosed to the user before it runs.

    Listed7 days ago

    What's inside

    Frequently Asked Questions

    Unlike agents that generate raw SQL on the fly, this skill uses a pre-vetted query catalog and the Model Context Protocol (MCP) to ensure the AI only executes approved, parameter-validated commands, preventing hallucinations and accidental data loss.

    This skill is compatible with any agent or IDE that supports the Model Context Protocol (MCP), including Claude Code, Cursor, and the Claude Desktop app.

    The connector currently supports SQLite and PostgreSQL databases, requiring a Node.js 22.18+ environment to run the linter and server components.

    No, the skill is designed for read-only access by default to prevent data modification; all queries are restricted to a defined catalog of parameterised GET requests.

    You will receive the complete connector package, schema discovery tools, a library of template catalogs, and the configuration snippets required to register the tool with your MCP-compliant clients.

    The skill includes a Schema Discovery tool that automatically identifies tables, columns, and constraints, helping you quickly map your database and define PII protection rules without manual data entry.

    New in Data & Databases

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.