
MCP server for interacting with Neon Management API and databases
MCP server for interacting with Neon Management API and databases
·
Neon MCP Server is an open-source tool that lets you interact with your Lakebase Postgres databases on Neon in natural language.
The Model Context Protocol (MCP) is a standardized protocol designed to manage context between large language models (LLMs) and external systems. This repository provides a remote MCP Server for Neon.
Neon's MCP server acts as a bridge between natural language requests and the Neon API. Built upon MCP, it translates your requests into the necessary API calls, enabling you to manage tasks such as creating projects and branches, running queries, and performing database migrations seamlessly.
Some of the key features of the Neon MCP server include:
For example, in Claude Code, or any MCP Client, you can use natural language to accomplish things with Neon, such as:
Let's create a new Postgres database, and call it "my-database". Let's then create a table called users with the following columns: id, name, email, and password.I want to run a migration on my project called "my-project" that alters the users table to add a new column called "created_at".Can you give me a summary of all of my Neon projects and what data is in each one?[!WARNING]
Neon MCP Server Security Considerations
The Neon MCP Server grants powerful database management capabilities through natural language requests. Always review and authorize actions requested by the LLM before execution. Ensure that only authorized users and applications have access to the Neon MCP Server.The Neon MCP Server is intended for local development and IDE integrations only. We do not recommend using the Neon MCP Server in production environments. It can execute powerful operations that may lead to accidental or unauthorized changes.
For more information, see MCP security guidance →.
There are a few options for setting up the Neon MCP Server:
neon@latest init to automatically configure Neon's MCP Server, agent skills, and VS Code extension with one command.34.192.103.46 and 23.22.233.166 to your allowlist (mcp.neon.tech static IPs).For development, you'll need Node.js 22+ (pnpm is provided via Corepack — run corepack enable to activate it).
Don't want to manually create an API key?
Run neon@latest init to automatically configure Neon's MCP Server with one command:
npx neon@latest initThis works with Cursor, VS Code (GitHub Copilot), and Claude Code. It will authenticate via OAuth, create a Neon API key for you, and configure your editor automatically.
Connect to Neon's managed MCP server using OAuth for authentication. This is the easiest setup, requires no local installation of this server, and doesn't need a Neon API key configured in the client.
Run the following command to add the Neon MCP Server for all detected agents and editors in your workspace:
npx add-mcp "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema"That URL publishes projects, branches, compute endpoints, querying, and schema. Preview it with /api/list-tools?category=projects&category=branches&category=endpoints&category=querying&category=schema. The unfiltered URL publishes every category:
npx add-mcp https://mcp.neon.tech/mcpAdd the -g flag to add the Neon MCP Server to the global MCP server list instead of project-scoped.
Alternatively, you can add the following "Neon" entry to your client's MCP server configuration file (e.g., mcp.json, mcp_config.json):
{
"mcpServers": {
"Neon": {
"type": "http",
"url": "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema"
}
}
}Kiro: Add the following to your Kiro MCP config file (~/.kiro/settings/mcp.json for global, or .kiro/settings/mcp.json for project-scoped):
{
"mcpServers": {
"Neon": {
"url": "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema"
}
}
}Or use the one-click install button at the top of this README. For more information, see the Kiro MCP documentation.
With OAuth-based authentication, the MCP server will, by default, operate on projects under your personal Neon account. To access or manage projects that belong to an organization, you must explicitly provide either the
org_idor theproject_idin your prompt to MCP client.
Remote MCP Server also supports authentication using an API key in the Authorization header if your client supports it.
Create a Neon API key in the Neon Console. Next, run the following command to add the Neon MCP Server for all detected agents and editors in your workspace:
npx add-mcp "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema" --header "Authorization: Bearer <$NEON_API_KEY>"Alternatively, you can add the following "Neon" entry to your client's MCP server configuration file (e.g., mcp.json, mcp_config.json):
{
"mcpServers": {
"Neon": {
"type": "http",
"url": "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema",
"headers": {
"Authorization": "Bearer <$NEON_API_KEY>"
}
}
}
}Provide an organization's API key to limit access to projects under the organization only.
Neon MCP advertises OAuth scopes read and write. Your MCP client can request these, or you can make the selection in the OAuth permissions UI. * is treated as write if a client still sends it.
Read-only mode restricts which tools are available, disabling write operations like creating projects, branches, or running migrations. Read-only tools include listing projects, describing schemas, querying data, and viewing performance metrics.
You can set read-only mode in two ways:
readonly query param: Add ?readonly=true to your MCP server URL:{
"mcpServers": {
"Neon": {
"url": "https://mcp.neon.tech/mcp?readonly=true"
}
}
}How the query param behaves:
readonly=true is the way to enable read-only mode (there is no OAuth scope exchange in this flow).readonly=true overrides the OAuth scope. Without it, read-only is determined by the scope selected in the OAuth consent UI.Legacy HTTP header x-read-only is also supported as a fallback (lower priority than the query param).
Note: Read-only mode restricts which tools are available. Further, the
run_sqltool remains available only for read-only queries.
Grant context (scope categories, project scoping, read-only mode) is configured via URL query params on the MCP server URL. Config travels with every request and takes effect immediately — no re-auth needed.
| Param | Description | Example |
|---|---|---|
readonly | Enable read-only mode (true/false) | ?readonly=true |
category | Restrict to specific tool categories (repeated or CSV) | ?category=querying&category=schema |
projectId | Scope all operations to a single project | ?projectId=proj-123 |
Read-only + project-scoped example:
{
"mcpServers": {
"Neon": {
"url": "https://mcp.neon.tech/mcp?readonly=true&projectId=my-project-id"
}
}
}Category-filtered example (only querying and schema tools):
{
"mcpServers": {
"Neon": {
"url": "https://mcp.neon.tech/mcp?category=querying&category=schema"
}
}
}You can preview which tools are visible for any configuration using the /api/list-tools endpoint (no auth required):
curl "https://mcp.neon.tech/api/list-tools?readonly=true&category=querying"Host tools: list_organizations, describe_branch, run_sql, run_sql_transaction, get_database_tables, describe_table_schema, list_slow_queries, explain_sql_statement, inspect_database, get_neon_auth_config, search, fetch, list_docs_resources, get_doc_resource.
Generated Management API tools that are GET and do not return secrets, plus query_logs (POST, read-only). Preview the exact set with /api/list-tools?readonly=true.
Tools requiring write access:
create_project, create_branch, delete_project, …)get_connection_string (the connection string carries a privileged role password, so it is withheld in read-only mode; copy it from the Neon Console instead)prepare_database_migration, complete_database_migrationprepare_query_tuning, complete_query_tuningMCP supports two remote server transports: the deprecated Server-Sent Events (SSE) and the newer, recommended Streamable HTTP. If your LLM client doesn't support Streamable HTTP yet, you can switch the endpoint from https://mcp.neon.tech/mcp to https://mcp.neon.tech/sse to use SSE instead.
Run the following command to add the Neon MCP Server for all detected agents and editors in your workspace using the SSE transport:
npx add-mcp https://mcp.neon.tech/sse --type sseThe remote server runs as a Next.js App Router application on Vercel at mcp.neon.tech.
[!NOTE] The root
/path redirects to Neon MCP Server docs. There is no landing page.
Core implementation areas:
app/api/[transport]/route.ts: MCP transport endpoint for Streamable HTTP (/mcp) and SSE (/sse)app/api/authorize/, app/callback/, app/api/token/, app/api/revoke/: OAuth flow endpointsapp/.well-known/: OAuth discovery metadata endpointsmcp/: MCP server, tools, handlers, analytics, and Sentry integrationlib/: Next.js-compatible helpers (OAuth, configuration, error handling)mcp/utils/read-only.ts: read-only mode and scope handlingThe Neon MCP Server provides the following actions, which are exposed as "tools" to MCP Clients. You can use these tools to interact with your Neon projects and databases using natural language commands.
Each tool definition includes a scope category used for grant-based tool filtering and consent UX. Current categories are:
projectsbranchesendpointssnapshotsschemaqueryingneon_authdata_apiobservabilitydocsfunctionsstoragenull (tools without a scope category)Notes:
@neon/tools. Selectors are SDK paths (projects.list); published MCP names are verb-first (list_projects, delete_project, query_logs). Historical names stay where they already existed (describe_project, create_branch, reset_from_parent, compare_database_schema, provision_neon_auth, provision_neon_data_api, list_branch_computes).?category=branches includes branch, role, and database tools (list_postgres_roles, create_postgres_database, …). A token already issued for branches gains those writes. Compute listing is ?category=endpoints. Snapshot restore is ?category=snapshots.list_project_members and list_project_permissions are reads.?category=schema) are the host tools get_database_tables and describe_table_schema, plus generated compare_database_schema.readOnlySafe and server-side read-only logic; scope is category metadata, not a standalone read/write switch.?projectId=...), tools without a project path (list_projects, create_project, list_organizations, list_regions, search, fetch, …) are hidden. delete_project is also hidden.Project Management:
list_projects: Lists Neon projects. limit caps how many items come back.describe_project: Fetches a Neon project by id ({ "project_id": "…" }).create_project: Creates a Neon project and waits for the default compute. Does not return a connection string. Arguments are { "name": "…", "org_id": "…", "region_id": "…" }. Call get_connection_string after it succeeds.delete_project: Deletes an existing Neon project. Arguments are { "project_id": "…" }.list_organizations: Lists all organizations that the current user has access to. Optionally filter by organization name or ID using the search parameter.Branch Management:
list_branches: Lists branches in a project. Use it to resolve a branch name to a br-… id.create_branch: Creates a branch with a read-write compute and waits until it is ready. Does not return a connection string. Arguments are { "project_id": "…", "name": "feature-x" }. Pass no_compute: true to skip the endpoint. Call get_connection_string after it succeeds.reset_from_parent: Resets a branch to its parent's current HEAD ({ "project_id": "…", "branch_id": "br-…" }). Discards writes since the branch diverged. preserve_under_name is required when the branch has children; those children move to the new branch. Parent HEAD only; point-in-time restore is restore_snapshot.delete_branch: Deletes a branch ({ "project_id": "…", "branch_id": "br-…" }).describe_branch: Retrieves a tree of databases, schemas, tables, views, and functions on a branch.branch_id as a branch id (br-...), not a name.restore_snapshot: Restores a snapshot. Pass target_branch_id to restore onto an existing branch; omit it to create a new one.Compute endpoints (?category=endpoints):
list_postgres_endpoints, list_branch_computes, get_postgres_endpoint, create_postgres_endpoint, update_postgres_endpoint, delete_postgres_endpoint, start_postgres_endpoint, suspend_postgres_endpoint, restart_postgres_endpointSnapshots (?category=snapshots):
list_snapshots, get_snapshot_schedule, set_snapshot_schedule, create_snapshot, update_snapshot, delete_snapshot, restore_snapshotSchema (?category=schema):
get_database_tables, describe_table_schemacompare_database_schema: SQL schema diff of one database against another branch. database_name is required. Omitting base_branch_id compares against the parent. Optional lsn, timestamp, base_lsn, base_timestamp are point-in-time only.SQL Query Execution:
get_connection_string: Returns your database connection string.run_sql: Executes a single SQL query against a specified Neon database. Supports both read and write operations.run_sql_transaction: Executes a series of SQL queries within a single transaction against a Neon database.get_database_tables: Lists all tables within a specified Neon database.describe_table_schema: Retrieves the schema definition of a specific table, detailing columns, data types, and constraints.Database Migrations (Schema Changes):
prepare_database_migration: Initiates a database migration process. Critically, it creates a temporary branch to apply and test the migration safely before affecting the main branch.complete_database_migration: Finalizes and applies a prepared database migration to the main branch. This action merges changes from the temporary migration branch and cleans up temporary resources.SQL Querying and Optimization:
inspect_database: Runs one of 15 predefined read-only Postgres diagnostics against a branch — relation and index sizes, index and sequential-scan usage, active queries and locks, the heaviest and most frequent queries, cache hit rate and working-set size, autovacuum and bloat estimates, and replication state. Same checks as the neon inspect db CLI command. Omit database_name to cover every database on the branch; pass a name to inspect one. Four of them need the pg_stat_statements or neon extension.list_slow_queries: Identifies performance bottlenecks by finding the slowest queries in a database. Requires the pg_stat_statements extension.explain_sql_statement: Provides detailed execution plans for SQL queries to help identify performance bottlenecks.prepare_query_tuning: Analyzes query performance and suggests optimizations, like index creation. Creates a temporary branch for safely testing these optimizations.complete_query_tuning: Finalizes query tuning by either applying optimizations to the main branch or discarding them. Cleans up the temporary tuning branch.Neon Auth (?category=neon_auth):
provision_neon_auth, get_auth, disable_auth, update_auth_configget_neon_auth_config: host tool; secrets redacted. Use generated Auth write tools to change settings.list_auth_oauth_providers, add_auth_oauth_provider, update_auth_oauth_provider, delete_auth_oauth_providerlist_auth_trusted_domains, add_auth_trusted_domain, delete_auth_trusted_domaincreate_auth_user, delete_auth_user, update_auth_user_roleNeon Data API (?category=data_api):
provision_neon_data_api, get_data_api, update_data_api, delete_data_api: Manage the Data API for a branch database.Search and Discovery:
search: Searches across organizations, projects, and branches matching a query. Returns IDs, titles, and direct links to the Neon Console.fetch: Fetches detailed information about a specific organization, project, or branch using an ID (typically from the search tool).Observability (?category=observability): these tools require the Neon Platform Beta and are currently only available for projects in the aws-us-east-2 region. A branch without logs access returns HTTP 404 with reason telemetry_not_enabled.
query_logs: Queries OpenTelemetry logs for a branch. POST in the Management API; treated as read-only by this server.list_log_fields: Lists the log fields you can enumerate values for on a branch.list_log_field_values: Lists the distinct values of a log field within a branch and time window.Documentation and Resources (?category=docs):
list_docs_resources: Lists all available Neon documentation pages by fetching the index from https://neon.com/docs/llms.txt. Returns page URLs and titles that can be fetched individually using the get_doc_resource tool.get_doc_resource: Fetches a specific Neon documentation page as markdown content. Use the list_docs_resources tool first to discover available page slugs, then pass the slug to this tool.Functions (?category=functions):
list_functions, get_function, update_function, delete_function, deploy_functionlist_functions_custom_domains, register_functions_custom_domain, delete_functions_custom_domainStorage (?category=storage):
list_storage_buckets, create_storage_bucket, delete_storage_bucketlist_storage_objects, delete_storage_object, delete_storage_objects_by_prefixpresign_storage_object, get_storageMigrations are a way to manage changes to your database schema over time. With the Neon MCP server, LLMs are empowered to do migrations safely with separate "Start" (prepare_database_migration) and "Commit" (complete_database_migration) commands.
The "Start" command accepts a migration and runs it in a new temporary branch. Upon returning, this command hints to the LLM that it should test the migration on this branch. The LLM can then run the "Commit" command to apply the migration to the original branch.
This project uses pnpm as the package manager, pinned via Corepack.
The MCP server code lives at the repository root, a Next.js application deployed to Vercel at mcp.neon.tech.
corepack enable
pnpm installSee CONTRIBUTING.md for how to add tools. Tool arguments are snake_case.
# Start the Next.js dev server (for the remote MCP server)
pnpm devpnpm lint
pnpm typecheckRequired for remote server runtime:
| Variable | Description |
|---|---|
SERVER_HOST | Server URL (defaults to VERCEL_URL) |
UPSTREAM_OAUTH_HOST | Neon OAuth provider URL |
CLIENT_ID | OAuth client ID |
CLIENT_SECRET | OAuth client secret |
KV_URL | Vercel KV (Upstash Redis) URL |
OAUTH_DATABASE_URL | Postgres URL for token storage |
Optional:
| Variable | Description |
|---|---|
LOG_LEVEL | Winston log level: error, warn, info (default), debug, verbose, silly |
NEON_MCP_DISABLE_ANALYTICS | Set to 1 to disable product analytics |
All tests run from the repository root.
# Unit tests
pnpm test:unit
# Integration tests
pnpm test:integration
# MCP protocol end-to-end tests (real MCP client/server tool calls)
pnpm test:e2e:mcp
# Website end-to-end tests (Playwright; provisions/validates ephemeral DB first)
pnpm test:e2e:web
# Full end-to-end suite
pnpm test:e2e
# Full test pyramid (unit + integration + e2e; used in CI)
pnpm testTesting strategy:
Vercel deploys the remote server automatically from the repository branch configuration. Preview environments are available for pull requests.
The Neon MCP server collects product analytics and error reports to help us understand usage and improve reliability:
identify event with your Neon account ID, name, and email address. It also tracks session start (server_init), each tool call (tool_call), and unexpected server errors (server_error). A tool-call event includes the tool name, auth method, and client, not the tool arguments or query results. Docs-only tool calls without an account are tracked anonymously. Events go to track.neon.tech, Neon's own analytics endpoint.This collection is covered by the Neon Privacy Policy. To disable analytics when running the server yourself, set NEON_MCP_DISABLE_ANALYTICS=1. That flag does not disable Sentry.
Pick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add Neon --transport http https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema{
"mcpServers": {
"Neon": {
"url": "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema",
"type": "http"
}
}
}code --add-mcp '{"name":"Neon","url":"https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema","type":"http"}'Runs as a hosted service. Your client connects over the network and nothing is installed locally.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/neon-mcp-server to learn what the "Neon MCP Server" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
npx neon@latest init
npx add-mcp "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema"
npx add-mcp https://mcp.neon.tech/mcp
npx add-mcp "https://mcp.neon.tech/mcp?category=projects&category=branches&category=endpoints&category=querying&category=schema" --header "Authorization: Bearer <$NEON_API_KEY>"
npx add-mcp https://mcp.neon.tech/sse --type sseThis server runs locally, so we can't read its tool list over the web yet.
The Elasticsearch MCP Server connects your AI agents to Elasticsearch data using the Model Context P
The official Redis MCP Server is a natural language interface designed for agentic applications to m
No tagged releases on record.
Connect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "neon-mcp-server" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
The Elasticsearch MCP Server connects your AI agents to Elasticsearch data using the Model Context P
Databases
The official Redis MCP Server is a natural language interface designed for agentic applications to m
Databases
One email a week. New agents, MCP servers and skills, and what is actually getting traction.