Post image

Imagine an IDE that not only writes your code but also provisions, migrates, and queries your Postgres database. Stop imagining—this is possible today with Windsurf.

In this blog post, we will explore how Windsurf can be integrated with the Neon MCP server to allow agents to interact directly with your database. We’ll walk through an example where we build a simple Todo application using Next.js, Typescript, Drizzle ORM, and Neon, and then see how Cascade can iterate on the project, adding features and managing migrations without writing a line of code.

What is MCP?

If you’ve been anywhere near the internet lately, you probably know this by now. MCP, or the Model Context Protocol, is an open standard developed by Anthropic designed to help AI models integrate with and receive context from external data sources. Similar to how a USB port is a standardised way to connect with other devices, MCP is a standardised way for LLMs to connect with other services.

Post image

In our case today, Windsurf is set up as an MCP client, meaning it can send commands and interpret feedback from Neon, which acts as an MCP server, allowing Windsurf to securely interact with your Postgres database.

Setting up Neon MCP in Windsurf

The first step to manage databases from Windsurf is configuring Neon’s MCP server.

The process is simple: you’ll first need to head over to the Neon Console and grab an API key by going to Settings > API Keys > Create new API key, then naming the key anything you’d like and copying it to clipboard.

Next, boot up Windsurf and open up Cascade by hitting Ctrl + L, then hit configure MCP Server to open up your mcp_config.json and add the following:

  "mcpServers": {
    "neon": {
      "command": "npx",
      "args": [
"-y",
"@neondatabase/mcp-server-neon",
"start",
"<YOUR_NEON_API_KEY>"
]
    }
  }

If you’re more of a visual learner, follow this quick video to see how to set everything up in just 30 seconds!

Post image

Once you’ve done this, your Neon MCP server is up and running in Windsurf.

Using the Neon MCP Server to deploy databases with Cascade

Now, it’s time to put MCP into action. Let’s build a simple Todo application to demonstrate how smoothly Cascade interacts with Neon.

Open the Cascade AI Agent in Windsurf, then prompt it to:

Create a todo application using Next.js, Typescript, Drizzle ORM, Tailwind, and Neon Postgres.

Post image

As soon as the request is sent, Windsurf’s MCP Client kicks into gear.

Just as a developer would iteratively create an application, Cascade breaks the prompt down into a series of more clearly defined tasks, tackling them each one by one. In the case of our prompt, Cascade does the following :

  • Project initialization: Sets up the Next.js project, and all the npm packages that will be used
  • Database provisioning: Creates a new Neon Postgres database instance using the Neon MCP server
  • Schema creation: Designs and applies the schema directly to your database
  • API and UI generation: Creates the API routes, then connects those to the frontend components, and styles everything using Tailwind CSS

In just moments, your application has been taken from a single prompt into a working Next.js application connected to a Postgres database:

Post image

Adding features

After your Todo application is up and running, it’s time to take it a step further and add a feature.

We’ll instruct Cascade to integrate a priority label to the todos, and watch how it’s able to develop this feature, create a migration file, and apply it to the database using MCP. 

No more than 1 minute later, Cascade developed a plan and executed on it start to finish:

Post image

What’s more, if we look at the generated migration files, we can see Cascade created a custom enum type for priorities instead of just using plain text. This small detail shows the agent’s ability to generate clean and thoughtful schemas.

CREATE TYPE "public"."priority" AS ENUM('low', 'medium', 'high');
ALTER TABLE "todos" ADD COLUMN "priority" "priority" DEFAULT 'medium' NOT NULL;

And looking over in the Neon console, the database changes were successfully applied with the new priority column.

Post image

Wrap up

Using Windsurf together with Neon MCP makes database management accessible for any developer. Cascade can automatically provision Postgres databases, run schema migrations, execute queries, and more. This tight integration means your database remains completely synchronized with your application, guaranteeing consistency, while also reducing the amount of manual work you need to worry about.

If you haven’t tried Windsurf yet, get started with the Free plan!