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

> Let your agent answer questions from SQLite or Postgres without ever writing SQL. It maps your schema, drafts a reviewed catalogue of named, parameterised queries with you, lints it, wires up the open-source mcp-sql-connector server, and answers only through those queries.

Read-Only SQL Database Access for AI Agents (MCP) is a paid AI agent skill on Agensi by Prakash Reddy Chandupatla, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $9 (one-time purchase)
- Creator: [Prakash Reddy Chandupatla](https://www.agensi.io/creators/prakash-reddy-chandupatla)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-11-27
- Security: scan passed (2026-11-27); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/read-only-sql-database-access-for-ai-agents-mcp
- Tags: database, api, security, sql, mcp, postgres, sqlite, read-only

## 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+
- SQLite or PostgreSQL database
- MCP-capable agent (Claude Code, Cursor, Copilot, etc.)
- Sql Connector MCP
- Git
- Optional: pg npm package (Postgres only)

## Known limitations

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 this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Read-Only SQL Database Access for AI Agents (MCP) skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How does this connector ensure security compared to giving an AI direct SQL access?

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.

### Which AI agents and IDEs can I use with the SQL Catalog Connector?

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.

### What database engines and technical environments are supported?

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

### Can my AI agent perform write or delete operations on my database using this skill?

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.

### What is included in the purchase of this skill?

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.

### Do I need to manually map my entire database schema for the agent to understand it?

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.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
