
AgentSQL
io.github.cuipengdbaPublished by GitHub account cuipengdbav0.4.0Updated Oct 24, 2026
Guard AI agents' PostgreSQL/MySQL access via MCP: SQL audit, auth, masking, write approval
Overview
AgentSQL is a database security gateway MCP server that lets an AI assistant run authorized, audited, masked SQL queries against PostgreSQL/MySQL data sources.
- What you can do
- Query bound PostgreSQL/MySQL data sources through controlled SQL execution under the current identity and permissions
- Review generated SQL, results and audit records for natural-language data questions
- Rely on result masking, write approval and persistent audit logging around agent access
- Re-check authorization on history reopening and CSV/XLSX export, refusing stale content after permission changes
- Use it as a standalone MCP gateway alongside AgentSQL's own web question-answering page, sharing identity and audit
- When to use it
- Use it when you want an external AI agent to query business databases without giving it raw credentials, and need per-request authorization, masking and an audit trail. Also suitable when employees ask data questions in natural language and agents query the same sources under separate grants.
- Requirements
- Remote Streamable HTTP endpoint; the public demo at demo.agentsql.cn requires a bearer token in the Authorization header. The demo key is read-only and uses synthetic data that resets daily. Production use means self-hosting via Docker or the native package, with a generated administrator password and a configured data source binding.
Installation
In SourceWeft
- Open AgentSQL in the dashboard and add it to a workspace.
- Connect Authorization token credentials. They are stored privately and never shown on public pages.
- Enable the server for the chats that should use its tools.
Web executable via Streamable HTTP. Remote servers run from the web runtime once configured in a workspace.
Use with an agent
Paste this prompt into Claude Code, Codex, Cursor or another agent — or into SourceWeft chat. The agent reads this server's install guide, shows you its publisher, endpoint and sign-in, and adds it to your client once you agree. Keys never go into a command.
Read https://sourceweft.com/mcp/io.github.cuipengdba%2Fagentsql/install.md and connect the MCP server it describes to my client. Before changing any config, show me its publisher, endpoint and sign-in method and wait for my OK. Never put an API key in a command or in a file I would commit; ask me where it should come from.Other MCP clients
Add this to your client's mcpServers config.
{
"mcpServers": {
"agentsql": {
"type": "http",
"url": "https://demo.agentsql.cn/mcp",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
}
}
}
}README
AgentSQL(智盾)
[AgentSQL][Version v4.12.0] [Go] [License: Apache-2.0]
AgentSQL = 独立 AI 问数 Agent + MCP Server 数据库安全网关。 用户可直接在 AgentSQL 自有页面用自然语言问数;其他 AI Agent 可把 AgentSQL 当作独立 MCP Server 使用。两条入口共用当前身份与授权、受控 SQL 执行、结果脱敏和持久审计。AgentSQL 自有问数不依赖 SQLBot;SQLBot 是可经固定版本适配器接入的可选客户端。
官网 · 中文问数界面与功能示意 · v4.12.0 下载与发布边界 · 三种使用方式 · 文档索引
选一种使用方式
v4.12.0 能力与边界
自然语言结果需要核对生成的 SQL 和业务含义。v4.12.0 未在用户真实业务系统验证,不宣称 100% 兼容或零改动切换;正式发布说明给出精确提交、验收场景、性能数字与限制。固定 25 场景评分合同严格通过 6/25(24%),本版逐项验收列明证据与未测项,未完成合同的场景计零;这不等于 AgentSQL 独立 MCP 安全网关的能力覆盖率。公网 Demo 的问数模型仅作模拟展示。
快速开始
Linux amd64 / arm64 原生包要求 glibc ≥ 2.28 和 PID 1 的 systemd。下载正式包后先按发布说明核对签名和哈希。以下命令安装网关;自有问数需要按三种使用方式安装问数组件并配置本地文本模型与个人数据源绑定。
Docker 使用多架构正式镜像;一键脚本仅绑定本机回环地址并创建持久卷:
网关控制台默认 http://127.0.0.1:7780,安装了问数组件后自有页面默认 http://127.0.0.1:8000。安装器生成持久管理员密码;非交互日志不输出,可由 root 在 /etc/agentsql/agentsql.env 查看。远程访问应使用 SSH 本地转发或受控 HTTPS 反向代理,不直接暴露管理端口。离线安装、密钥、备份和升级步骤见部署指南。
按任务查文档
数据库“已注册”“连接级”“指定版本受控只读”“指定场景完整防护”是不同等级。官网矩阵保留逐库版本、拓扑与验收边界;连接成功不等于可安全问数,也不等于厂商认证。
社区与项目
历史 Release · CHANGELOG · 路线图 · Issues · Discussions · 贡献指南
当前源码按 Apache-2.0 发布,并附 NOTICE;AgentSQL 名称和标识的商标权不由该许可证授予。未修复漏洞请按 SECURITY.md 私下报告,不在公开 Issue 中提交真实凭据或连接串。
Source: README.md at commit bd11b0b
Tools
0Version history
1- v0.4.0LatestSep 30, 2026
Score
85% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 daysRequired25 pts
- Auth declaredRequired10 pts
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts