Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

AgentSQL

MCP server by cuipengdba Community

AgentSQL is a database security gateway for AI agents that use PostgreSQL or MySQL through MCP. It adds SQL audit, authorization, result masking and write approval. It is for teams that want external AI agents to query data under controlled access.

  • Score 70
  • 24 stars
  • Apache-2.0
  • Updated

Install AgentSQL

Built from the published package, never by AI.

claude mcp add --transport http agentsql https://demo.agentsql.cn/mcp

Run in your terminal. Add --scope user to use it in every project.

Step-by-step: install AgentSQL in Claude Code

MCP servers run with your permissions and can read what you give them access to. Some need an API key: check the README and add it under env in the agentsql block.

About

AgentSQL combines a standalone natural language data query agent with an MCP Server that acts as a database security gateway. Users can ask questions in AgentSQL's own pages, and other AI agents can connect to it as an MCP Server. Both entry points share the current identity and authorization, controlled SQL execution, result masking and persistent audit.

The MCP Server runs over stdio, Streamable HTTP or a standalone stateless HTTP mode. External agents use an Agent API Key, which the source says is not an admin token, and each request runs under the current permissions. The source positions it for teams that need to govern how AI agents access PostgreSQL and MySQL databases.

Written from the project's README and checked against it.

Tools it gives your assistant

  • Controlled SQL executionRuns agent-generated SQL through a gateway that checks identity and current authorization first.
  • SQL auditKeeps persistent audit records of the SQL that agents run.
  • Result maskingMasks sensitive data in query results before they reach the agent.
  • Write approvalRequires approval before write operations, according to the declared description.

What you need

  • Linux amd64 or arm64 with glibc 2.28 or newer and systemd for the native package, or Docker
  • An Agent API Key for external AI agents
  • A PostgreSQL or MySQL database bound to the gateway
  • A local text model and data source binding if you use the native query agent
SettingNeededWhat it is
AuthorizationHeaderOptionalDemo read-only API key. The demo uses synthetic data and resets daily; for production self-host with Docker via the GitHub repo.

From the publisher's entry in the official MCP Registry. Required settings are already in the install config below as placeholders.

Try asking

  • Run a read-only query to count orders placed last week.
  • Show the audit log for SQL my agent ran today.
  • Query the customers table and confirm sensitive fields are masked.

Good to know

  • Version 4.5.0 has not been verified in real business systems, according to the source.
  • Natural language results need checking against the generated SQL and business meaning.
  • Compatibility is not guaranteed at 100 percent, and the source makes no zero-change migration claim.
  • The public demo model is for simulated display only.

Security check

C
  • Downloads a script from the internet and runs itIn README.md: curl -fsSL https://github.com/cuipengdba/agentsql/releases/download/v4.5.0/install.sh | sudo sh
  • Asks for administrator rights (sudo)In README.md: sudo

Checked automatically: README.md. This looks for known risky patterns and is not a full audit. How grades work

Alternatives to AgentSQL

All alternatives →
Supabase supabase
97

Connects Supabase projects to AI assistants such as Cursor, Claude and Windsurf over the Model Context Protocol. It lets assistants manage tables, fetch config and query data in a Supabase project.

AAA Local and remote 172k/wk
ArcadeDB MCP Server ArcadeData
94

ArcadeDB MCP Server is the built-in Model Context Protocol server of the ArcadeDB multi-model database. It lets AI assistants and LLMs work with ArcadeDB's graph, document, time-series, vector and other data models. It suits people who already run ArcadeDB and want assistant access to it.

AAA Local 1.3k
DBHubbytebase
94

Connects MCP clients such as Claude Desktop, Cursor and VS Code to PostgreSQL, MySQL, MariaDB, SQL Server, Oracle, ClickHouse and SQLite. It exposes two tools by default, with read-only mode and query timeouts available as guardrails.

AAA Local 343k/wk
MCP Toolbox for Databasesgoogleapis
94

MCP Toolbox for Databases is an open source MCP server that connects AI agents, IDEs and applications to enterprise databases. It provides prebuilt tools for exploring schemas and running queries, plus a framework for custom tools. It is aimed at developers building agents that need database access.

AAA Local 17k
MCP Toolbox for Databasesgoogleapis
94

Connects AI agents, IDEs and applications to enterprise databases through the Model Context Protocol. Offers prebuilt database tools for MCP clients and a framework for building custom tools for production agents.

AAA Local 17k
mongodb-mcp-servermongodb-js
94

MongoDB MCP Server lets AI assistants interact with MongoDB databases and MongoDB Atlas. It is an official server from mongodb-js, run locally with npx or Docker. It works with self-managed deployments and Atlas clusters.

AAA Local 203k/wk

Compare with Supabase, ArcadeDB MCP Server or DBHub

AgentSQL: common questions

Which databases does AgentSQL support?

The listing describes PostgreSQL and MySQL. The source says support levels vary by database version and topology and are listed in its official compatibility matrix.

Does AgentSQL require SQLBot?

No. The source says the native query agent does not depend on SQLBot, which is an optional client that can connect through a fixed-version adapter.

How do external AI agents authenticate?

They use an Agent API Key. The source states that this key is not an admin token and that each request is executed under current authorization.

How do I install AgentSQL?

In Claude Code run claude mcp add --transport http agentsql https://demo.agentsql.cn/mcp. For Claude Desktop, Cursor and VS Code, paste the config shown above and restart. See the install guides.

Is AgentSQL the official server?

AgentSQL is a community project by cuipengdba, not verified by a company domain.

Is AgentSQL free?

The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.

Is AgentSQL safe to use?

It scores 70 of 100. Grades: maintenance A, licence A, quality C. Security check: grade C (downloads a script from the internet and runs it). Review the code before you install. How grades work.

What are alternatives to AgentSQL?

Similar MCP servers: Supabase, ArcadeDB MCP Server, DBHub, MCP Toolbox for Databases.

Does AgentSQL work with ChatGPT?

Yes. Add its server URL in ChatGPT as a custom connector. See MCP in ChatGPT.

AgentSQL Install

Add to stack

Loading.