แก้ไข

Azure MCP Server tools for Azure Database for PostgreSQL

The Azure MCP Server allows you to manage Azure Database for PostgreSQL resources using natural language prompts. You can query databases, list tables, retrieve schemas, and more without remembering complex query syntax.

Azure Database for PostgreSQL is a fully managed, intelligent, and scalable PostgreSQL database service in the cloud. It lets you focus on application development, not database management.

Note

Tool parameters: The Azure MCP Server tools define parameters for data they need to complete tasks. Some of these parameters are specific to each tool and are documented here. Other parameters are global and shared by all tools. For more information, see Tool parameters.

List servers, databases, and tables

List Azure Database for PostgreSQL servers, databases, or tables. By default, this tool returns all servers in the subscription, optionally scoped to a resource group. Specify the Server to list databases, or specify both Server and Database to list tables. Results are returned at the level you specify: server, database, or table. When listing databases or tables on large servers, the tool caps results at 10,000 entries. If the response is truncated, resultsTruncated is true.

Example prompts include:

  • "List all PostgreSQL servers in resource group 'my-resource-group'."
  • "Show me the databases in PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'."
  • "List all tables in database 'my-db' on PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'."
Parameter Required or optional Description
User Optional The user name to access PostgreSQL server.
Auth type Optional The authentication type to access the PostgreSQL server. Supported values are MicrosoftEntra or PostgreSQL. By default, MicrosoftEntra is used.
Password Optional Password for database authentication.
Server Optional The PostgreSQL server to list databases from.
Database Optional The PostgreSQL database to list tables from. Requires Server.
Schema Optional The PostgreSQL schema to list tables from when listing tables. Defaults to public.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required

Database: execute database query

The Azure MCP Server can execute a query on a PostgreSQL database.

Example prompts include:

  • Run query: "Execute 'SELECT * FROM users LIMIT 10' in my PostgreSQL database 'my-db' on server 'my-pg-server' in resource group 'my-resource-group'"
  • Query data: "Run a query to get recent orders from PostgreSQL database 'my-db' on server 'my-pg-server' in resource group 'my-resource-group'"
  • Fetch data: "Get user information from my PostgreSQL database 'my-db' on server 'my-pg-server' in resource group 'my-resource-group' with query"
  • Extract data: "Query customer data from my PostgreSQL server 'my-pg-server'"
  • Retrieve records: "Select top sales records from PostgreSQL database 'my-db' on server 'my-pg-server'"
Parameter Required or optional Description
User Required The user name to access PostgreSQL server.
Server Required The PostgreSQL server to be accessed.
Database Required The PostgreSQL database to be accessed.
Query Required Query to be executed against a PostgreSQL database.
Auth type Required Authentication type to use for the connection.
Password Optional Password for database authentication.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required

Table: get table schema

The Azure MCP Server can get the schema of a specific table in a PostgreSQL database.

Example prompts include:

  • View schema: "Show me the schema of the 'users' table in my PostgreSQL database 'my-db' on server 'my-pg-server'"
  • Get structure: "What columns does the 'products' table have in my PostgreSQL database 'my-db' on server 'my-pg-server'?"
  • Check schema: "Check if my schema has a not null constraint on the id column in database 'my-db' on server 'my-pg-server'"
  • View columns: "Show columns and types for 'customers' table in PostgreSQL database 'my-db' on server 'my-pg-server'"
  • Examine table: "Get the structure of 'transactions' table in my PostgreSQL database 'my-db' on server 'my-pg-server'"
Parameter Required or optional Description
User Required The user name to access PostgreSQL server.
Server Required The PostgreSQL server to be accessed.
Database Required The PostgreSQL database to be accessed.
Table Required The PostgreSQL table to be accessed.
Auth type Required Authentication type to use for the connection.
Password Optional Password for database authentication.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required

Server: get server configuration

The Azure MCP Server can retrieve the configuration of a PostgreSQL server.

Example prompts include:

  • View configuration: "Show me the configuration of my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'"
  • Get settings: "What are the settings of my PostgreSQL server 'pg-prod' in resource group 'my-resource-group'?"
  • Check config: "Check if my server 'my-pg-server' in resource group 'my-resource-group' configuration 'x' is set to 'y'"
  • View server params: "Show me all configuration parameters of my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'"
  • Get server setup: "What is the configuration of my PostgreSQL instance 'my-pg-server' in resource group 'my-resource-group'?"
Parameter Required or optional Description
Resource group Required The name of the Azure resource group. This is a logical container for Azure resources.
User Required The user name to access PostgreSQL server.
Server Required The PostgreSQL server to be accessed.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required

Server: get server parameter

The Azure MCP Server can retrieve a specific parameter of a PostgreSQL server.

Example prompts include:

  • View parameter: "Show me the 'max_connections' parameter of my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'"
  • Get setting: "What is the value of 'shared_buffers' in my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'?"
  • Check parameter: "Check if my server 'my-pg-server' in resource group 'my-resource-group' parameter 'x' is set to 'y'"
  • View server param: "Show me the 'work_mem' parameter value in my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'"
  • Get configuration value: "What is the 'maintenance_work_mem' set to in my PostgreSQL instance 'my-pg-server' in resource group 'my-resource-group'?"
Parameter Required or optional Description
Resource group Required The name of the Azure resource group. This is a logical container for Azure resources.
User Required The user name to access PostgreSQL server.
Server Required The PostgreSQL server to be accessed.
Param Required The PostgreSQL parameter to be accessed.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required

Server: set server parameter

The Azure MCP Server can set or update a specific parameter on a PostgreSQL server. This allows you to configure server settings, optimize performance, and adjust database behavior according to your application requirements.

Example prompts include:

  • Update connection setting: "Set the 'max_connections' parameter to '200' on my 'prod-postgres-server' in resource group 'my-resource-group'"
  • Configure memory: "Update the 'shared_buffers' parameter to '256MB' on server 'database-server-east' in resource group 'my-resource-group'"
  • Adjust timeout: "Set 'statement_timeout' to '30000' on my PostgreSQL server 'my-pg-server' in resource group 'my-resource-group'"
  • Configure logging: "Update the 'log_statement' parameter to 'all' on server 'dev-postgres' in resource group 'my-resource-group'"
  • Set maintenance parameter: "Configure 'maintenance_work_mem' to '64MB' on my database server 'my-pg-server' in resource group 'my-resource-group'"
Parameter Required or optional Description
Resource group Required The name of the Azure resource group. This is a logical container for Azure resources.
User Required The user name to access the PostgreSQL server.
Server Required The PostgreSQL server name to configure.
Param Required The PostgreSQL parameter to be set.
Value Required The value to set for the parameter.

Tool annotation hints:

Destructive Idempotent Open World Read Only Secret Local Required