# WithPostgresMcp

- Module: [Aspire.Hosting.PostgreSQL](/reference/api/go/aspire.hosting.postgresql.md)
- Version: `17.0.0`
- Kind: `method`
- Defined on: [`PostgresDatabaseResource`](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.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 version of the package defaults to the tag of the container image.

## Definition

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

## 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

[`PostgresDatabaseResource`](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md) -- The resource builder.

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

## Applies to

- [`PostgresDatabaseResource`](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md)
