Sponsored by Deepsite.site

Db Whisper

Created By
404-UNKNOW24 days ago
Connect your real-time database to Cursor/Claude safely.Supports PostgreSQL & SQLite, built-in SQL safety validator, local-first.
Overview

🛡️ DB-Whisper (Hardened MCP Server)

[中文] | [English]

DB-Whisper 是一个基于 Anthropic Model Context Protocol (MCP) 的生产级数据库只读访问工具。它专为 AI 助手(如 Cursor, Claude Desktop)设计,提供严苛的安全边界和深度 AST 校验,确保 AI 只能在受控环境下安全地查询并理解你的数据库。

A production-grade, AST-hardened database inspection tool based on the Model Context Protocol (MCP). Designed for AI assistants (Cursor, Claude Desktop), providing strict security boundaries to ensure AI can safely query and understand your database in a read-only, controlled environment.


🌟 核心安全性 / Core Security (Production-Ready)

  • 🛡️ 严格 AST 白名单 (Strict AST Firewall): 采用 Default Deny 策略,仅允许 20+ 种基础 SELECT 节点类型和 15 种安全聚合函数。彻底封堵 DML/DDL 及其子查询绕过。
  • ⏱️ 注入防御 (Injection Defense): 屏蔽 pg_sleep, BENCHMARK 等函数,从源头切断时间盲注 (Time-based Blind Injection) 路径。
  • 🚫 模式隔离 (Metadata Isolation): 强制拦截对 information_schema, pg_catalog, sqlite_master 等系统表的访问,防止 AI 获取敏感元数据。
  • ⚡ 稳定性加固 (Stability Hardening):
    • 强制 LIMIT 注入: 数据库层强制注入 LIMIT 101,防止大表扫描导致的内存溢出 (OOM)。
    • 硬性查询超时: 10 秒强制执行超时,保护本地 CPU。
  • 🕵️ 审计与脱敏 (Audit & Masking):
    • 错误信息脱敏,不泄露数据库结构;查询实时记录至 [AUDIT] 日志流。
    • SSL 强制传输: PostgreSQL 默认启用 SSL 加密。

🚀 快速上手 / Quick Start

1. 配置建议 / Mandatory Setup (Least Privilege)

重要安全提示:请务必为 MCP 创建专用的 只读数据库用户,仅授予必要的 SELECT 权限。 Critical: Always use a dedicated Read-Only DB User with limited SELECT permissions.

2. 在 Claude Desktop / Cursor 中集成

推荐使用 npx 快速启动,无需全局安装:

{
  "mcpServers": {
    "db-whisper": {
      "command": "npx",
      "args": ["-y", "db-whisper-mcp"],
      "env": {
        "DATABASE_URL": "替换为你的绝对路径或连接串 (REPLACE_WITH_YOUR_PATH)",
        "NODE_ENV": "production"
      }
    }
  }
}

注:SQLite 必须使用绝对路径。


🛠️ 工程化支持 / Engineering & QA

  • 自动化测试: 已通过 vitest 实现 100% 对抗性安全测试,覆盖常见的 SQL 注入与绕过场景。
  • 依赖安全: 所有关键依赖(pg, sdk, zod)已升级至最新版,修复了已知的 RCE 和数据泄露漏洞。
npm install   # 安装依赖
npm test      # 运行安全测试
npm run audit # 运行依赖安全审计

🔗 相关资源 / Resources


Note: All logs are directed to stderr; stdout is reserved strictly for MCP protocol data.

Server Config

{
  "mcpServers": {
    "db-whisper": {
      "command": "npx",
      "args": [
        "-y",
        "db-whisper-mcp"
      ],
      "env": {
        "DATABASE_URL": "postgresql://username:password@host:port/database",
        "NODE_ENV": "production"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Tavily Mcp
CursorThe AI Code Editor
Amap Maps高德地图官方 MCP Server
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
WindsurfThe new purpose-built IDE to harness magic
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Serper MCP ServerA Serper MCP Server
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"