@guardbee/mcp-db-gateway
OfficialAllows querying a PostgreSQL database through the MCP gateway, with automatic PII masking, role-based table access controls, rate limiting, and audit logging.
Provides an adapter to connect the MCP server directly to an existing PrismaClient, enabling AI agents to query Prisma models through the gateway with PII masking, role-based access control, rate limiting, and audit logging.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@@guardbee/mcp-db-gateway Show me the first 10 products with prices and stock, masking any customer PII."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
@guardbee/mcp-db-gateway
KVKK / GDPR uyumlu MCP (Model Context Protocol) sunucusu — LLM ile veritabanı arasına güvenlik katmanı ekler.
Claude veya başka bir LLM, veritabanınızı doğrudan sorgulamak yerine bu gateway üzerinden geçer. Hassas alanlar otomatik olarak maskelenir, tablo erişimleri rol bazlı kontrol edilir, her sorgu audit log'a yazılır.
Claude ──► MCP Gateway ──► Veritabanı
│
├─ PII maskeleme (tcKimlik → [REDACTED])
├─ Rol kontrolü (ai-agent sadece products tablosuna erişir)
├─ Rate limiting (dakikada max 100 sorgu)
└─ Audit log (her sorgu kayıt altına alınır)Özellikler
PII Maskeleme — TC kimlik no, IBAN, e-posta, telefon, şifre hash vb. otomatik maskelenir
Rol Bazlı Erişim (RBAC) — Her rol için tablo beyaz/kara listesi ve alan kuralları
Rate Limiting — Global ve tablo bazlı istek penceresi
Audit Log — Console, dosya veya HTTP webhook'a yazılabilir
Prisma Adaptörü — Mevcut PrismaClient'ı doğrudan bağlayın
61 unit test — Masker, pipeline, RBAC, rate limiter ve Prisma adaptörü kapsanmış
Related MCP server: MCPBridge
Hızlı Başlangıç
1. Smithery ile Tek Tıkla Bağla
Smithery üzerinden Claude Desktop'a tek tıkla ekleyebilirsiniz.
2. Global Kurulum ile Claude Desktop'a Bağla
npm install -g @guardbee/mcp-db-gateway~/Library/Application Support/Claude/claude_desktop_config.json dosyasına ekleyin (macOS):
{
"mcpServers": {
"guardbee-db-gateway": {
"command": "guardbee-gateway",
"env": {
"DATABASE_URL": "postgresql://user:pass@localhost:5432/mydb"
}
}
}
}Windows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:~/.config/Claude/claude_desktop_config.json
Claude Desktop'ı yeniden başlatın. Demo veritabanı otomatik yüklenir, PII maskeleme aktif olur.
3. Projede Kullan (Prisma)
npm install @guardbee/mcp-db-gatewayimport { PrismaClient } from "@prisma/client";
import { createServer, createPrismaAdapter } from "@guardbee/mcp-db-gateway";
const prisma = new PrismaClient();
const server = createServer(
{
audit: { enabled: true, sink: "file", filePath: "./audit.jsonl" },
},
createPrismaAdapter(prisma)
);MCP Tools
Gateway aşağıdaki 4 tool'u Claude'a sunar:
Tool | Açıklama |
| Tablodan satır sorgula (PII otomatik maskelenir) |
| Erişilebilir tabloları listele (rol kısıtlamaları uygulanır) |
| Tablo şeması ve maskeleme politikasını göster |
| Aktif config, roller ve rate limit durumunu göster |
Yapılandırma
createServer({
// PII alan kuralları (ilk eşleşen uygulanır)
fieldRules: [
{ field: "tcKimlik", strategy: "redact" }, // [REDACTED]
{ field: "iban", strategy: "mask" }, // TR32***890
{ field: "email", strategy: "mask" }, // ah***@example.com
{ field: "passwordHash", strategy: "redact" },
{ field: "*Token*", strategy: "redact" }, // glob pattern
],
// Tablo erişim kuralları
tableRules: [
{ table: "audit_logs", access: "deny" },
{ table: "users", access: "allow", maxRows: 25 },
],
// Varsayılan maksimum satır
defaultMaxRows: 50,
// Rate limiting
rateLimit: {
enabled: true,
windowMs: 60_000, // 1 dakika
maxRequests: 100, // global limit
maxRequestsPerTable: 20, // tablo başına
},
// Audit log
audit: {
enabled: true,
sink: "file", // "console" | "file" | "http"
filePath: "./audit.jsonl",
// webhookUrl: "https://..." (sink: "http" için)
},
// Roller
roles: [
{
name: "ai-agent",
allowTables: ["products", "orders"], // sadece bu tablolar
maxRows: 10,
},
{
name: "analyst",
denyTables: ["audit_logs"], // bu tablo engellenir
fieldRules: [
{ field: "email", strategy: "allow" }, // e-posta maskesiz
],
},
],
// Aktif rol (GATEWAY_ROLE env var ile de ayarlanabilir)
activeRole: "ai-agent",
});Maskeleme Stratejileri
Strateji | Açıklama | Örnek |
| Alan tamamen silinir |
|
| Değerin ortası yıldızlanır |
|
| SHA-256 (ilk 16 karakter) |
|
| Olduğu gibi geçer |
|
Glob pattern desteği: *Password*, *Token*, *Secret*
Rol Bazlı Erişim (RBAC)
Rol, sunucu başlatılırken GATEWAY_ROLE env var'ı veya config.activeRole ile belirlenir.
Her Claude Desktop profili veya deployment farklı rol ile çalışabilir.
GATEWAY_ROLE=analyst node dist/cli.jsKural önceliği (yüksekten düşüğe):
Global
tableRulesdenyRol
denyTablesRol
allowTables(whitelist — ayarlanmışsa tablo bu listede olmalı)Rol
fieldRules→ globalfieldRules
Prisma Adaptörü
PrismaClient'ı doğrudan geçirin — tablo adı → model eşleştirmesi otomatik yapılır:
Sorgu tablosu | Prisma modeli |
|
|
|
|
|
|
|
|
Geliştirme
npm run dev # tsx ile geliştirme modu
npm run build # TypeScript derleme
npm test # 61 unit test
npm run test:watch # İzleme modu
npm run type-check # Sadece tip kontrolüLisans
MIT — GuardBee
Available Tools
4 toolsdescribe_tableA
Get the column names and gateway masking policy for a table — helps the LLM understand what data it can access.
Inputs: table (required).
gateway_statusA
Show the active gateway configuration: field masking rules, table policies, and audit settings.
Inputs: no named parameters.
list_tablesA
List all available database tables. Tables marked as 'deny' in gateway policy are omitted.
Inputs: no named parameters.
query_tableA
Query rows from a database table with optional filters. All results pass through the KVKK/GDPR gateway — sensitive fields are automatically masked.
Inputs: table (required), limit, filter.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool addresses a distinct concern: retrieving data, enumerating available tables, inspecting one table's schema/policy, and viewing global gateway configuration. There is no meaningful overlap that would cause an agent to select the wrong tool.
query_table, list_tables, and describe_table follow a clear verb_noun pattern and all names use snake_case. The main deviation is 'gateway_status', which is a noun phrase rather than a verb_noun action, but the inconsistency is minor and the naming remains predictable.
The four tools are well-scoped for a read-only database gateway. list_tables and describe_table provide discovery, query_table provides data access, and gateway_status provides configuration awareness, so each tool earns its place without redundancy.
For the stated domain—controlled, masked access to database tables—the surface covers discovery, schema detail, querying, and policy context with no obvious dead ends. Write operations are absent, but the tool descriptions consistently indicate this is a read/visibility gateway rather than a full CRUD server.
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Governed SQL access to your databases: redaction, query review and an audit log.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- AlicenseAqualityFmaintenanceA governed SQL gateway that exposes typed tools to AI agents, compiling safe read-only queries from a semantic layer while blocking PII before execution, supporting SQL Server, Postgres, and SQLite.9MIT
- AlicenseNot gradedqualityDmaintenanceConnects AI assistants to PostgreSQL databases with production-grade safety features including query validation, guarded writes, rate limiting, and audit logging.3MIT
- AlicenseAqualityBmaintenanceEnables AI agents to query PostgreSQL databases securely with read-only defaults, PII masking, rate limiting, and human-approved, expiring mutation tokens.91Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to query Postgres, BigQuery and DuckDB read-only through policy-checked SQL, with AST-based guards that refuse writes and dangerous functions, column masking on the way out, and an audit log of every query. Also exposes schema browsing and query-planning tools so agents can see allowed tables, columns and costs before running anything.MIT