Skip to main content
Glama
GuardBee

@guardbee/mcp-db-gateway

Official
by GuardBee

@guardbee/mcp-db-gateway

npm version npm downloads License: MIT Smithery

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: mcp-db-server

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.json Linux: ~/.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-gateway
import { 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

query_table

Tablodan satır sorgula (PII otomatik maskelenir)

list_tables

Erişilebilir tabloları listele (rol kısıtlamaları uygulanır)

describe_table

Tablo şeması ve maskeleme politikasını göster

gateway_status

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

redact

Alan tamamen silinir

[REDACTED]

mask

Değerin ortası yıldızlanır

ah***@example.com / 530***67

hash

SHA-256 (ilk 16 karakter)

a665a45920422f9d

allow

Olduğu gibi geçer

ahmet@example.com

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.js

Kural önceliği (yüksekten düşüğe):

  1. Global tableRules deny

  2. Rol denyTables

  3. Rol allowTables (whitelist — ayarlanmışsa tablo bu listede olmalı)

  4. Rol fieldRules → global fieldRules


Prisma Adaptörü

PrismaClient'ı doğrudan geçirin — tablo adı → model eşleştirmesi otomatik yapılır:

Sorgu tablosu

Prisma modeli

"users"

prisma.user

"audit_logs"

prisma.auditLog

"orders"

prisma.order

"orderItems"

prisma.orderItem


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 tools
describe_tableA

Get the column names and gateway masking policy for a table — helps the LLM understand what data it can access.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYesTable name

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral disclosure burden. 'Get' strongly implies a read-only metadata operation, and 'gateway masking policy' clarifies the nature of the returned information. However, it does not disclose permission behavior, error cases, or any side effects, leaving some ambiguity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the action and resource, then adds the purpose. Every word contributes meaning, with no fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter metadata tool with no output schema, the description adequately conveys what is returned (column names and gateway masking policy) and why it is useful. It could be more complete by explicitly addressing permissions or differentiating from siblings, but those are minor gaps given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents the single 'table' parameter as 'Table name'. The description adds little beyond restating that the operation is for a table, so it does not significantly improve parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Get') and clearly identifies the resource: column names and gateway masking policy for a table. It also states the intended purpose—helping the LLM understand data access—which distinguishes it from siblings like query_table and list_tables.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context for when to use the tool: when the LLM needs to understand what data it can access, including column names and masking policy. It does not explicitly name alternatives or state when not to use it, but the intended use case is evident.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

gateway_statusA

Show the active gateway configuration: field masking rules, table policies, and audit settings.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the behavioral burden. 'Show' clearly indicates a read-only operation, and the description discloses what content will be displayed. It does not mention authentication or output format, but those are less critical for a zero-parameter status read.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, well-front-loaded sentence that contains no filler. Every phrase adds informational value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter status tool, the description adequately covers purpose and content. It could mention whether the output is formatted as a summary or detailed report, but the core usage context is clear given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so parameter-level semantics are not needed. The description meaningfully explains what the tool reports, making the lack of parameters a non-issue.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific verb ('Show') and resource ('active gateway configuration'), and lists concrete contents (field masking rules, table policies, audit settings). It clearly stands apart from the table-oriented sibling tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies this tool is for inspecting gateway configuration rather than querying or describing tables, but it does not explicitly state when to choose this tool over siblings or mention any exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_tablesA

List all available database tables. Tables marked as 'deny' in gateway policy are omitted.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full behavioral disclosure burden. It does disclose an important behavioral trait—deny-marked tables are omitted from results—and 'List' implies a read-only operation. It stops short of detailing return format or permissions, but for a simple listing tool this is solid.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences that are front-loaded and contain zero filler. The main action is stated first, followed by a single relevant policy caveat.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter list tool with a simple purpose, the description is nearly complete: it states what is listed and the visibility rule. The only minor omission is an explicit statement of the return shape, though 'List' strongly implies a list of table names.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters and 100% schema-description coverage by default, so there is no parameter burden for the description to carry. Baseline 4 is appropriate for a no-parameter tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the verb 'List' and the resource 'available database tables', and adds a precise policy restriction: tables marked 'deny' are omitted. This makes it easily distinguishable from query_table, describe_table, and gateway_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The tool's intended use is implied: call it when you need an inventory of accessible database tables. However, it does not explicitly contrast with siblings like describe_table or query_table, nor does it state when this tool should not be used.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

query_tableA

Query rows from a database table with optional filters. All results pass through the KVKK/GDPR gateway — sensitive fields are automatically masked.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoMax rows to fetch before gateway limit is applied (default 50)
tableYesTable name to query
filterNoKey-value filter pairs, e.g. { status: 'active' }

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full behavioral burden. It usefully discloses one significant trait: all results pass through the KVKK/GDPR gateway with sensitive fields auto-masked. However, it omits other relevant behaviors such as the read-only nature of the query, permission requirements, error handling, or what happens to results when the gateway limit is reached.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two short sentences: the first states the core purpose and the second adds the essential gateway behavior. Purpose is front-loaded, with no filler or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The definition is adequate for basic invocation: required table parameter, optional filter, and limit are documented, and the masking behavior is disclosed. But there is no output schema, and the description does not explain the return shape of rows or how the gateway limit affects result truncation, leaving moderate gaps for a tool with no annotation safety net.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so parameters are already documented: table, filter, and limit. The main description adds little beyond the schema; it echoes 'optional filters' and provides gateway-related context, but no new per-parameter meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the operation ('Query rows') and resource ('from a database table'), with optional filters. This verb- and resource-level detail unambiguously separates it from siblings like list_tables, describe_table, and gateway_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies use for row retrieval but provides no explicit guidance on when to use it versus the listed siblings, and no exclusions or alternative conditions. There is no mention of when not to use query_table, leaving the agent to infer the boundary from the sibling names.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv0.1.1
    • First observeddescribe_table
    • First observedgateway_status
    • First observedlist_tables
    • First observedquery_table

TDQS

A4.1/5.0

Scored across 4 tools

Disambiguation5/5

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.

Naming Consistency4/5

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.

Tool Count5/5

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.

Completeness5/5

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

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    F
    maintenance
    A 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.
    9
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables LLM clients to query SQL databases via natural language with read-only, AST-validated, and capped queries, ensuring safety guarantees.
    2
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Connects AI assistants to PostgreSQL databases with production-grade safety features including query validation, guarded writes, rate limiting, and audit logging.
    3
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    Enables natural language querying of SQL databases with robust safety guarantees including read-only enforcement, AST validation, and row caps.
    -