Secure RDS Read-Only MCP Server
Provides read-only access to a PostgreSQL database with SQL guardrails, row-level security, and masked views to protect sensitive data.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Secure RDS Read-Only MCP ServerShow me the first 10 rows of the patients table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
secure-serverless-security-platform
Securing AI agent access to regulated production data on AWS.
An AI coding agent that can query production is a new class of principal: it holds broad credentials, acts on instructions from text it reads, and is exactly as trustworthy as the text it last processed. Most guidance treats this as a prompt problem. It is an authorisation problem.
This repository takes one narrow, high-stakes case — an agent querying a pharmacy database holding GDPR Article 9 health data — and builds the controls end to end, with evidence rather than assertions.
What is real vs. what is designed
Stated up front, because a repository that blurs this line is worse than one that builds less.
Component | Status | How to verify |
MCP protocol core (JSON-RPC 2.0 over stdio, hand-written) | Runs, 37 tests |
|
PostgreSQL least-privilege baseline (roles, RLS, masked views) | Runs against Postgres 17 |
|
SQL guardrail (AST parse-then-execute) | Runs, 37 attack payloads refused |
|
Read-only RDS/Aurora MCP server | Runs end to end |
|
PII leak assertions over the live transcript | Runs, 27 assertions |
|
CI/CD security gates (SAST, deps, secrets, IaC, SBOM) | Runs |
|
Threat model (STRIDE + attack tree) | Written |
|
AI secure-coding policy + training framework | Written |
|
JD coverage matrix + day-one operating plan | Written |
|
AWS posture MCP server (GuardDuty/Security Hub/IAM) | Not built | — |
Terraform: Aurora, Bedrock guardrails, agent IAM, 8 detections | Validates, checkov 169/0 |
|
CDK secure-serverless reference app | Not built | — |
IR playbooks, compliance map | Not built | — |
Nothing here has been deployed to a live AWS account. IaC is validated statically — that is a deliberate choice, not a limitation: it means anyone can clone this and verify every claim without credentials or spend.
Related MCP server: PostgreSQL MCP Server
Quick start
make setup # uv venv + dependencies
make db-up # Postgres 17 + schema + roles + masked views
make test # 122 tests
make mcp-demo # live stdio MCP session
make evidence # regenerate every artifact in evidence/
make db-downRequires Docker and uv. No AWS account.
The design in one picture
Three planes. The agent is modelled as a semi-trusted principal, never as part of the application.
flowchart TB
A[AI agent] -->|stdio JSON-RPC| B[MCP server: protocol + tool allowlist]
B --> C[SQL AST guardrail: parse, then decide]
C --> D[(Aurora/PostgreSQL<br/>mcp_readonly · RLS · masked views)]
B --> E[Audit log: JSONL, arguments fingerprinted]
E --> F[EventBridge → Security Hub → responder]
D --> FDefence in depth is the invariant
Three independent layers, each assuming the one above it will eventually fail:
mcp_core— protocol shape, lifecycle ordering, tool allowlist.guardrails.py— statement shape, relation allowlist, row and byte caps.The
mcp_readonlydatabase role — grants, column-level privileges, RLS.
Layer 3 is the one that matters. Layers 1 and 2 are application code and can have
bugs; layer 3 is enforced by PostgreSQL and holds even if the server process is
fully compromised. evidence/db-privilege-proof.txt demonstrates this with the
application entirely out of the picture: 19 write, filesystem, and
privilege-escalation attempts, each refused by the engine.
Evidence
Every artifact in evidence/ is regenerated by make evidence — reproducible
output, not screenshots.
Artifact | What it proves |
| PostgreSQL itself denies writes, raw PII reads, |
| 37 documented escape techniques, each refused, each mapped to the control that caught it |
| A real stdio session returning masked data and refusing four attacks |
| Full suite output |
| terraform validate + fmt + tflint + checkov across all four modules |
| Every policy suppression with its justification, split into false positives vs deliberate risk acceptances |
Two findings this repository caught on itself
Both are documented rather than quietly fixed, because how a control fails is more instructive than the control working.
An inert RLS policy. The consent policy on prescriptions was present in DDL
and enforced nothing. A Postgres view executes with its owner's privileges;
these views were owned by a superuser, and superusers bypass RLS unconditionally.
FORCE ROW LEVEL SECURITY was never consulted, and all four prescription rows
were visible including the two without consent. Caught by the privilege proof on
its first run. Fixed with security_invoker = true plus column-level grants that
withhold both prescriber_hsa_id and the consent flag itself — the filter column
is withheld because a readable filter column is an oracle for the hidden rows.
A denial of service in the transport. Oversized frames raised out of the generator that reads them. A Python generator that raises is closed permanently, so one oversized line ended the session — one bad frame, one dead connection. Frames now carry the refusal as data, so the server answers and keeps serving.
Why hand-write the protocol?
Because it demonstrates that the wire format and its trust boundaries are
understood rather than assumed, and because a security repository arguing for
supply-chain discipline should not pull forty transitive packages to parse JSON.
mcp_core has zero runtime dependencies.
Production systems should use the official MCP SDK. It is maintained, spec-tracked, and tested far more broadly than this. That trade-off is stated here rather than left for a reviewer to notice.
Repository layout
mcp-servers/
mcp_core/ protocol layer — jsonrpc, transport, server, audit, errors
rds_readonly_mcp/ guardrails, PII classification, tools
sql/ roles, RLS, masked views ← the controls that actually hold
tests/ conformance · bypass suite · leak assertions
infra/ Terraform + CDK (static validation only)
scripts/ evidence generators
evidence/ regenerable proof artifacts
docs/ threat model, AI secure-coding policy, IR, compliance
readiness/ role readiness: JD coverage, operating plan, drillsContext
Built as the technical dossier for a Lead Security Engineer application (Core Technology team, Apotea, Stockholm) — a role whose posting asks specifically for "secure practices for coding with AI assistants, ensuring generated code meets security standards, avoids data leakage, and aligns with regulations."
The pharmacy schema is entirely synthetic. Every personnummer is deliberately
invalid, every email is on example.com, and every prescription is fabricated.
Seeding a demonstration like this with real data would contradict its own thesis.
Licensed MIT. Not affiliated with or endorsed by Apotea.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceEnables interaction with PostgreSQL databases through MCP, allowing users to explore database structures, inspect table schemas, and execute read-only SQL queries.Last updated
- -license-quality-maintenanceEnables users to perform SQL query execution, schema exploration, and performance analysis on PostgreSQL databases through any MCP-compatible client. It prioritizes security with read-only protection by default and provides guided workflows for database documentation and optimization.Last updated
- Alicense-qualityCmaintenanceA read-only PostgreSQL MCP server that enables AI agents to perform schema introspection and execute SELECT-only queries. It supports secure database connections through SSL and SSH tunnels while offering a structure-only mode to restrict query access.Last updated170MIT
- Alicense-qualityAmaintenanceProvides a read-only PostgreSQL SQL surface for LLM agents via MCP, with defense-in-depth security layers for safe database queries.Last updated3MIT
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Read-only MCP access to sessions, funnels, campaigns, errors, live visitors, and anomalies.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mpurushotham/secure-serverless-security-platform'
If you have feedback or need assistance with the MCP directory API, please join our Discord server