Neon logo
Developer ToolsAuth: OAuthHosting: Hosted or self-hosted

Neon MCP Server

Manage serverless Postgres on Neon in natural language — create branches, run SQL, and migrate via MCP.

Updated

What is Neon MCP?

The Neon MCP server is a Model Context Protocol server that lets AI agents manage Neon serverless Postgres databases in natural language — creating projects and branches, inspecting and changing schema, running SQL, and performing database migrations.

It is an official, open-source server maintained by Neon (neondatabase/mcp-server-neon). Neon hosts it as a remote MCP server at https://mcp.neon.tech/mcp, so most users connect without running anything locally. The server acts as a bridge between an agent's requests and the Neon API, translating them into the underlying management and SQL calls.

Authentication is handled via OAuth: when a client connects, a browser window opens for you to authorize access to your Neon account, and you can opt into a read-only scope during that flow. An API-key-based connection is also supported for headless or programmatic setups. Neon recommends MCP for development and testing rather than production environments.

Tools the Neon MCP server exposes

ToolWhat it does
list_projectsList the Neon projects in your account.
create_projectCreate a new Neon project.
describe_projectReturn details about a specific project.
create_branchCreate a new branch within a project.
delete_branchDelete a branch from a project.
run_sqlExecute a SQL statement against a database.
run_sql_transactionExecute multiple SQL statements as a transaction.
get_database_tablesList the tables in a database.
describe_table_schemaDescribe the schema of a specific table.
prepare_database_migrationStage a database migration for review before applying.

Connect the Neon MCP server

Claude Code

  1. 1

    Add the Neon remote server

    Run: npx add-mcp https://mcp.neon.tech/mcp -a claude-code

  2. 2

    Authorize via OAuth

    When the browser window opens, click Authorize to connect Claude Code to your Neon account. Choose read-only scope if you only need inspection/query access.

  3. 3

    Verify

    Ask Claude to "list my Neon projects" to confirm the tools are available. If you hit auth errors, run rm -rf ~/.mcp-auth and reconnect.

Alternatively run `npx neonctl@latest init`, which authenticates via OAuth, creates an API key, and configures the MCP server for you.

Cursor

  1. 1

    Add the Neon remote server

    Run: npx add-mcp https://mcp.neon.tech/mcp -a cursor — or add it manually under mcpServers with command "npx" and args ["-y", "mcp-remote@latest", "https://mcp.neon.tech/mcp"].

  2. 2

    Authorize via OAuth

    Open Cursor's MCP settings, start the Neon server, and click Authorize in the browser window that opens.

  3. 3

    Verify

    In Cursor's chat, ask it to list your Neon projects to confirm the connection.

Sample use cases

A scheduled agent creates a fresh Neon branch, runs migration scripts, and reports results

Isolated, disposable database environments for CI-style checks without touching production.

An agent answers ad-hoc data questions by running read-only SQL against a Neon database

Natural-language database querying with a read-only scope for safety.

A developer uses an MCP client to inspect schema and stage a migration for review before applying

Faster, conversational schema iteration during development.

Spin up a branch with the current schema snapshot so a PR reviewer can test against real data

Every pull request gets its own database branch, torn down automatically after merge.

An agent audits table sizes, index usage, and row counts nightly and flags anomalies

Automated database health checks surfaced before they become incidents.

Describe a data model in plain English and let the agent generate CREATE TABLE statements on a branch

Schema prototyping without writing SQL by hand.

After PRs merge, an agent lists stale branches and deletes the ones no longer needed

Automatic branch cleanup keeps the project tidy and avoids compute waste.

Seed a development branch with representative test data by running a series of INSERT statements

Consistent test fixtures across the team without manual SQL scripts.

Security & permissions

Authentication uses OAuth: connecting opens a browser authorization window where you grant the agent access to your Neon account, and you can select a read-only scope during the flow to limit it to non-mutating actions. An API-key-based connection is also supported. Because the agent can act on your projects, branches, schema, and data, Neon recommends using MCP for development and testing only, not production — prefer read-only scope and isolate write operations to disposable branches.

Using Neon MCP with Gamut

In Gamut, you add Neon as a connected tool and let an agent invoke it from an event- or schedule-triggered workflow — Gamut manages the OAuth connection and credentials so the agent can call the server's actions without you wiring up auth each run. A scheduled agent might, for example, spin up a Neon branch for a test run, execute read-only diagnostic SQL, and report the results, or inspect schema as part of a larger pipeline. Because Neon recommends MCP for development and testing, scope the connection to read-only where possible and reserve write actions for non-production branches.

Frequently asked questions

What is the Neon MCP server?

It is an official Model Context Protocol server from Neon that lets AI agents manage Neon serverless Postgres databases — creating projects and branches, inspecting and changing schema, running SQL, and performing migrations. Neon hosts it remotely at https://mcp.neon.tech/mcp.

Is the Neon MCP server free?

Yes — the MCP server itself is free and open source (neondatabase/mcp-server-neon). It operates on your own Neon account, which includes a free tier; any database and compute usage is billed according to Neon's standard pricing.

How do I connect the Neon MCP server to Claude or Cursor?

Run npx add-mcp https://mcp.neon.tech/mcp -a claude-code (or -a cursor), then click Authorize in the OAuth browser window. You can also run npx neonctl@latest init, which handles OAuth and configuration automatically.

Is the Neon MCP server hosted or self-hosted?

Both. Neon officially hosts a remote server at https://mcp.neon.tech/mcp that you connect to via OAuth with no local install. You can also self-host the open-source server from the neondatabase/mcp-server-neon repository.

Can the agent write data or is it read-only?

It supports both reads and writes. The agent can run arbitrary SQL (including INSERT, UPDATE, DELETE) and execute DDL migrations. Scope safety by creating branches — the agent works on the branch while production stays untouched.

Does branching cost extra on Neon?

Neon branches are copy-on-write, so they start at zero additional storage cost and only grow as the branch diverges from its parent. Compute is billed per active hour. Check Neon's pricing page for current free-tier limits.

Can I use the Neon MCP server with multiple projects?

Yes. The server authenticates against your Neon account, which can contain multiple projects. Tools like list_projects and describe_project let the agent navigate across all of them.

What happens to branches the agent creates?

Branches persist until explicitly deleted (by the agent or in the Neon console). For ephemeral use cases like CI or PR previews, have the agent call delete_branch when the branch is no longer needed to avoid unnecessary compute charges.