Skip to main content
Glama

MCP Data Bridge ⚔

CI Test Suite License: MIT Python: 3.10+ Model Context Protocol

Secure Model Context Protocol (MCP) Database Gateway for Autonomous AI Agents with built-in runtime query guardrails, schema discovery, and interactive developer playground.


šŸŽÆ What is MCP Data Bridge?

Autonomous AI agents (such as Claude, Gemini, OpenAI Assistants, or LangGraph workflows) frequently require direct access to operational databases. However, granting LLMs direct connection credentials presents catastrophic security risks:

  • Prompt Injection Attacks: An adversary can trick an agent into executing DROP TABLE or mutating financial data.

  • Token Bloat: Large unstructured table dumps blow the model's context window.

  • Schema Hallucinations: Agents guessing table or column names without structured discovery.

MCP Data Bridge solves this by acting as a hardened intermediary layer following Anthropic's open Model Context Protocol (MCP) specification.

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│       Autonomous AI Agents & Clients         │
│   (Claude Desktop, Cursor, Custom Agents)    │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                       │ JSON-RPC 2.0 (STDIO / REST)
                       ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                   MCP DATA BRIDGE                      │
│                                                        │
│  šŸ”§ Tool: list_tables()                                │
│     └─ Discovers active database tables                │
│                                                        │
│  šŸ”§ Tool: describe_table(table_name)                   │
│     └─ Schema inspection & PRAGMA regex sanitization   │
│                                                        │
│  šŸ”§ Tool: execute_query(sql)                           │
│     ā”œā”€ Pydantic input validation                       │
│     ā”œā”€ Strict Read-Only Guardrail (SELECT only)        │
│     ā”œā”€ Prohibited Keyword Interceptor (DROP/DELETE...) │
│     └─ Hard result limit clamping (Max 100 rows)       │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
                       │ Parameterized Safe Query
                       ā–¼
ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│             Enterprise Database              │
│       (SQLite, PostgreSQL, AWS RDS)          │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

Related MCP server: sql-guard-mcp

✨ Features

  • Standard MCP Compliant: Implements the official Model Context Protocol JSON-RPC specification. Compatible out of the box with Claude Desktop, Cursor, and custom agents.

  • Strict Read-Only Guardrails: Regex-powered gatekeeper blocks any mutation keywords (INSERT, UPDATE, DELETE, DROP, ALTER, TRUNCATE, EXEC).

  • Interactive Web Playground: Includes a dark-mode visual explorer to inspect schemas and test query safety in real-time.

  • Autonomous Agent Simulator: Pre-built script demonstrating an end-to-end multi-turn agent reasoning loop with prompt-injection interception.

  • Zero-Config Seed Database: Includes automated enterprise database generator (customers, products, orders).

  • Production Ready: Fully dockerized with unit test suite running on GitHub Actions.


šŸš€ Quickstart

1. Installation

git clone https://github.com/NithinPathikonda/mcp-data-bridge.git
cd mcp-data-bridge

# Install minimal dependencies
pip install -r requirements.txt

2. Run Autonomous Agent Simulation

Watch an AI agent explore the database, run multi-table analytics, and attempt a simulated prompt-injection attack that gets blocked:

python agent_demo.py

3. Launch Interactive Web Playground

Explore the database visually and test guardrails directly at http://localhost:8500:

python web_ui.py

4. Run Unit Test Suite

python test_server.py

šŸ¤– Claude Desktop & Cursor Integration

To expose this database directly to Claude Desktop, add this server to your claude_desktop_config.json:

{
  "mcpServers": {
    "enterprise-data-bridge": {
      "command": "python",
      "args": [
        "/ABSOLUTE/PATH/TO/mcp-data-bridge/server.py",
        "--stdio"
      ]
    }
  }
}

Now, ask Claude: "What tables do I have in the database?" or "Who are my top 3 customers by revenue?", and Claude will automatically call your tools!


🐳 Docker Deployment

Run the complete containerized stack:

docker compose up --build

The web playground will be available at http://localhost:8500.


šŸ’¼ System Design & Interview Talking Points

If asked about this project during a technical or system design interview:

"At HPE and in my independent work, I recognized that giving autonomous LLMs unrestricted database access is an anti-pattern. I designed mcp-data-bridge using the Model Context Protocol to serve as an air-gapped proxy. It provides structured schema discovery (list_tables, describe_table) and read-only query execution (execute_query). It implements Pydantic runtime validation, sanitized table regexes, and a zero-trust guardrail that drops any destructive mutations or prompt-injected SQL before reaching the database engine."


šŸ“„ License

Distributed under the MIT License. Copyright Ā© 2026 Nithin Pathikonda.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to query SQL databases safely with read-only access, allowing schema discovery and SELECT queries while blocking writes and DDL operations.
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to safely query and explore SQLite databases through read-only, guard-protected tools that block writes, sensitive table access, and runaway queries.
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to safely query SQL databases through read-only tools for describing entities, reading records, and aggregating records, with view-based access and fail-closed per-user row-level security.
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables 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