Skip to content
FlowHubFluxonLab
Call n8n Workflow Tool
AI Automationfree

Build your own PostgreSQL MCP server

by Jimleukadapted from n8n official workflow galleryUpdated Aug 2026
RequiresCall n8n Workflow ToolCall n8n Workflow ToolPostgresPostgres
Share Post Share
PTGetTableSchemaPTListTablesEWWhen Executed by Another WorkflowWhen Executed b…TWCreateTableRecordsCreateTableReco…ReadTableRecordSwOperationUpdateTableRecordUpdateTableReco…TWUpdateTableRecordsUpdateTableReco…CreateTableRecordCreateTableReco…TWReadTableRowsMcPostgreSQL MCP ServerPostgreSQL MCP …12345
1/5
FLOWS
STEPS · 5
Starts on a Mcp event

This n8n demonstrates how to build a simple PostgreSQL MCP server to manage your PostgreSQL database such as HR, Payroll, Sale, Inventory and More! This MCP example is based off an official MCP reference implementation which can be found here -https://github.com/modelcontextprotocol/servers/tree/main/src/postgres How it works A MCP server trigger is used and connected to 5 tools: 2 postgreSQL and 3 custom workflow. The 2 postgreSQL tools are simple read-only queries and as such, the postgreSQL tool can be simply used. The 3 custom workflow tools are used for select, insert and update queries as these are operations which require a bit more discretion. Whilst it may be easier to allow the agent to use raw SQL queries, we may find it a little safer to just allow for the parameters instead. The custom workflow tool allows us to define this restricted schema for tool input which we'll use to construct the SQL statement ourselves. All 3 custom workflow tools trigger the same "Execute workflow" trigger in this very template which has a switch to route the operation to the correct handler. Finally, we use our standard PostgreSQL node to handle select, insert and update operations.

Tags

n8nreference-onlypostgrestool-workflow
Connects
calln8nworkflowtoolCall n8n Workflow ToolpostgresPostgres
CategoryAI Automation
Triggermanual
Complexitycomplex
Nodes11
AddedApr 21, 2025

Related workflows

See all AI Automation
DhtmlWopenaichatmodel
free

Scrape and summarize webpages with AI

This workflow integrates both web scraping and NLP functionalities. It uses HTML parsing to extract links, HTTP requests to fetch essay content, and AI-based summarization using GPT-4o. It's an excellent example of an end-to-end automated task that is not only efficient but also provides real value by summarizing valuable content. Note that to use this template, you need to be on n8n version 1.50.0 or later.

by n8n Team
ACDgmail
free

AI: Summarize podcast episode and enhance using Wikipedia

The workflow automates the process of creating a summarized and enriched podcast digest, which is then sent via email. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by n8n Team
binaryinputloaderembeddingsopenaigoogledriveopenaichatmodel
free

Ask questions about a PDF using AI

The workflow first populates a Pinecone index with vectors from a Bitcoin whitepaper. Then, it waits for a manual chat message. When received, the chat message is turned into a vector and compared to the vectors in Pinecone. The most similar vectors are retrieved and passed to OpenAI for generating a chat response. Note that to use this template, you need to be on n8n version 1.19.4 or later.

by David Roberts