MCP Dummy DB Integration
Enables AI agents to query a PostgreSQL database through a secure layer of predefined tools, allowing for the retrieval of employee information, project statuses, and issue priorities without exposing database credentials or allowing direct SQL execution.
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., "@MCP Dummy DB Integrationlist all employees in the AI department"
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.
MCP Agent POC
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.
šļø Architecture Overview
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā 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] ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāRelated MCP server: PostgreSQL MCP Server
š Security Features
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 ā |
Project Structure
app/agents/: The brain (Planner, Executor, Orchestrator)app/mcp/: The tool layer (Connector to DB)app/database/: Low-level DB connection poolapp/api/: FastAPI routes
Getting Started
1. Setup Env
Copy the example config:
cp .env.example .env2. Run with Docker
The easiest way to stand it up (Postgres + API):
docker-compose up --buildThe API listens on http://localhost:8000.
3. Test It
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"}'Local Dev (No Docker)
If you have Python 3.11+ and a local Postgres running:
pip install -r requirements.txtUpdate
.envwith your DB credentialspython -m app.main
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
- dataOAuthco.thinair
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Deterministic safety, correctness & cost gate that vets Postgres SQL before your AI agent runs it.
Query PostgreSQL databases in plain English ā LLM-generated, safety-validated SQL.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides AI assistants with secure, read-only access to PostgreSQL databases while offering comprehensive tools for schema exploration, query validation, and performance optimization.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.93,517 npmMIT
- AlicenseBqualityDmaintenanceA TypeScript-based Model Context Protocol server that enables AI assistants to perform secure database operations on PostgreSQL databases through structured tool interfaces.85 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query, explore, and analyze PostgreSQL databases through the Model Context Protocol. It provides robust security features including read-only mode, schema restrictions, and query timeouts for safe data interaction.7 npmMIT