PostgreSQL MCP Full Access
Enables unrestricted SQL execution (DDL/DML) on PostgreSQL databases, allowing AI agents to create, read, update, and delete data with zero query filtering.
README
PostgreSQL MCP Full Access
A pure, full-access PostgreSQL MCP server for AI agents. Enables unrestricted SQL execution (DDL/DML) with zero database bundling.
This project embraces a "pure middleware" philosophy, stripping away restrictive database environment setups and hardcoded query filtering. It does exactly one thing: unconditionally accepts and executes any SQL command from your Agent (including CREATE, INSERT, UPDATE, DELETE, and DROP), and returns the result.
All connection methods, network architectures, and security constraints are entirely left to the user and the native PostgreSQL Role-Level Security (RLS) to manage.
✨ Key Features
- Network-First Microservice: Runs securely as an HTTP/SSE service within a closed Docker network, acting as a bridge between your AI Agent and Database without requiring risky host-level Docker socket mounts.
- Always Latest: No locked-in versions. Every build automatically pulls the latest Node.js, MCP SDK, and
pgdrivers, eliminating maintenance overhead. - Unrestricted Access: Breaking free from the typical read-only sandbox. Your AI can autonomously create databases, define tables, and perform vector searches (e.g.,
pgvector). - Dynamic Database Switching: Built-in support for switching databases mid-session—allowing the AI to create a new database and immediately connect to it to execute further commands.
- Clean Deployment: Easily configurable via
docker-composeto run continuously in the background alongside your Agent.
🚀 Quick Start (Docker Network Mode)
1. Clone the repository
git clone https://github.com/BrassaiKao/postgresql-mcp-full-access.git
cd postgresql-mcp-full-access
2. Configure your Database URL
Edit the docker-compose.yml file to include your target database connection string in the environment variables:
environment:
- DATABASE_URL=postgresql://agent_user:password@your_db_host:5432/postgres
- PORT=7432
3. Build and Start the Service No local Node.js installation is required. Just run:
docker compose up -d --build
(This automatically pulls the latest dependencies and starts the MCP server in the background as a continuous service, listening on port 8000 within the Docker network.)
💡 Note on Docker Networking: By default,
docker-compose.ymlusesexpose: "8000"to isolate traffic within the Docker network (hermes_net) for security. Docker Desktop will not show a published port mapping on your host OS.If you need to access the SSE endpoint from your host machine (e.g., for local testing or Desktop apps), change
expose:toports:indocker-compose.yml:ports: - "7432:7432"
⚙️ Usage with AI Agents
To use PostgreSQL MCP Full Access with an MCP-compatible agent (like Hermes Agent), you no longer need complex Docker subprocess commands. Just point your agent to the SSE endpoint in your agent's configuration file (e.g., ~/.hermes/config.yaml):
mcp_servers:
postgres_middleware:
url: "http://hermes_postgres_mcp:7432/sse"
(Ensure your Agent's container is on the same Docker network as this MCP service).
🛡️ Security Best Practices (Crucial)
1. Database Layer Isolation
Because PostgreSQL MCP Full Access allows all SQL syntax, DO NOT give the AI your postgres (Superuser) credentials.
Instead, create a dedicated Role in your PostgreSQL database. Use GRANT and REVOKE to precisely control which tables the Agent can read or write. By delegating security to the database layer, even if a Prompt Injection occurs, malicious commands will be natively blocked by PostgreSQL with a Permission denied error!
2. Network Layer Isolation
Never expose the MCP server's port (7432) directly to the public internet or the host machine using -p 7432:7432 unless necessary. Rely on internal Docker networking to ensure only your AI Agent container can communicate with the MCP server.
🔍 Troubleshooting
1. Docker Permission Denied Error
If you encounter permission denied while trying to connect to the docker API at unix:///var/run/docker.sock during docker compose, your non-root user lacks access to the Docker daemon.
Fix this by adding your current user to the docker group:
sudo usermod -aG docker $USER
newgrp docker
If you previously ran commands with sudo, take back ownership of your project directory:
sudo chown -R $USER:$USER .
2. Verify Container Logs
Check container logs to verify the server started correctly:
docker logs hermes_postgresql_mcp
Expected output:
🚀 Network MCP Server running! Agent can connect to http://localhost:7432/sse
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。