Avanti Fellows PostgreSQL MCP Server
OfficialProvides read-only access to query PostgreSQL databases with tools for running SELECT queries, listing tables, describing schemas, sampling data, counting rows, and searching columns across the database.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Avanti Fellows PostgreSQL MCP Servershow me the schema for the students table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Avanti Fellows PostgreSQL MCP Server
Read-only MCP server for querying the Avanti Fellows DB Service (PostgreSQL).
What is this?
This is an MCP (Model Context Protocol) server that lets Claude Code, Cursor, and other AI tools query our PostgreSQL database directly. It's read-only - no writes allowed.
Related MCP server: MCP Server for Database
Available Tools
Tool | Description |
| Run any SELECT query |
| List all tables in the database |
| Get column info, primary keys, foreign keys |
| Get sample rows from a table |
| Count rows with optional WHERE clause |
| Find columns by name across all tables |
Installation
1. Install the package
pip install git+https://github.com/avantifellows/mcp-postgres.git2. Set up credentials
Add these to your shell profile (~/.zshrc or ~/.bashrc):
export AF_DB_HOST="af-database-host"
export AF_DB_PORT="5432"
export AF_DB_USER="your_username"
export AF_DB_PASSWORD="your_password"
export AF_DB_NAME="database_name"Then reload: source ~/.zshrc
3. Configure your AI tool
Claude Code
claude mcp add avanti-db -- avanti-mcp-postgresVerify it's working:
claude mcp listCursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"avanti-db": {
"command": "avanti-mcp-postgres",
"env": {
"AF_DB_HOST": "af-database-host",
"AF_DB_PORT": "5432",
"AF_DB_USER": "your_username",
"AF_DB_PASSWORD": "your_password",
"AF_DB_NAME": "database_name"
}
}
}
}Usage Examples
Once configured, just ask Claude/Cursor about the database:
"What tables are in the database?"
"Show me the schema for the students table"
"How many users signed up this month?"
"Find all columns with 'email' in the name"
"What does the enrollment data look like?"Updating
pip install --upgrade git+https://github.com/avantifellows/mcp-postgres.gitLocal Development
# Clone the repo
git clone https://github.com/avantifellows/mcp-postgres.git
cd mcp-postgres
# Create virtual environment
python -m venv venv
source venv/bin/activate
# Install in dev mode
pip install -e .
# Create .env file with credentials
cp .env.example .env
# Edit .env with your credentials
# Test the server
avanti-mcp-postgresSecurity Notes
This server is read-only - INSERT, UPDATE, DELETE are blocked
Uses your personal database credentials
Queries are logged locally but not sent anywhere
Don't commit credentials to git
Troubleshooting
"Connection refused"
Check that
AF_DB_HOSTis correct and accessible from your networkVerify you're on VPN if required
"Authentication failed"
Double-check
AF_DB_USERandAF_DB_PASSWORDEnsure your user has SELECT permissions
Server not showing in Claude Code
Run
claude mcp listto check statusTry removing and re-adding:
claude mcp remove avanti-db && claude mcp add avanti-db -- avanti-mcp-postgres
Available Tools
6 toolscount_rowsA
Count rows in a table, optionally with a WHERE clause.
Args:
table_name: Name of the table
schema_name: Schema name (default: public)
where: Optional WHERE clause (without 'WHERE' keyword)
Returns:
JSON with count
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | ||
| schema_name | No | public | |
| where | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It states the basic operation and return format ('JSON with count'), but doesn't disclose permissions needed, rate limits, error conditions, or whether it's a read-only operation (though implied by 'Count').
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Perfectly structured: purpose statement first, then Args and Returns sections. Every sentence earns its place with no wasted words. The formatting makes it easy to scan.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, no annotations, but has output schema), the description is mostly complete. It covers parameters well and mentions the return format. However, it lacks behavioral context like permissions or limitations that would be helpful for a database tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It clearly explains all 3 parameters: table_name, schema_name (with default), and where (with syntax guidance 'without WHERE keyword'). This adds significant value beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Count rows') and resource ('in a table'), with optional filtering via WHERE clause. It distinguishes from siblings like query (which returns data) and list_tables (which lists tables).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for counting rows with optional filtering, but doesn't explicitly state when to use this vs. alternatives like query (which could also count) or describe_table (for metadata). No explicit exclusions or prerequisites are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
describe_tableA
Get detailed schema information for a table.
Returns column names, types, nullability, and defaults.
Use this to understand table structure before querying.
Args:
table_name: Name of the table
schema_name: Schema name (default: public)
Returns:
JSON with columns, primary keys, and foreign keys
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | ||
| schema_name | No | public |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden. It discloses that this is a read operation (implied by 'Get') and describes the return format (JSON with columns, primary keys, foreign keys), which is helpful. However, it doesn't mention potential errors (e.g., if table doesn't exist), permissions needed, or rate limits, leaving some behavioral aspects unclear.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly structured: a clear purpose statement, usage guidance, and well-organized parameter/return sections. Every sentence earns its place, with no redundant information. The bullet-point style for Args and Returns enhances readability without wasting space.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (2 parameters, read-only operation) and the presence of an output schema (which handles return value documentation), the description is nearly complete. It covers purpose, usage, parameters, and return format adequately. The only minor gap is lack of error case documentation, but the output schema reduces the need for extensive return value explanation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 0%, so the description must compensate. It provides meaningful context for both parameters: table_name is clearly explained as 'Name of the table', and schema_name gets additional context with 'Schema name (default: public)', which clarifies its optional nature and typical value. This adds significant value beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Get detailed schema information') and resource ('for a table'), distinguishing it from siblings like list_tables (which lists tables) or query (which executes queries). It explicitly mentions what information is returned (column names, types, nullability, defaults), making the purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit guidance on when to use this tool ('Use this to understand table structure before querying'), which clearly differentiates it from query (for actual data retrieval) and sample_data (for data preview). It implicitly suggests alternatives like list_tables for table enumeration, making usage context clear.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_tablesA
List all tables in the database.
Returns tables from all schemas (excluding system schemas).
Use this to discover what data is available.
Returns:
JSON array of tables with schema, name, and type
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses that it excludes system schemas and returns a JSON array with specific fields, which adds useful behavioral context. However, it doesn't cover aspects like rate limits, permissions, or pagination, leaving some gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with the core purpose in the first sentence, followed by additional context and return details in a structured way. Every sentence adds value without waste, making it highly efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's low complexity (0 parameters) and the presence of an output schema, the description is complete enough for a list operation. It explains what is returned and exclusions, but could slightly improve by mentioning sibling tools for more context.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, and the baseline for 0 params is 4, as it avoids unnecessary details.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('List') and resource ('tables in the database'), and distinguishes it from siblings by mentioning it returns tables from all schemas. However, it doesn't explicitly differentiate from tools like 'describe_table' or 'search_columns' beyond scope.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides implied usage guidance by stating 'Use this to discover what data is available,' which suggests when to use it, but doesn't explicitly mention when not to use it or name alternatives like 'search_columns' for more specific queries.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
queryA
Execute a read-only SQL query against the database.
Only SELECT queries are allowed. Use this to explore data,
debug issues, or validate assumptions about the data.
Args:
sql: A SELECT query to execute
Returns:
JSON array of results, or error message
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden and does well by disclosing key behavioral traits: it's read-only, restricts to SELECT queries, and mentions error handling ('or error message'). It could improve by adding details like rate limits or result size limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is appropriately sized and front-loaded, with the core purpose in the first sentence, usage guidelines in the second, and clear sections for Args and Returns. Every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (SQL execution), no annotations, and an output schema present, the description is complete enough: it covers purpose, usage, behavioral constraints, parameter meaning, and return values, making it self-sufficient for an AI agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, but the description compensates by explaining the 'sql' parameter as 'A SELECT query to execute,' adding meaning beyond the bare schema. It doesn't provide syntax examples or constraints, but this is adequate given the single parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Execute') and resource ('read-only SQL query against the database'), distinguishing it from siblings like count_rows or describe_table by focusing on general query execution rather than specific operations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('to explore data, debug issues, or validate assumptions') and explicitly states 'Only SELECT queries are allowed,' which helps differentiate it from potential write operations. However, it doesn't explicitly mention when to use alternatives like sample_data or search_columns.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
sample_dataA
Get sample rows from a table.
Useful for understanding what data looks like without
writing a full query.
Args:
table_name: Name of the table
schema_name: Schema name (default: public)
limit: Number of rows to return (default: 10, max: 100)
Returns:
JSON array of sample rows
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes | ||
| schema_name | No | public | |
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It discloses the tool's read-only nature through context ('Get sample rows') and mentions the limit constraint ('max: 100'), but doesn't cover other behavioral aspects like error conditions, permissions needed, or performance characteristics that would be helpful for an agent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and appropriately sized. It starts with the core purpose, provides usage context, then details parameters and return values in clear sections. Every sentence adds value with no wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (3 parameters, 1 required), no annotations, but with an output schema (implied by 'Returns: JSON array of sample rows'), the description is reasonably complete. It covers purpose, usage, parameters, and returns, though additional behavioral context would improve completeness for an agent.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant value beyond the input schema, which has 0% description coverage. It provides clear explanations for all three parameters including defaults and constraints (e.g., 'default: public', 'default: 10, max: 100'), which the schema only indicates through titles and default values without explanation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('sample rows from a table'), making it easy to understand what it does. However, it doesn't explicitly differentiate from sibling tools like 'query' or 'describe_table', which could also help understand data structure.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use this tool ('for understanding what data looks like without writing a full query'), which implicitly distinguishes it from 'query' (for full queries) and 'describe_table' (for schema info). However, it doesn't explicitly state when NOT to use it or name specific alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_columnsA
Search for columns by name across all tables.
Useful when you know a column name but not which table it's in.
Args:
search_term: Partial column name to search for (case-insensitive)
Returns:
JSON array of matching columns with their tables
| Name | Required | Description | Default |
|---|---|---|---|
| search_term | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively describes the search behavior (case-insensitive partial matching) and return format (JSON array with tables). However, it doesn't mention potential limitations like result size, pagination, or performance considerations for large databases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is perfectly structured and concise: purpose statement, usage guidance, parameter explanation, and return format in four clear lines. Every sentence earns its place with no wasted words, and information is front-loaded appropriately.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (search across tables), no annotations, and the presence of an output schema (which handles return value documentation), the description is complete. It covers purpose, usage context, parameter semantics, and behavioral traits adequately for the agent to use it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 0% description coverage, so the description must compensate. It clearly explains the 'search_term' parameter as 'Partial column name to search for (case-insensitive),' adding crucial semantic context beyond the bare schema. The description fully documents the single parameter's purpose and behavior.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Search for columns by name across all tables.' This specifies the verb (search), resource (columns), and scope (across all tables), distinguishing it from siblings like 'describe_table' (single table) or 'list_tables' (tables only).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly provides usage guidance: 'Useful when you know a column name but not which table it's in.' This clearly indicates when to use this tool versus alternatives like 'describe_table' (for specific table details) or 'query' (for data retrieval).
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
6 tool updates
v1.0.0- First observed
count_rows - First observed
describe_table - First observed
list_tables - First observed
query - First observed
sample_data - First observed
search_columns
TDQS
Each tool has a clearly distinct purpose with no overlap: count_rows counts rows, describe_table provides schema details, list_tables enumerates tables, query executes SQL, sample_data retrieves sample rows, and search_columns finds columns by name. The descriptions reinforce these unique functions, making misselection unlikely.
All tool names follow a consistent verb_noun pattern with snake_case, such as count_rows, describe_table, list_tables, query, sample_data, and search_columns. This uniformity makes the tool set predictable and easy to navigate for an agent.
With 6 tools, the server is well-scoped for a PostgreSQL exploration and querying purpose. Each tool earns its place by covering essential database operations like discovery, inspection, and data retrieval without being overly complex or sparse.
The tool set provides strong coverage for exploring and querying a PostgreSQL database, including discovery (list_tables, search_columns), inspection (describe_table), and data retrieval (count_rows, sample_data, query). A minor gap is the lack of write operations (e.g., insert, update, delete), but this aligns with a read-only focus, and agents can work around it for analysis tasks.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Query 40 databases from Claude, ChatGPT, or Cursor — on any device. Read-only, encrypted, audited.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for PostgreSQL that enables safe database introspection and querying via natural language.751MIT
- FlicenseNot gradedqualityFmaintenanceA read-only MCP server that enables AI agents to explore database schemas and execute safe queries on PostgreSQL and MySQL.-
- AlicenseNot gradedqualityBmaintenanceA zero-config, read-only PostgreSQL MCP server that enforces read-only access at the database level using READ ONLY transactions, allowing AI agents to safely explore schemas and run SELECT queries without risk of mutation.49MIT
- FlicenseNot gradedqualityBmaintenanceRead-only MCP server for PostgreSQL enabling schema introspection and SELECT queries via MCP clients like Claude, with multi-layered write protection.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/avantifellows/mcp-postgres'
If you have feedback or need assistance with the MCP directory API, please join our Discord server