Announcing CIMD support for MCP Client registration
Learn more

Neon MCP vs Neon API for AI Agents (2026)

TL;DR

  • Neon MCP and the Neon API cover overlapping but not identical ground. The hosted MCP server runs SQL, schema migrations, branch operations, query tuning, and read-only diagnostics through natural language; the REST API is a control plane for projects, branches, compute, roles, and databases, and it does not execute arbitrary SQL against your data.
  • Auth diverges. The MCP path uses OAuth (browser consent) or a Neon API key in a Bearer header; the REST API authenticates with scoped API keys that are personal, organization, or project level. Your credential model changes with the path you pick.
  • Neon itself recommends MCP for development and testing only, not production databases. The reason is blast radius: an LLM holding neonmcp_run_sql against a production branch is a data-plane risk, not a convenience.
  • For multi-tenant B2B agents, neither path hands you a token vault, proactive rotation, or per-user revocation. That is N credentials to store, refresh, and revoke, whichever path you chose.
  • Scalekit's Neon connector resolves a per-user connected account on every execute_tool call, keeps credentials out of the agent runtime, and lets a Virtual MCP server expose only the tools a given agent role should see, so the MCP path becomes production-grade and the MCP-versus-API decision stops dictating your auth infrastructure.

Your agent needs to talk to Neon. Neon ships a hosted MCP server that speaks natural language and a REST API you have probably scripted against before. They are not two doors to the same room. One runs SQL and manages branches through an LLM; the other is a control plane for projects, branches, and compute. They put you on different auth paths and carry very different blast radii in production. Here is how to choose.

What Neon MCP and Neon API actually are

Both surfaces sit in front of the same serverless Postgres platform. What differs is who they were built for: the MCP server targets an LLM, the REST API targets your code. Establish the two objects before comparing them.

The Neon MCP server

The Neon MCP server is Neon's official, open-source implementation, exposed as a hosted remote server at https://mcp.neon.tech/mcp over Streamable HTTP. It authenticates with OAuth (a browser consent flow, where you can pick read-only scope) or a Neon API key passed in the Authorization header for headless use. It is an official Claude connector, and it groups its tools into twelve categories spanning projects, branches, compute endpoints, snapshots, schema, SQL, Managed Better Auth, the Data API, observability, docs, functions, and object storage. The details are on the official Neon MCP server page.

The dev-and-testing recommendation

One line in Neon's own documentation shapes this entire decision. Neon recommends MCP for development and testing only, and advises against connecting MCP agents to production databases. That is not boilerplate. The server grants broad database management capabilities, and it asks you to review and authorize every LLM-requested action before it runs. Treat that recommendation as a design constraint, not a disclaimer you can skip past.

The Neon API

The Neon API is a REST control plane at https://console.neon.tech/api/v2, authenticated with Bearer API keys; the CLI adds a browser OAuth option through neon auth. It manages projects, branches, compute endpoints, Postgres roles, databases, operations, and consumption. It does not run arbitrary SQL against your data: query execution happens over a Postgres connection, the serverless driver, or the separate Data API. Rate limits are 700 requests per minute per account, with bursts to 40 per second per route. The full surface is documented on the official Neon API reference.

Comparing them where it matters for agents

The comparison that matters is not feature counts; it is what your production agent can do, under whose identity, and who owns the failure modes. Four dimensions carry it: capability coverage, the auth path, per-user isolation, and operational ownership.

What your agent can actually do

The MCP server owns the data plane and the developer-workflow surface. The REST API owns the control plane and the operational surface the MCP server leaves alone.

Capability
Neon MCP
Neon API
Run SQL queries and transactions against data
Yes
No (use a Postgres connection or the Data API)
Create, reset, and delete branches
Yes
Yes
Create and delete projects
Yes
Yes
Schema migrations on a temporary branch
Yes
Manual (create a branch, then run DDL yourself)
Slow-query analysis and query tuning
Yes
No (query pg_stat_statements yourself)
Read-only diagnostics via inspect_database (15 checks)
Yes
No (run catalog SQL yourself)
Query function and storage logs
Yes (beta, single region)
Not exposed
Manage compute endpoints (start, suspend, restart)
Yes
Yes
Manage Postgres roles and databases
Yes
Yes
Consumption and billing metrics
No
Yes
Programmatic API key management
No
Yes
LLM-native tool schemas, no schema-writing
Yes
No (you author request and response handling)

The control plane and the data plane

This is the split that makes Neon different from a Slack or Notion comparison. The REST API is almost entirely control plane: it provisions and configures, but it never sees a SELECT. To read or write rows through the API path, you open a Postgres connection or enable the Data API and query that. The MCP server collapses both planes into one natural-language surface; neonmcp_run_sql opens a connection on your behalf and returns rows, while neonmcp_create_branch calls the same control plane the REST API exposes. That unification is the MCP server's real advantage, and its real risk.

The auth path each one puts you on

