This guide shows how to use Windsurf with the Neon MCP Server to manage your Neon databases.
Security
The Neon MCP Server grants broad database management capabilities. Always review and authorize actions requested by the LLM before execution. See MCP security guidance.
Setting up Neon MCP Server in Windsurf
Prerequisites
Make sure you have:
-
Codeium Windsurf Editor: Download and install Windsurf from codeium.com/windsurf.
-
A Neon Account and Project: You'll need a Neon account and a project. You can create a new Neon project in the Neon Console
-
Neon API Key (for Local MCP server): After signing up, get your Neon API Key from the Neon console. This API key is needed to authenticate your application with Neon. For instructions, see Manage API keys.
Neon API Key Security
Keep your Neon API key secure, and never share it publicly. It provides access to your Neon projects.
-
Node.js (>= v18) and npm: Ensure Node.js (version 18 or later) and npm are installed. Download them from nodejs.org.
Option 1: Setting up the Remote Hosted Neon MCP Server
You can either watch the video below or follow the steps to set up the Neon MCP server in Windsurf.
note
By default, the Remote MCP Server connects to your personal Neon account. To connect to an organization's account, you must authenticate with an API key. For more information, see API key-based authentication.
-
Open Windsurf.
-
Open Cascade by using
⌘Lon MacOS orCtrl+Lon Windows/Linux. -
Click on the plug icon (🔌), then click the "Configure" button.

-
This opens the MCP configuration file.
-
Add the "Neon" server entry within the
mcpServersobject:{ "mcpServers": { "Neon": { "url": "https://mcp.neon.tech/mcp" } } }If you have other MCP servers configured, you can copy just the Neon part.
-
Save the MCP configuration file.
-
An OAuth window will open in your browser. Follow the prompts to authorize Windsurf to access your Neon account.

-
Check the toolbar to confirm Neon appears in your MCP servers.

Troubleshooting OAuth Errors
If you encounter an error message like {"code":"invalid_request","error":"invalid redirect uri"} when starting Windsurf with the remote MCP server, this is typically due to cached OAuth credentials. To fix this issue:
- Remove the MCP authentication cache by running:
rm -rf ~/.mcp-auth - Restart Windsurf
- The OAuth flow will start fresh, allowing you to properly authenticate
This error commonly occurs when there are changes to the OAuth configuration or when cached credentials become invalid.
Option 2: Setting up the Local Neon MCP Server
This method runs the Neon MCP server locally on your machine, using a Neon API key for authentication.
-
Open Windsurf.
-
Open Cascade by using
⌘Lon MacOS orCtrl+Lon Windows/Linux. -
Click on the hammer icon (🔨), then click the "Configure" button.

-
This opens the Cascade MCP settings panel.
-
Click View raw config to edit the JSON directly.
-
Add the "Neon" server entry within the
mcpServersobject:{ "mcpServers": { "Neon": { "command": "npx", "args": ["-y", "@neondatabase/mcp-server-neon", "start", "<YOUR_NEON_API_KEY>"] } } }Replace
<YOUR_NEON_API_KEY>with your actual Neon API key which you obtained from the prerequisites section:If you have other MCP servers configured, you can copy just the
Neonpart. -
Save the MCP configuration file.
-
Check the toolbar to confirm Neon appears in your MCP servers.

For a full list of available tools, see available tools in the Neon MCP Server overview.
Development Workflow: Adding a Column with Windsurf and Neon MCP
Here's an example interaction adding a created_at column to a table:
User: in my neon project id: fancy-bush-59303206, list all the tables
Cascade: I'll help you list all the tables in your Neon project. I'll use the default database name 'neondb' since it wasn't specified.
> MCP Tool: neon / get_database_tables
> I found 1 table in your Neon project:
> - playing_with_neon (in the public schema)
> Would you like to see more details about this table or perform any operations on it?
User: can you show me first 5 rows?
Cascade: I'll query the first 5 rows from the playing_with_neon table.
> MCP Tool: neon / run_sql
> Here are the first 5 rows from the table. The table has three columns:
> id: An integer identifier
> name: A string column containing what appears to be hash-like values
> value: A numeric column with decimal values between 0 and 1
> Would you like to perform any other operations on this table?
User: can you add created_at column?
Cascade: I'll help you add a created_at column to the playing_with_neon table. I'll create a migration to add this column with a timestamp data type.
> MCP Tool: neon / prepare_database_migration
> Let me verify the changes in the temporary branch to make sure the column was added correctly.
> I've verified that the created_at column has been added successfully in the temporary branch. Would you like me to commit this migration to the production branch?
> The migration has been completed successfully! The created_at column has been added to the playing_with_neon table. Let's verify the change in the production branch:
> Perfect! The created_at column has been successfully added and populated with timestamps. For existing rows, it was set to the time when the column was added. Any new rows added to the table will automatically get their creation timestamp.You can verify the changes in your Neon Console or by querying the database directly.

note
While the Neon MCP server allows you to use all of Neon's functionalities, you can also use a generic Postgres MCP server to connect to Neon.
Resources
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. For paid plan support options, see Support.








