Neon MCP server

Manage Neon's serverless Postgres databases.
Back to servers
Setup instructions
Provider
Neon
Release date
Nov 29, 2024
Language
TypeScript
Stats
349 stars

Neon MCP Server allows you to interact with your Neon Postgres databases using natural language. This bridge between conversational commands and the Neon API lets you create projects, manage databases, run queries, and perform migrations without writing SQL or API calls directly.

Installation Options

You have two ways to set up the Neon MCP Server:

Prerequisites

For local installation, you'll also need a Neon API key from the Neon API Keys documentation.

Option 1: Remote Hosted MCP Server (Preview)

This method uses OAuth authentication with Neon's managed server:

  1. Add this "Neon" entry to your client's MCP server configuration file:
{
  "mcpServers": {
    "Neon": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.neon.tech/sse"]
    }
  }
}
  1. Save the configuration file
  2. Restart your MCP client
  3. An OAuth window will open in your browser - follow the prompts to authorize access

Option 2: Local MCP Server

Setup via Smithery

npx -y @smithery/cli@latest install neon --client <client_name>

Replace <client_name> with your MCP client (claude, cursor, windsurf, roo-cline, witsy, enconvo, or vscode). You'll be prompted to enter your Neon API key.

Setup via npm

Add this to your client's mcp_config file:

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

Troubleshooting

For clients not using JSON configuration, use:

npx -y @neondatabase/mcp-server-neon start <YOUR_NEON_API_KEY>

Windows Troubleshooting

If using Windows, try these configuration alternatives:

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

Or with WSL:

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

Usage and Features

The Neon MCP Server provides tools for:

Project Management

  • List projects in your account
  • Create new projects
  • Get details about specific projects
  • Delete existing projects

Branch Management

  • Create and delete branches
  • Get branch details
  • List branch compute endpoints

SQL Execution

  • Run SQL queries on your databases
  • Execute SQL transactions
  • Get connection strings
  • List database tables
  • Describe table schemas
  • Identify slow queries

Database Migrations

  • Prepare migrations (creating temporary branches for testing)
  • Complete migrations (applying changes to main branch)

Query Optimization

  • Explain SQL statements for performance analysis
  • Prepare and test query tuning
  • Apply optimizations after testing

Example Commands

Once connected, you can use natural language in your MCP client to:

  • "Create a new Postgres database called 'my-database' with a users table that has id, name, email, and password columns"
  • "Run a migration on my project 'my-project' to add a 'created_at' column to the users table"
  • "Give me a summary of all my Neon projects and what data is in each one"

For more detailed guides on using Neon MCP Server with specific clients, check the guides at neon.tech/docs/ai/neon-mcp-server.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "Neon" '{"command":"npx","args":["-y","mcp-remote","https://mcp.neon.tech/sse"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "Neon": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-remote",
                "https://mcp.neon.tech/sse"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "Neon": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-remote",
                "https://mcp.neon.tech/sse"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later