pg_credentials
View, configure, rotate, and monitor database credentials for Heroku apps to ensure secure access and compliance with security policies. Simplify credential management for database connections.
Instructions
Manage database access credentials and security. Use this tool when you need to: 1) View current database credentials, 2) Configure database access permissions, 3) Rotate credentials for security compliance, 4) Set up monitoring access. The tool helps maintain secure database access and credential management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | The name of the Heroku app whose database credentials to view. | |
| database | No | Config var containing the connection string, unique name, ID, or alias of the database. To access another app's database, prepend the app name to the config var or alias with `APP_NAME::`. If omitted, DATABASE_URL is used. |
Implementation Reference
- src/tools/data.ts:294-304 (handler)The handler function that constructs and executes the 'pg:credentials' Heroku CLI command via CommandBuilder and HerokuREPL, then processes the output.async (options: PgCredentialsOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_CREDENTIALS) .addFlags({ app: options.app }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); }
- src/tools/data.ts:88-96 (schema)Zod schema and TypeScript type definition for the input options of the pg_credentials tool.export const pgCredentialsOptionsSchema = z.object({ app: z.string().describe('Target app name'), database: z .string() .optional() .describe('Database identifier. Format: APP_NAME::DB for other apps. Default: DATABASE_URL') }); export type PgCredentialsOptions = z.infer<typeof pgCredentialsOptionsSchema>;
- src/tools/data.ts:289-306 (registration)The registration function that registers the 'pg_credentials' tool with the MCP server, including name, description, schema, and handler.export const registerPgCredentialsTool = (server: McpServer, herokuRepl: HerokuREPL): void => { server.tool( 'pg_credentials', 'Manage access: credentials, permissions, security, monitoring', pgCredentialsOptionsSchema.shape, async (options: PgCredentialsOptions): Promise<McpToolResponse> => { const command = new CommandBuilder(TOOL_COMMAND_MAP.PG_CREDENTIALS) .addFlags({ app: options.app }) .addPositionalArguments({ database: options.database }) .build(); const output = await herokuRepl.executeCommand(command); return handleCliOutput(output); } ); };
- src/index.ts:81-81 (registration)Call to register the pg_credentials tool during MCP server setup.data.registerPgCredentialsTool(server, herokuRepl);
- src/utils/tool-commands.ts:36-36 (helper)Constant defining the Heroku CLI command string for PG_CREDENTIALS used in the handler.PG_CREDENTIALS: 'pg:credentials',