loading…
Search for a command to run...
loading…
A secure Model Context Protocol implementation that enables AI agents to query PostgreSQL databases through predefined tools for employee, project, and issue da
A secure Model Context Protocol implementation that enables AI agents to query PostgreSQL databases through predefined tools for employee, project, and issue data. It protects sensitive credentials and prevents arbitrary SQL execution by acting as a controlled connector layer between the LLM and the database.
This project demonstrates a secure, production-ready implementation of the Model Context Protocol (MCP) as a connector layer between AI agents and PostgreSQL databases. The solution enables natural language queries without exposing database credentials to the LLM.
Key Achievement: LLM cannot access database directly - only through predefined MCP tools.
┌────────────────────────────────────────────────────────┐
│ USER QUERY │
│ "Fetch employees in AI department" │
└───────────────────┬────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ PLANNER AGENT (LLM) │
│ ✓ Natural Language Understanding │
│ ✗ NO database credentials │
│ Output: {"tool": "get_employees_by_department", │
│ "parameters": {"department": "AI"}} │
└───────────────────┬────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ EXECUTOR AGENT │
│ ✓ Validates tool request │
│ ✓ Maps to allowed operations only │
│ ✗ Cannot execute arbitrary SQL │
└───────────────────┬────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ MCP TOOLS LAYER (Sandbox) │
│ ✓ get_employees_by_department("AI") │
│ ✓ get_projects_by_status("Completed") │
│ ✓ get_issues_by_priority("High") │
│ ✗ Cannot run arbitrary SQL │
└───────────────────┬────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ DATABASE CONNECTION (Secure) │
│ ✓ Credentials in environment variables │
│ ✓ Only parameterized queries (SQL injection safe) │
└───────────────────┬────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────┐
│ RESULT TO USER │
│ [Secure data retrieval via MCP] │
└────────────────────────────────────────────────────────┘
| Feature | With MCP |
|---|---|
| DB Credentials | Secure in .env ✅ |
| SQL Access | Predefined tools only ✅ |
| Attack Surface | Limited operations only ✅ |
| Audit Trail | Full logging ✅ |
| Connection Pool | Yes ✅ |
app/agents/: The brain (Planner, Executor, Orchestrator)app/mcp/: The tool layer (Connector to DB)app/database/: Low-level DB connection poolapp/api/: FastAPI routesCopy the example config:
cp .env.example .env
The easiest way to stand it up (Postgres + API):
docker-compose up --build
The API listens on http://localhost:8000.
You can use the swagger UI at /docs or curl:
curl -X POST "http://localhost:8000/api/v1/query" \
-H "Content-Type: application/json" \
-d '{"query": "Find all projects that are in progress"}'
If you have Python 3.11+ and a local Postgres running:
pip install -r requirements.txt.env with your DB credentialspython -m app.mainRun in your terminal:
claude mcp add mcp-dummy-db-integration -- npx Yes, Dummy DB Integration MCP is free — one-click install via Unyly at no cost.
No, Dummy DB Integration runs without API keys or environment variables.
A hosted option is available: Unyly runs the server in the cloud, no local setup required.
Open Dummy DB Integration on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Query your database in natural language
by AnthropicA universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devThis server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashRead-only database access with schema inspection.
by modelcontextprotocolNot sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs