# WithPostgresMcp

- Module: [Aspire.Hosting.Azure.PostgreSQL](/reference/api/go/aspire.hosting.azure.postgresql.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`AzurePostgresFlexibleServerDatabaseResource`](/reference/api/go/aspire.hosting.azure.postgresql/azurepostgresflexibleserverdatabaseresource.md)
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)

Adds a Postgres MCP server container and configures it to connect to the database represented by `builder`.

## Remarks

The Postgres MCP server is configured to use SSE transport and will expose an HTTP endpoint.
This extension method only applies when the Azure PostgreSQL resource is running as a container (i.e., `IsContainer` is `true`).
If the resource is not running as a container, this method has no effect.

## Definition

```go
func (AzurePostgresFlexibleServerDatabaseResource) WithPostgresMcp(options ...*WithPostgresMcpOptions) AzurePostgresFlexibleServerDatabaseResource
```

## Parameters

- `options` (`...*WithPostgresMcpOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithPostgresMcpOptions` argument.

- `ConfigureContainer` (`func(obj PostgresMcpContainerResource)`) `callback` -- Configuration callback for the Postgres MCP container resource.
- `ContainerName` (`*string`) -- The name of the container (optional).

## Returns

[`AzurePostgresFlexibleServerDatabaseResource`](/reference/api/go/aspire.hosting.azure.postgresql/azurepostgresflexibleserverdatabaseresource.md) -- The resource builder.

Returns a handle; failures surface later via `Err()`.

## Applies to

- [`AzurePostgresFlexibleServerDatabaseResource`](/reference/api/go/aspire.hosting.azure.postgresql/azurepostgresflexibleserverdatabaseresource.md)
