AI infrastructure · Amazon Bedrock · AgentCore · MCP · Security
MCP Postgres Scout
Safe, structured database introspection for AI coding agents, implemented with Amazon Bedrock and Amazon Bedrock AgentCore without granting permission to modify production data.
Architecture: Amazon Bedrock + Amazon Bedrock AgentCore

The challenge
Coding agents need accurate database context to make architecture-aware changes, but direct production access creates unacceptable risk. The system needed to expose useful schema intelligence while enforcing a non-destructive boundary.
My end-to-end ownership
I independently delivered this engagement from discovery to completion. I owned requirements, product and solution design, the MCP contract, PostgreSQL introspection, permission boundaries, guarded tools, structured outputs, testing, security controls, deployment, auditability, documentation and handover.
- Discovery and requirements
- Product and solution design
- Architecture and engineering
- AI and data workflows
- Cloud, security and CI/CD
- Testing, observability and handover
System design
A TypeScript MCP server exposes allow-listed tools for schemas, tables, columns, relationships, indexes, permissions and query-plan inspection. Responses are structured so agents can reason with less ambiguity.
AWS agent architecture
Amazon Bedrock provides model inference while AgentCore supplies the governed runtime around the agent. The database remains behind a narrow read-only capability boundary, not directly inside model context.
A qualified foundation model interprets intent and reasons over typed PostgreSQL metadata returned by tools.
Hosts the TypeScript agent and MCP service with isolated sessions, scaling and OpenTelemetry-compatible traces.
Publishes allow-listed MCP tools and deterministically blocks undeclared schemas, write operations and unsafe arguments.
Provides workload identity and short-lived access to the database secret without exposing credentials to the model.
Uses a read-only role or replica, statement timeouts, result limits and catalog-only access where appropriate.
Measures tool selection, SQL safety and answer usefulness while retaining audit, latency and failure evidence.
Amazon VPC networking, AWS PrivateLink where supported, IAM, Secrets Manager, KMS, CloudTrail and CloudWatch complete the security and operating boundary.
Production controls
Read-only credentials, SQL classification, statement restrictions, timeouts, result limits, explicit tool schemas, audit records and safe failure behaviour preserve the trust boundary.