[n8n template] Conversational PostgreSQL Agent with Visuals, Multi-KPI, and Data Editing (MCP)
📊 Conversational PostgreSQL Agent with Visuals, Multi-KPI, and Data Editing (MCP-Powered)
Build your own AI-powered PostgreSQL analyst that supports:
• Multi-KPI questions in natural language
• Auto-generated charts using QuickChart (bar, pie, line)
• Insert and update capabilities via chat
• Clean, readable output — ready for dashboards, Slack, or Notion
No dashboards to build. No code to write. One prompt = full analysis.
—
WHAT THIS TEMPLATE DOES
This agent listens to natural queries like:
"Show me top products, revenue trend, and customer segments."
Then it responds with:
✔️ SQL queries generated securely
✔️ Clean written summaries
✔️ QuickChart-hosted charts
✔️ Optional: insert/update rows in your database
All driven by Claude 3.5 Haiku (MCP agent) and DeepSeek (low-cost SQL/chart logic).
💡 Average cost per full run: ~$0.02
—
WHAT YOU GET
• Full n8n workflow (.json) for the visual-capable MCP agent
• 2 subflows: SQL generation + QuickChart generator
• Secure tool-based design (no raw SQL, no code injection)
• Example-tested prompts and clean markdown outputs
• Ready to plug into any UI, chatbot, or reporting app
—
EXAMPLE USE CASE
—
END-USER SETUP GUIDE
🧩 1. Import the following into your n8n:
- Build_your_own_PostgreSQL_MCP_server__visuals_capable_.json
- checkdatabase.json
- Plot_tool.json
🧠 2. Set up your PostgreSQL credentials:
- Match the name used in the workflow (e.g., “Postgres account 3”)
⚙️ 3. Set up your models:
- Claude 3.5 Haiku (MCP agent)
- DeepSeek (for SQL + chart generation)
🌐 4. Use the MCP webhook URL from the trigger node:
- Plug it into any chat interface, HTTP request, or chatbot
🧪 5. Try a test query:
"Show me revenue by month and a pie chart of customer segments."
You’ll receive:
- 2 charts
- Multiple KPIs
- Markdown summary
✔️ You can increase MaxIterations (default: 30) for deeper planning
✔️ Insert/Update nodes are included and enabled
✔️ Output is safe, clean, and UI-ready
—
SECURITY & PERFORMANCE
• No raw SQL from user input
• All tool actions use schema validation
• Outputs are QuickChart links + plain markdown text
• Works with Claude, DeepSeek, or OpenAI models
—
OTHER TEMPLATES YOU’LL LOVE
🔹 Multi-KPI Agent (No Charts):
🔹 Conversing with Data (Single KPI + Visuals):
🔹 Customer Feedback Analyzer (Charts + HTML Report Generator):