mcp-db-adapter
Security-first MCP adapter: auto-discovers DB connections in any JS/Python/SQL project, spins up a local read-only gateway (safe_execute, schema_validation), and feeds AI coding tools (Cursor, Windsurf, Void, Continue) with safe, schema-aware database insights.
GitHubスター
1
ユーザー評価
未評価
お気に入り
0
閲覧数
8
フォーク
0
イシュー
0
Security-First MCP Database Adapter
A lightweight, open-source connector stub written in TypeScript that leverages AI to auto-discover database connections in any JavaScript, Python, or SQL project and spins up a local MCP gateway. Expose two core tools—safe_execute and schema_validation—feeding AI coding assistants (Cursor, Windsurf, Void, Continue) with real-time, schema-aware database insights.
📖 Overview
This adapter integrates seamlessly into your existing Model Context Protocol setup via the mcp.json
configuration. It:
AI-Driven Discovery: Uses your AI assistant to locate connection strings or config objects in code and environment files.
Reachability Check: Verifies the database endpoint is online (via a lightweight driver handshake).
Local MCP Gateway: Starts on
localhost:<port>
, proxying read-only operations.Core Tools:
- safe_execute: Runs SQL in a rolled-back transaction context, returning sample rows, errors, and EXPLAIN plans.
- schema_validation: Fetches live schema metadata (tables, columns, types, constraints, indexes).
These tools enable your AI workflows to generate, validate, and optimize database code against your actual environment, without risking unintended writes.
🔧 Installation & Usage
You don’t need to permanently add this adapter as a dependency. You can invoke it via NPX or Docker, just like other MCP servers:
NPX (Recommended)
Add the adapter to your mcp.json
under mcpServers
, supplying your database URL directly as an argument:
{
"mcpServers": {
"mcp-db-adapter": {
"command": "npx",
"args": [
"-y",
"mcp-db-adapter",
"--port 6000"
]
}
}
}
To launch, use your IDE or CLI that reads from mcp.json
(e.g., VS Code MCP extension). Alternatively, run directly:
npx -y mcp-db-adapter --port 6000
This will start the local MCP gateway on port 6000
, auto-discover your connection via AI-driven parsing, verify reachability, and register safe_execute
& schema_validation
.
📄 License
Licensed under Apache 2.0. See LICENSE for details.