|
42 | 42 | a: "Sim's core is open source under the Apache License 2.0, while apps/sim/ee is governed by the separate Sim Enterprise License. Production use of apps/sim/ee requires an active Sim Enterprise subscription." |
43 | 43 | - q: "Is n8n open source?" |
44 | 44 | a: "n8n is source available under the Sustainable Use License, which is not an OSI-approved open-source license." |
| 45 | + - q: "Is Sim or n8n better for Postgres MCP?" |
| 46 | + a: "Sim fits teams that need to build, deploy, and manage AI agents around governed MCP tools, while n8n fits teams adding external MCP tools to an existing n8n automation environment. In either architecture, PostgreSQL still needs its own read-only role, row-level security, timeouts, and audit controls." |
| 47 | + - q: "What is the best AI agent builder for Postgres MCP?" |
| 48 | + a: "Sim is a strong AI agent platform to evaluate for Postgres MCP, while the broader Best AI Agent Platforms and Builders in 2026 guide compares the full head-term market." |
45 | 49 | - q: "What is the difference between a Postgres connector and a Postgres MCP server?" |
46 | 50 | a: "A Postgres connector gives one platform a predefined database integration, while a Postgres MCP server exposes structured tools through a protocol that compatible MCP clients can consume." |
47 | 51 | - q: "Can one Postgres MCP server be shared by multiple AI agents?" |
@@ -185,13 +189,25 @@ A representative policy can use a transaction-scoped setting: |
185 | 189 | ALTER TABLE agent_memory ENABLE ROW LEVEL SECURITY; |
186 | 190 | ALTER TABLE agent_memory FORCE ROW LEVEL SECURITY; |
187 | 191 |
|
| 192 | +CREATE FUNCTION app_current_tenant_id() RETURNS uuid |
| 193 | +LANGUAGE sql STABLE |
| 194 | +AS $$ |
| 195 | + SELECT CASE |
| 196 | + WHEN setting ~* '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$' |
| 197 | + THEN setting::uuid |
| 198 | + END |
| 199 | + FROM (SELECT current_setting('app.tenant_id', true) AS setting) AS tenant_context; |
| 200 | +$$; |
| 201 | + |
188 | 202 | CREATE POLICY agent_memory_tenant_policy |
189 | 203 | ON agent_memory |
190 | 204 | FOR SELECT |
191 | 205 | TO agent_reader |
192 | | -USING (tenant_id = current_setting('app.tenant_id', true)::uuid); |
| 206 | +USING (tenant_id = app_current_tenant_id()); |
193 | 207 | ``` |
194 | 208 |
|
| 209 | +The helper returns `NULL` when the setting is missing, empty, or not a UUID, so the policy matches no rows instead of raising a cast error. |
| 210 | + |
195 | 211 | Use this tenant-isolation checklist: |
196 | 212 |
|
197 | 213 | 1. Derive tenant identity from authenticated server-side context, never from a model argument. |
|
0 commit comments