Ainative Postgres Mcp

io.github.AINative-Studio由 GitHub 账号 AINative-Studio 发布v1.0.1更新于 Oct 24, 2026

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

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

本地 PostgreSQL MCP 服务器,自动开通带 pgvector 的免费托管 Postgres 实例,让助手查询、查看和修改数据表。

可以做什么
在只读事务中执行只读 SQL 查询,并对向量列进行相似度搜索。列出所有数据表,并查看完整表结构,包括列、类型、约束和索引。用 SQL DDL 创建新表并插入数据行,返回插入的行。首次运行时自动开通启用 pgvector 的托管 PostgreSQL 实例,并将连接信息保存到本地。
适用场景
适合助手需要一个可用的 Postgres 数据库用于开发、原型验证或向量存储,但不想提供连接字符串的场景;也适合作为官方 server-postgres 的替代品,获得表结构查看和写入工具。
运行要求
通过 npx 在本地运行,需要 Node.js。启动无需账号或密钥:未设置 DATABASE_URL 时会通过 ZeroDB API 开通托管实例,并把凭据写入本地配置文件、.env 和 .mcp.json。可选变量:DATABASE_URL、ZERODB_API_KEY、ZERODB_PROJECT_ID、ZERODB_API_URL。开通实例需要网络访问。
安装前请注意
自动开通会向第三方服务发送请求,并把生成的凭据保存在本地文件中。免费实例仅保留 72 小时,需通过打印出的认领链接认领,认领需要注册账号。服务器可以创建表和插入数据,会写入数据库。使用前请检查保存的凭据和认领链接。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Ainative Postgres Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

ainative-postgres-mcp

Zero-config PostgreSQL MCP server with auto-provisioning. Drop-in replacement for @modelcontextprotocol/server-postgres — no DATABASE_URL needed.

The official @modelcontextprotocol/server-postgres requires you to bring your own Postgres database and pass a connection string. This fork auto-provisions a managed PostgreSQL instance with pgvector on first run. Agents get a database instantly with zero configuration.

Quick Start

bash
npx ainative-postgres-mcp

That's it. On first run:

  1. A free managed PostgreSQL instance is provisioned
  2. pgvector extension is enabled automatically
  3. Connection details are saved to ~/.ainative/postgres-config.json, .env, and .mcp.json
  4. A claim URL is printed so you can take ownership of the database

MCP Configuration

Claude Code / Claude Desktop

Add to your claude_desktop_config.json or .mcp.json:

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

With existing database

json
{  "mcpServers": {    "postgres": {      "command": "npx",      "args": ["-y", "ainative-postgres-mcp"],      "env": {        "DATABASE_URL": "postgresql://user:pass@host:5432/mydb"      }    }  }}

Cursor

Add to .cursor/mcp.json:

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

Windsurf

Add to ~/.windsurf/mcp.json:

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

Tools

ToolDescription
queryExecute read-only SQL queries (runs in READ ONLY transaction)
list_tablesList all tables with schema, name, and type
describe_tableGet full table schema: columns, types, constraints, indexes
create_tableCreate a new table with SQL DDL
insertInsert rows into a table (returns inserted rows)

Comparison with official server-postgres

Feature@modelcontextprotocol/server-postgresainative-postgres-mcp
Read queriesYesYes
Write queriesNoYes (create_table, insert)
Schema inspectionVia resourcesVia describe_table tool
Table listingNoYes (list_tables)
Auto-provisioningNoYes
pgvectorManual setupAuto-enabled
Zero configNo (requires DATABASE_URL)Yes
Free tierN/AYes

How Auto-Provisioning Works

Start  |  vDATABASE_URL set? ----yes----> Connect directly  |  no  v~/.ainative/postgres-config.json exists? ----yes----> Load and connect  |  no  v.mcp.json has DATABASE_URL? ----yes----> Load and connect  |  no  vPOST /api/v1/public/instant-db   (get API key)  |  vPOST /api/v1/zerodb/postgres/provision   (get Postgres)  |  vSave to ~/.ainative/postgres-config.json + .env + .mcp.json  |  vConnect and enable pgvector

pgvector Support

pgvector is automatically enabled on provisioned instances. You can use vector columns in your tables:

sql
CREATE TABLE documents (  id SERIAL PRIMARY KEY,  content TEXT,  embedding vector(1536));

And run similarity searches:

sql
SELECT content, embedding <=> '[0.1, 0.2, ...]'::vector AS distanceFROM documentsORDER BY distanceLIMIT 10;

Environment Variables

VariableDescriptionRequired
DATABASE_URLPostgreSQL connection stringNo (auto-provisioned if missing)
ZERODB_API_KEYZeroDB API key (for provisioning)No (auto-created)
ZERODB_PROJECT_IDZeroDB project IDNo (auto-created)
ZERODB_API_URLZeroDB API base URLNo (defaults to https://api.ainative.studio)

Free Tier

Auto-provisioned instances include:

  • Managed PostgreSQL with pgvector
  • Shared compute (suitable for development and light production)
  • Automatic backups
  • SSL encryption

Sign up at ainative.studio to claim your instance and unlock higher limits.

License

MIT


Powered by ZeroDB + AINative

This package is part of the AINative ecosystem — the AI-native developer platform.

Why ZeroDB?

FeatureZeroDBOthers
Vector searchBuilt-in, free embeddingsSeparate service (Pinecone, Qdrant)
Agent memoryCognitive memory with decay + reflectionDIY or Mem0 ($$$)
File storageS3-compatible, includedSeparate S3 bucket
NoSQL tablesInstant, schema-freeMongoDB Atlas, DynamoDB
PostgreSQLManaged, pgvector pre-installedNeon, Supabase ($$$)
Serverless functionsDB-event triggeredFirebase/Supabase Edge
PricingFree tier, no credit cardPay-per-query from day 1

Get Started Free

bash
npx zerodb-cli init    # Auto-configures your IDE

Or sign up at ainative.studio — free tier, no credit card required.

View all ZeroDB packages →


Zero-Config Auto-Provisioning

No account needed to start. On first run, this package automatically:

  1. Provisions a free ZeroDB instance (~800ms)
  2. Saves credentials locally (.env, .mcp.json)
  3. Prints a claim link in your terminal

The 72-Hour Window

Your auto-provisioned instance is free for 72 hours. To keep your data permanently, visit the claim URL printed in your terminal.

For AI Agents

If a coding agent (Claude Code, Cursor, Windsurf) installs this package:

  • Auto-provisions without human intervention
  • The claim URL appears in agent output — visit it to take ownership
  • .claude/CLAUDE.md instructs agents to surface the claim link to you
  • Check .env or ~/.ainative/config.json for your project ID if you miss it

来源:README.md,提交 395f19a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分