The Neon MCP Server allows you to connect various Model Context Protocol (MCP) compatible AI tools to your Neon Postgres databases. This guide provides instructions for connecting popular MCP clients to the Neon MCP Server, enabling natural language interaction with your Neon projects.
This guide covers the setup for the following MCP Clients:
- Claude Desktop
- Cursor
- Windsurf (Codeium)
- Cline (VS Code extension)
- Zed
- VS Code (with GitHub Copilot)
By connecting these tools to the Neon MCP Server, you can manage your Neon projects, databases, and schemas using natural language commands within the MCP client interface.
Prerequisites
- An MCP Client application.
- A Neon account.
- Node.js (>= v18.0.0) and npm: Download from nodejs.org.
For Local MCP Server setup, you also need a Neon API key. See Neon API Keys documentation.
note
Ensure you are using the latest version of your chosen MCP client as MCP integration may not be available in older versions. If you are using an older version, update your MCP client to the latest version.
Connect to Neon MCP Server
You can connect to Neon MCP Server in two ways:
- Remote MCP Server (Preview): Connect to Neon's managed remote MCP server using OAuth or a Neon API key.
- Local MCP Server: Install and run the Neon MCP server locally, using a Neon API key.
Claude Desktop
-
Open Claude desktop and navigate to Settings.
-
Under the Developer tab, click Edit Config (On Windows, it's under File -> Settings -> Developer -> Edit Config) to open the configuration file (
claude_desktop_config.json
). -
Add the "Neon" server entry within the
mcpServers
object:{ "mcpServers": { "Neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] } } }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
. -
Save the configuration file and restart Claude Desktop.
-
An OAuth window will open in your browser. Follow the prompts to authorize Claude Desktop to access your Neon account.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For more, see Get started with Neon MCP server with Claude Desktop.
Cursor
-
Open Cursor. Create a
.cursor
directory in your project root if needed. -
Create or open the
mcp.json
file in the.cursor
directory. -
Add the "Neon" server entry within the
mcpServers
object:{ "mcpServers": { "Neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] } } }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
. -
Save the configuration file. Cursor may detect the change or require a restart.
-
An OAuth window will open in your browser. Follow the prompts to authorize Cursor to access your Neon account.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For more, see Get started with Cursor and Neon Postgres MCP Server.
Windsurf (Codeium)
-
Open Windsurf and navigate to the Cascade assistant sidebar.
-
Click the hammer (MCP) icon, then Configure to open the configuration file (
~/.codeium/windsurf/mcp_config.json
). -
Add the "Neon" server entry within the
mcpServers
object:{ "mcpServers": { "Neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] } } }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
. -
Save the file.
-
Click the Refresh button in the Cascade sidebar next to "available MCP servers".
-
An OAuth window will open in your browser. Follow the prompts to authorize Windsurf to access your Neon account.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For more, see Get started with Windsurf and Neon Postgres MCP Server.
Cline (VS Code Extension)
- Open Cline in VS Code (Sidebar -> Cline icon).
- Click MCP Servers Icon -> Installed -> Configure MCP Servers to open the configuration file.
- Add the "Neon" server entry within the
mcpServers
object:{ "mcpServers": { "Neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] } } }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
.
- Save the file. Cline should reload the configuration automatically.
- An OAuth window will open in your browser. Follow the prompts to authorize Cline to access your Neon account.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For more, see Get started with Cline and Neon Postgres MCP Server.
Zed
note
MCP support in Zed is currently in preview. Ensure you're using the Preview version of Zed to add MCP servers (called Context Servers in Zed). Download the preview version from zed.dev/releases/preview.
-
Open the Zed Preview application.
-
Click the Assistant (✨) icon in the bottom right corner.
-
Click Settings in the top right panel of the Assistant.
-
In the Context Servers section, click + Add Context Server.
-
Configure the Neon Server:
-
Enter Neon in the Name field.
-
In the Command field, enter:
npx -y mcp-remote https://mcp.neon.tech/sse
-
Click Add Server.
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
. -
-
An OAuth window will open in your browser. Follow the prompts to authorize Zed to access your Neon account.
-
Check the Context Servers section in Zed settings to ensure the connection is successful. "Neon" should be listed.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For more details, including workflow examples and troubleshooting, see Get started with Zed and Neon Postgres MCP Server.
VS Code (with GitHub Copilot)
note
To use MCP servers with VS Code, you need GitHub Copilot and GitHub Copilot Chat extensions installed
-
Open VS Code.
-
Open your User Settings (JSON) file: Use the command palette (
Ctrl+Shift+P
orCmd+Shift+P
) and search for "Preferences: Open User Settings (JSON)". -
Add the Neon MCP server configuration to your
settings.json
file. If the"mcp.servers"
object doesn't exist, create it:{ // ... your other settings ... "mcp": { "servers": { "Neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] } } } // ... }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
. -
Save the
settings.json
file. -
Click on Start on the MCP server.
-
An OAuth window will open in your browser. Follow the prompts to authorize VS Code (GitHub Copilot) to access your Neon account.
-
Once authorized, you can now open GitHub Copilot Chat in VS Code and switch to Agent mode. You will see the Neon MCP Server listed among the available tools.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
For detailed instructions on utilizing the Neon MCP server with GitHub Copilot in VS Code, including a step-by-step example on generating an Azure Function REST API, refer to How to Use Neon MCP Server with GitHub Copilot in VS Code.
Other MCP clients
Adapt the instructions above for other clients:
-
Remote MCP server: Add the following JSON configuration within the
mcpServers
section of your client'sMCP
configuration file:"neon": { "command": "npx", "args": ["-y", "mcp-remote@latest", "https://mcp.neon.tech/sse"] }
For streamable HTTP responses instead of SSE, you can specify the
https://mcp.neon.tech/mcp
endpoint instead ofhttps://mcp.neon.tech/sse
.Then follow the OAuth flow on first connection.
If you prefer to authenticate using a Neon API key, see API key-based authentication.
-
Local MCP server: Use the Smithery command:
npx -y @smithery/cli@latest install neon --client <client_name> --config "{\"neonApiKey\":\"YOUR_NEON_API_KEY\"}"
Replace
YOUR_NEON_API_KEY
with your actual Neon API key. Replace<client_name>
with the name of your MCP client application. Supported client names include:claude
for Claude Desktopcursor
for Cursor (Installing viasmithery
makes the MCP server a global MCP server in Cursor)windsurf
for Windsurf Editorroo-cline
for Roo Cline VS Code extensionwitsy
for Witsyenconvo
for Enconvovscode
for Visual Studio Code (Preview)
If your MCP client is not listed here, you can manually add the Neon MCP Server details to your client's mcp_config
file. The specific configuration varies slightly depending on your operating system.
For MacOS and Linux, add the following JSON configuration within the mcpServers
section of your client's mcp_config
file, replacing <YOUR_NEON_API_KEY>
with your actual Neon API key:
"neon": {
"command": "npx",
"args": ["-y", "@neondatabase/mcp-server-neon", "start", "<YOUR_NEON_API_KEY>"]
}
Replace <YOUR_NEON_API_KEY>
with your Neon API key.
note
After successful configuration, you should see the Neon MCP Server listed as active in your MCP client's settings or tool list. You can enter "List my Neon projects" in the MCP client to see your Neon projects and verify the connection.
Troubleshooting
Configuration Issues
If your client does not use JSON
for configuration of MCP servers (such as older versions of Cursor), you can use the following command when prompted:
# For Remote MCP server
npx -y mcp-remote https://mcp.neon.tech/sse
# For Local MCP server
npx -y @neondatabase/mcp-server-neon start <YOUR_NEON_API_KEY>
OAuth Authentication Errors
When using the remote MCP server with OAuth authentication, you might encounter the following error:
{"code":"invalid_request","error":"invalid redirect uri"}
This typically occurs when there are issues with cached OAuth credentials. To resolve this:
- Remove the MCP authentication cache directory:
rm -rf ~/.mcp-auth
- Restart your MCP client application
- The OAuth flow will start fresh, allowing you to properly authenticate
This error is most common when using the remote MCP server option and can occur after OAuth configuration changes or when cached credentials become invalid.
Next steps
Once connected, you can start interacting with your Neon Postgres databases using natural language commands within your chosen MCP client. Explore the Supported Actions (Tools) of the Neon MCP Server to understand the available functionalities.
Resources
- MCP Protocol
- Neon API Reference
- Neon API Keys
- Neon MCP server GitHub
- VS Code MCP Server Documentation
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more details, see Getting Support.