Configure PostgreSQL MCP Backend and Tools
PostgreSQL MCP Backend
To create a Backend for MCP Virtual Server go to MCP Virtual Server details page and click “Create Backend”

PostgreSQL backend allows configuration of MCP tools operating on data in an Instaclustr PostgreSQL cluster.
Specify the name for the backend, note that this name will be prepended to all the tools configured for this backend.
Provide a PostgreSQL Cluster ID and credentials that MCP Gateway will use to authenticate to the PostgreSQL cluster. Optionally, specify a database that tools will target by default. Follow Creating a PostgreSQL Cluster to create a PostgreSQL cluster.

Rate limits can also be set on the backend during and after creation. Configuration is specified for a token-bucket approach using a throughput of requests per time unit and a maximum burst size. We strongly recommend setting a rate limit on your backend, however it is not required. Leaving the form fields blank will not set any rate limit.

To create PostgreSQL tools go to PostgreSQL backend details page and click “Create Tool”
SQL Query Tool
SQL Query Tool will execute a pre-configured SQL statement on your PostgreSQL cluster.
Specify the name and description for the tool. These should provide information about the tool’s intended use and effects.
Specify the SQL statement for the tool to execute. Use :paramName syntax to mark bind variables that the AI agent will supply at call time (e.g. SELECT customerId, orders FROM orders WHERE customerId = :customerId).
User authentication JWT claims can be incorporated into the SQL statement by using the following syntax: SELECT customerId, orders FROM orders WHERE customerId = :{jtw.sub}, where code inside :{...} uses Common Expression Language and has access to User’s JWT claims via jwt object.

Optionally specify parameters to declare the bind variables referenced in the SQL template. Multiple parameters can be configured with the “Add Parameter” button. Specify how the parameter is passed to the template SQL statement, the parameter type and an optional description.

Parameters are also available inside :{...} Common Expression Language via param object (e.g. SELECT customerId, orders FROM customers.orders WHERE customerId = :{param.customerId}).
Optionally specify result fields to declare the columns returned by a SQL statement. Multiple result fields can be configured with the “Add Result Field” button. Specify how the result field is returned from the template SQL statement and passed to the MCP client, the result field type and an optional description.

You can optionally specify a rate limit for the tool configured as a token-bucket using a throughput of requests per time unit and a maximum burst size. Leaving the form fields blank will not set any rate limit. Tool rate limits override backend rate limits and tools with their own rate limits are excluded from contributing to backend rate limits.