The MCP path is OAuth-first. A user completes a browser consent flow, and by default the grant operates on that user's personal Neon account; acting on an organization's projects requires passing an org_id or project_id. A Neon API key in a Bearer header is the headless alternative on the same endpoint. The REST API path is API-key-first, and the keys are scoped: personal, organization, or project. Each key is shown once at creation, and revoking one takes effect immediately. Neither default is wrong; they simply hand you different credential shapes to manage.

Per-user isolation is on you either way

For a single developer, either path is fine. For a multi-tenant B2B agent, which is the default, the structural problem is identical on both paths. MCP OAuth gives you a token per user. Scoped API keys give you a key per user or per organization. In neither case does the path itself store the credential outside the agent runtime, rotate it before expiry, or revoke it when a customer churns or an employee is offboarded. The token type differs; the per-tenant isolation requirement does not.

What you own in production

With the MCP server, Neon owns the hosting, the tool schemas, and the endpoint. You still own token storage, refresh, revocation, and tenant isolation. You also own the blast radius: because the server can run SQL, a wrong tool call reaches your data, which is exactly why Neon scopes it to development. With the REST API, you own the full stack, endpoint selection, error handling, retries, pagination, and the API key lifecycle, but the surface is control plane, so a mistaken call reprovisions a branch rather than dropping a table. That difference in worst-case outcome is the heart of the decision.

When to use Neon MCP, when to use the Neon API

Use Neon MCP when:

  • You are building an interactive, developer-facing agent (a coding assistant, a branch-based test-and-migrate helper, an ad-hoc data question answerer) where a user is present to authorize and review actions.
  • Your workflow is branch-scoped and disposable: spin up a branch, run migrations or a test suite against it, report, and reset. Isolated environments keep the blast radius off production.
  • You want diagnostics, query tuning, and slow-query analysis as first-class tools instead of hand-written catalog SQL.
  • You are prototyping and do not want to author tool schemas or normalize responses yourself.

Use the Neon API when:

  • You are running a headless, deterministic pipeline: scheduled branch provisioning, automated project setup, or consumption reporting with no user in the loop.
  • You need control-plane surface the MCP server does not treat as first class: consumption metrics, programmatic API key management, or fine-grained endpoint lifecycle at scale.
  • You want a versioned, stable contract for high-volume automation rather than a natural-language tool layer that evolves as the server updates.
  • Your data-plane access should run through a pinned Postgres connection or the Data API, not through an LLM deciding which SQL to execute.

Recommended reading: MCP is up to 32× more expensive than CLI. Here's why we still use it. and Difference Between MCP and APIs work through the same tradeoffs for adjacent surfaces.

The credential problem that exists on both paths

Underneath the OAuth-versus-API-key divergence sits a single problem that neither path solves. It is the reason a database agent that demos cleanly still fails a security review months later.

What neither path hands you

Both paths produce a credential per user or per organization. Neither gives you a token vault, rotation logic, or a revocation flow. Storage has to live outside the agent runtime, encrypted at rest and isolated per tenant. Refresh has to be proactive, not reactive; waiting for a 401 to fire creates race conditions across concurrent agent threads. Revocation has to surface and invalidate every credential tied to a departing identity. In a multi-tenant product that is N credentials, each with its own lifecycle, and the path you chose only changes the token type.

Where Scalekit fits

Scalekit's Neon MCP connector resolves a per-user connected account on every tool call, so credentials never touch the agent runtime and every action is attributable to the user who authorized it. The same connected-account model handles storage, refresh, and revocation regardless of which path you build against. Note that Scalekit ships a single Neon connector, and it wraps the vendor MCP server; there is no separate REST connector, because the connected-account layer is what makes the MCP path safe enough to use beyond a laptop.

Connecting Neon with Scalekit

Scalekit's connector, neonmcp, exposes 35 LLM-optimized Neon tools behind OAuth 2.1 with Dynamic Client Registration (DCR). The pattern is always the same: resolve the current user, load only the tools their connected account is authorized to call, then execute. The sequence below follows that order.

Prerequisites

Install the SDK and set your credentials. The connection name you create in the Scalekit dashboard must match the string in your code, character for character; a mismatch is the most common reason list_scoped_tools returns nothing.

pip install scalekit-sdk-python anthropic # .env SCALEKIT_ENVIRONMENT_URL=https://your-env.scalekit.cloud SCALEKIT_CLIENT_ID=skc_... SCALEKIT_CLIENT_SECRET=test_... ANTHROPIC_API_KEY=sk-ant-...

Load the tools scoped to a user

The agent is not loading a flat Neon catalog. It is loading the tools this user's connected account is authorized to call, which is what separates a per-user agent from a shared-credential one. Resolve the identifier from your authenticated session, never from the client.

