pg_psql tool to run SQL against a Heroku Postgres follower database. As noted in Working with MCP, database tools work only with followers so your production data remains read-only for agents. Results are returned as JSON, which makes it easy to answer analytical questions or power dashboards.
Requirements
target_app_namepointing to the Heroku app with the database- Appropriate database credentials configured via config vars
- A follower database provisioned via
heroku pg:copyor heroku addons:create`
Example prompt
Tips
- Use parameterized queries to avoid SQL injection.
- Limit result sets to keep responses manageable.
- Combine with the Doc reader to explain table schemas before querying.
- For complex data pipelines, consider deploying the pg_psql MCP template so you can extend behavior beyond the built-in tool.