// INTEGRATION_GUIDE
Secure PostgreSQL MCP Server — RBAC & Query Filtering
Secure your PostgreSQL MCP server with fine-grained RBAC, read-only table filtering, SQL injection blocking, and immutable compliance audit logs.
1Initialize standard PostgreSQL MCP Server
Ensure your standard Postgres database connector is running locally or as a cloud process. Standard startup config looks like:
2Register Server inside MakeYourMCP Console
Log in to the MakeYourMCP Dashboard, navigate to the MCP Servers panel, and register a new server:
- Server Name:
postgres-production-db - Server URL: Point to your internal container FQDN address.
3Define Policy Rules
Navigate to Policies and create an access control rule set. Policies allow or deny MCP tool calls by tool name using glob patterns (fnmatch). Below is an example policy restricting access for the finance_agent:
This policy blocks destructive operations (delete_*, write_*) while allowing read-only queries. Deny rules always take precedence over allow rules.
4Invoke Tools Through the Gateway
When your agent needs to call a PostgreSQL tool, send a JSON-RPC request to the gateway endpoint with the X-API-Key header. All tool calls are validated against your policy before execution:
Replace https://gateway.makeyourmcp.com with your gateway URL. The gateway applies your policy, validates the tool call, and returns the result.
Secured Capabilities
- Auto-intercepts destructive database writes.
- Discards SQL commands embedded in query arguments.
- Emits immutable compliance logs to the audit server database.