from scalekit.client import ScalekitClient from google.protobuf.json_format import MessageToDict from dotenv import find_dotenv, load_dotenv import anthropic import os load_dotenv(find_dotenv()) scalekit_client = ScalekitClient( client_id=os.getenv("SCALEKIT_CLIENT_ID"), client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"), env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"), ) actions = scalekit_client.actions identifier = "user_123" # from your authenticated session # 1. Ensure this user has an active Neon connection. account = actions.get_or_create_connected_account( connection_name="neonmcp", identifier=identifier, ) if account.connected_account.status != "ACTIVE": link = actions.get_authorization_link( connection_name="neonmcp", identifier=identifier ) print("Authorize Neon:", link.link) input("Press Enter after authorizing...") # 2. Retrieve the tools authorized for this connected account. # "neonmcp" must match the Connection name in your Scalekit dashboard, exactly. scoped_response, _ = actions.tools.list_scoped_tools( identifier=identifier, filter={"connection_names": ["neonmcp"]}, page_size=100, ) neon_tools = [ { "name": MessageToDict(t.tool).get("definition", {}).get("name"), "description": MessageToDict(t.tool).get("definition", {}).get("description", ""), "input_schema": MessageToDict(t.tool).get("definition", {}).get("input_schema", {}), } for t in scoped_response.tools ] print(f"Loaded {len(neon_tools)} Neon tools for {identifier}")

Run the agent loop with the Claude Agent SDK

The tool definitions come back in Anthropic's native format, so they pass straight into client.messages.create. When Claude emits a tool_use block, execute_tool runs it under the user's connected account; Scalekit looks up the stored token and makes the real Neon call.

client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY")) messages = [ {"role": "user", "content": "Create a branch called agent-sandbox, then list its tables."} ] while True: response = client.messages.create( model=os.getenv("ANTHROPIC_MODEL", "claude-sonnet-4-6"), max_tokens=1024, tools=neon_tools, messages=messages, ) if response.stop_reason == "end_turn": print(response.content[0].text) break tool_results = [] for block in response.content: if block.type == "tool_use": print(f" -> {block.name}") # e.g. neonmcp_create_branch try: result = actions.execute_tool( tool_name=block.name, identifier=identifier, tool_input=block.input, ) content = str(result.data) except Exception as e: content = f"Error: {e}" tool_results.append({ "type": "tool_result", "tool_use_id": block.id, "content": content, }) messages.append({"role": "assistant", "content": response.content}) messages.append({"role": "user", "content": tool_results})

The same pattern in LangChain

If you are on LangChain or LangGraph, the adapter returns tools already bound to one user's connected account. Instantiate them per request so a revoked grant is never served from a stale, module-level cache.

from langgraph.prebuilt import create_react_agent from langchain_anthropic import ChatAnthropic def neon_tools_for(identifier: str): # Scoped to this user's connected account; each tool is bound to their credentials. return actions.langchain.get_tools( identifier=identifier, connection_names=["neonmcp"], tool_names=[ "neonmcp_run_sql", "neonmcp_get_database_tables", "neonmcp_list_slow_queries", ], page_size=50, ) llm = ChatAnthropic(model="claude-sonnet-4-6") agent = create_react_agent(llm, neon_tools_for("user_123")) result = agent.invoke( {"messages": [("user", "Which queries on my default branch are slowest?")]} )

Scope the blast radius with a Virtual MCP

Neon's warning about production is really a warning about tool surface: a summarizer agent does not need neonmcp_delete_project. The tool_names filter above already narrows the surface, and a Virtual MCP server makes that structural. You define one server per agent role, declaring exactly which tools it can see, and each run receives a short-lived session token scoped to that user's connected accounts. A read-only analytics agent gets neonmcp_run_sql, neonmcp_inspect_database, and neonmcp_get_database_tables; a migration agent gets the branch and migration tools; neither sees the other's. One server definition serves every user, and there is no MCP server for you to deploy, host, or maintain. That is how the MCP path serves multi-tool, multi-tenant agents without inheriting the full connector's reach.

Observability for every tool call

Because each call runs under a resolved connected account, every downstream Neon action is attributable to a specific user rather than a shared service account. Scalekit's auth logs record the token and connection events behind those calls, and pairing them with agent tool-call logging gives you a queryable trail of who ran which tool against which branch. For a database agent, that trail is the difference between an audit you can answer and one you cannot.

Which one to build against

The decision is not about which surface is more capable; it is about worst-case outcome and who holds the credential.

The question that settles it

If your agent is developer-facing, branch-scoped, and used with a person present to authorize actions, the MCP path is the faster route, and Scalekit's connector plus a scoped Virtual MCP makes it safe past the prototype stage. If your agent is headless, deterministic, and control-plane heavy, or if it must run data-plane SQL through a pinned connection rather than an LLM, build against the REST API directly. Either way, the credential management problem is identical, and that is the part that needs production-grade auth infrastructure.

Build your Neon agent with Scalekit

Connect Neon once, then point an agent at a single user's scoped tools. Start from the Scalekit Neon MCP connector docs, browse the Neon connector overview, and compare plans on the pricing page. If you are building a database-touching agent, the DevOps assistant, incident response, and engineering standup templates are good starting points.

Building and have a question? Join the Scalekit community on Slack, or talk to an engineer for a walkthrough.

No items found.
Agent
Auth Quickstart
On this page
Share this article
Agent
Auth Quickstart

Acquire enterprise customers with
zero upfront cost.

Every feature unlocked. No hidden fees.