description: Add PostgreSQL MCP Server as a Goose Extension
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import YouTubeShortEmbed from '@site/src/components/YouTubeShortEmbed';
The PostgreSQL MCP Server extension allows Goose to interact directly with your PostgreSQL databases, enabling database operations, querying, and schema management capabilities. This makes it easy to work with your databases through natural language interactions.
It's worth noting that this MCP server only allows connecting to a single predefined database at this time, and the connection URL must be specified in the command. We're using `postgresql://localhost/mydb` as an example here to access a local database, but you can configure this for your own environment.
The PostgreSQL connection URL follows this format:
1. [Launch the installer](goose://extension?cmd=npx&arg=-y&arg=@modelcontextprotocol/server-postgres&id=postgres&name=PostgreSQL&description=PostgreSQL%20database%20integration&env=POSTGRES_URL%3DYour%20PostgreSQL%20connection%20URL)
2. Press `Yes` to confirm the installation
3. Enter your PostgreSQL connection URL in the format: `postgresql://username:password@hostname:5432/database`
4. Click `Save Configuration`
5. Scroll to the top and click `Exit` from the upper left corner
The PostgreSQL extension enables you to query and analyze data or give you information about the table structures. The extension is only capable of *read-only* operations, so you can use it to get information about your database, but not to modify it.
Just describe what you want to do in natural language, and Goose will help you accomplish it using the appropriate SQL commands and PostgreSQL features.
#### Goose Prompt
```
Search my database for any students whose current GPA is higher than the average in their current grade level. Tell me their name, grade, and how much they exceed their grade’s average GPA, and the average GPA.
```
#### Goose Output
```
Based on the query results, here are the students who are performing above their grade level average:
Grade 11
Emma Johnson
GPA: 4.00
Grade Average: 3.90
Exceeds average by: 0.10 points
Grade 12
John Smith
GPA: 3.85
Grade Average: 3.78
Exceeds average by: 0.08 points
Both students are performing well above their respective grade level averages. Emma Johnson in Grade 11 shows the highest difference above the grade average, exceeding it by 0.10 points, while John Smith in Grade 12 exceeds his grade's average by 0.08 points.