# ainative-postgres-mcp [Health: Active]

**Category:** 🗄️ Databases  
**Repository:** https://github.com/AINative-Studio/ainative-postgres-mcp  
**GitHub Stars:** 0  
**npm Downloads (last month):** 1409  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/ainative-postgres-mcp

## Description
Zero-config Postgres MCP with auto-provisioning — drop-in for server-postgres.

## Tools
Capabilities this server exposes over MCP:

- **query** — Execute read-only SQL queries (runs in READ ONLY transaction)
- **list_tables** — List all tables with schema, name, and type
- **describe_table** — Get full table schema: columns, types, constraints, indexes
- **create_table** — Create a new table with SQL DDL
- **insert** — Insert rows into a table (returns inserted rows)

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "ainative-postgres-mcp": {
    "command": "npx",
    "args": ["-y","ainative-postgres-mcp"]
  }
}
```

## Documentation

## What ainative-postgres-mcp does

The ainative-postgres-mcp MCP server gives AI agents a PostgreSQL interface through five MCP tools. Agents can run read-only SQL queries, inspect available tables, retrieve detailed table definitions, create tables with SQL DDL, and insert rows while receiving the inserted records in response.

The package is designed as a drop-in alternative to the official `@modelcontextprotocol/server-postgres` package. Its main difference is that it can create a managed PostgreSQL instance when no connection string is supplied. Provisioned databases include the pgvector extension, making the server suitable for applications that store embeddings alongside ordinary relational data.

## How it works

At startup, ainative-postgres-mcp first checks for a `DATABASE_URL`. If one is available, it connects directly to that PostgreSQL database. Without one, it checks saved configuration in `~/.ainative/postgres-config.json` and then looks for a connection value in `.mcp.json`.

If no usable connection details exist, the package requests an API key and provisions a PostgreSQL instance through the AINative and ZeroDB APIs. It then writes connection information to `~/.ainative/postgres-config.json`, `.env`, and `.mcp.json`, connects to the database, and enables pgvector. The first run also prints a claim URL. Auto-provisioned instances are free for 72 hours; visiting that URL is required to keep the data permanently.

Provisioned databases can use vector columns such as `vector(1536)` and support similarity queries using PostgreSQL vector operators.

## Setup and configuration

Run the package with:

```bash
npx ainative-postgres-mcp
```

For Claude Code or Claude Desktop, add a server entry that runs `npx -y ainative-postgres-mcp`. Cursor uses `.cursor/mcp.json`, while Windsurf uses `~/.windsurf/mcp.json`; both use the same command and arguments.

An existing PostgreSQL database can be selected by setting `DATABASE_URL` in the MCP server's environment. If it is omitted, the auto-provisioning flow supplies the database connection. `ZERODB_API_KEY` and `ZERODB_PROJECT_ID` can support provisioning, while `ZERODB_API_URL` controls the API base URL and defaults to `https://api.ainative.studio`.

## Tools and capabilities

- `query`: Executes SQL inside a read-only transaction.
- `list_tables`: Returns table schemas, names, and types.
- `describe_table`: Reports columns, data types, constraints, and indexes for a table.
- `create_table`: Creates a table from SQL DDL.
- `insert`: Inserts rows and returns the inserted rows.

Together, these tools support database exploration, relational schema creation, read access, and a defined insert path. The tool list does not include a general-purpose write-query tool.

## Limitations and notes

The `query` tool is explicitly read-only, so updates and deletes cannot be performed through arbitrary SQL queries. Writes are limited to the exposed `create_table` and `insert` tools.

Auto-provisioning depends on the AINative and ZeroDB service flow. The automatically created database is temporary until it is claimed within the stated 72-hour window. Use `DATABASE_URL` when the agent must connect to an existing PostgreSQL deployment instead of creating a managed instance.

_Full upstream README: https://allmcps.com/mcp/ainative-postgres-mcp/readme_

