Neon

Connect AI Agents to
Neon

Automate workflows and connect AI agents to Neon. Metorial is built for developers. Handling OAuth, compliance, observability, and more.

Neon on Metorial

The Neon integration lets you manage your serverless Postgres databases directly through AI conversations, enabling you to create projects, query database schemas, execute SQL commands, and monitor database usage without leaving your workflow.

Deploy on Metorial

Combine Neon with other tools

Metorial has 600+ integrations available. Here are some related ones you might find interesting.

Exa

Exa

The Exa integration lets you perform semantic searches across the web and retrieve high-quality content directly within your workflows, enabling AI agents to find and access relevant information from billions of web pages in real-time.

Hackernews

Hackernews

The Hackernews integration lets you fetch and analyze stories, comments, and user data from Hacker News directly within your workflow, enabling you to track trending topics, monitor discussions, and gather insights from the tech community.

Supabase

Supabase

The Supabase integration lets you query and manipulate your database tables, manage authentication, and interact with storage buckets directly from your AI assistant. Use it to build applications, analyze data, or automate database operations without leaving your workflow.

GitHub

GitHub

The GitHub integration lets you search and view repositories, manage issues and pull requests, read file contents, and interact with your GitHub account directly from your workspace.

Brave

Brave

The Brave integration lets you perform web searches using Brave Search directly from Claude, allowing you to retrieve up-to-date information, news, and web results without leaving your conversation.

Hugging Face

Hugging Face

The Hugging Face integration lets you search and explore models, datasets, and Spaces directly from your development environment, making it easy to discover the right pre-trained models and resources for your machine learning projects.

Tavily

Tavily

The Tavily integration lets you perform AI-optimized web searches and retrieve real-time information directly within your workflow, enabling your AI assistant to access current data and research capabilities for answering questions and gathering insights.

Neon

Neon

The Neon integration lets you manage your serverless Postgres databases directly through AI conversations, enabling you to create projects, query database schemas, execute SQL commands, and monitor database usage without leaving your workflow.

Linear

Linear

The Linear integration lets you manage issues, projects, and teams directly from your workflow, enabling you to create, update, search, and track work items without leaving your current context.

Connect anything. Anywhere.

Supported tools and capabilities

Metorial helps you connect AI agents to Neon with various tools and resources. Tools allow you to interact with perform specific actions, while resources provide read-only access to data and information.

list_projects

list_projects

Lists the first 10 Neon projects in your account. If you can't find the project, increase the limit by passing a higher value to the `limit` parameter. Optionally filter by project name or ID using the `search` parameter.

list_organizations

list_organizations

Lists all organizations that the current user has access to. Optionally filter by organization name or ID using the `search` parameter.

list_shared_projects

list_shared_projects

Lists projects that have been shared with the current user. These are projects that the user has been granted access to collaborate on. Optionally filter by project name or ID using the `search` parameter.

create_project

create_project

Create a new Neon project. If someone is trying to create a database, use this tool.

delete_project

delete_project

Delete a Neon project

describe_project

describe_project

Describes a Neon project

run_sql

run_sql

<use_case> Use this tool to execute a single SQL statement against a Neon database. </use_case> <important_notes> If you have a temporary branch from a prior step, you MUST: 1. Pass the branch ID to this tool unless explicitly told otherwise 2. Tell the user that you are using the temporary branch with ID [branch_id] </important_notes>

run_sql_transaction

run_sql_transaction

<use_case> Use this tool to execute a SQL transaction against a Neon database, should be used for multiple SQL statements. </use_case> <important_notes> If you have a temporary branch from a prior step, you MUST: 1. Pass the branch ID to this tool unless explicitly told otherwise 2. Tell the user that you are using the temporary branch with ID [branch_id] </important_notes>

describe_table_schema

describe_table_schema

Describe the schema of a table in a Neon database

get_database_tables

get_database_tables

Get all tables in a Neon database

create_branch

create_branch

Create a branch in a Neon project

prepare_database_migration

prepare_database_migration

<use_case> This tool performs database schema migrations by automatically generating and executing DDL statements. Supported operations: CREATE operations: - Add new columns (e.g., "Add email column to users table") - Create new tables (e.g., "Create posts table with title and content columns") - Add constraints (e.g., "Add unique constraint on `users.email`") ALTER operations: - Modify column types (e.g., "Change posts.views to bigint") - Rename columns (e.g., "Rename user_name to username in users table") - Add/modify indexes (e.g., "Add index on `posts.title`") - Add/modify foreign keys (e.g., "Add foreign key from `posts.user_id` to `users.id`") DROP operations: - Remove columns (e.g., "Drop temporary_field from users table") - Drop tables (e.g., "Drop the old_logs table") - Remove constraints (e.g., "Remove unique constraint from posts.slug") The tool will: 1. Parse your natural language request 2. Generate appropriate SQL 3. Execute in a temporary branch for safety 4. Verify the changes before applying to main branch Project ID and database name will be automatically extracted from your request. If the database name is not provided, the default neondb or first available database is used. </use_case> <workflow> 1. Creates a temporary branch 2. Applies the migration SQL in that branch 3. Returns migration details for verification </workflow> <important_notes> After executing this tool, you MUST: 1. Test the migration in the temporary branch using the `run_sql` tool 2. Ask for confirmation before proceeding 3. Use `complete_database_migration` tool to apply changes to main branch </important_notes> <example> For a migration like: ```sql ALTER TABLE users ADD COLUMN last_login TIMESTAMP; ``` You should test it with: ```sql SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'users' AND column_name = 'last_login'; ``` You can use `run_sql` to test the migration in the temporary branch that this tool creates. </example> <next_steps> After executing this tool, you MUST follow these steps: 1. Use `run_sql` to verify changes on temporary branch 2. Follow these instructions to respond to the client: <response_instructions> <instructions> Provide a brief confirmation of the requested change and ask for migration commit approval. You MUST include ALL of the following fields in your response: - Migration ID (this is required for commit and must be shown first) - Temporary Branch Name (always include exact branch name) - Temporary Branch ID (always include exact ID) - Migration Result (include brief success/failure status) Even if some fields are missing from the tool's response, use placeholders like "not provided" rather than omitting fields. </instructions> <do_not_include> IMPORTANT: Your response MUST NOT contain ANY technical implementation details such as: - Data types (e.g., DO NOT mention if a column is boolean, varchar, timestamp, etc.) - Column specifications or properties - SQL syntax or statements - Constraint definitions or rules - Default values - Index types - Foreign key specifications Keep the response focused ONLY on confirming the high-level change and requesting approval. <example> INCORRECT: "I've added a boolean `is_published` column to the `posts` table..." CORRECT: "I've added the `is_published` column to the `posts` table..." </example> </do_not_include> <example> I've verified that [requested change] has been successfully applied to a temporary branch. Would you like to commit the migration `[migration_id]` to the main branch? Migration Details: - Migration ID (required for commit) - Temporary Branch Name - Temporary Branch ID - Migration Result </example> </response_instructions> 3. If approved, use `complete_database_migration` tool with the `migration_id` </next_steps> <error_handling> On error, the tool will: 1. Automatically attempt ONE retry of the exact same operation 2. If the retry fails: - Terminate execution - Return error details - DO NOT attempt any other tools or alternatives Error response will include: - Original error details - Confirmation that retry was attempted - Final error state Important: After a failed retry, you must terminate the current flow completely. Do not attempt to use alternative tools or workarounds. </error_handling>

Help & Documentation

Find guides and articles to help you get started with Neon on Metorial.

More about Neon

Neon MCP Server

A comprehensive Model Context Protocol (MCP) server for managing Neon serverless Postgres databases. This server provides AI assistants with complete control over Neon projects, enabling database creation, schema migrations, query optimization, authentication provisioning, and more—all through natural language interactions.

The Neon MCP server transforms complex database operations into simple conversational commands. Whether you're setting up a new project, tuning slow queries, or managing database migrations with confidence, this server acts as an intelligent database administrator that understands context and helps you make informed decisions.

Features

Project and Organization Management

Manage your entire Neon infrastructure with ease. The server provides comprehensive tools for discovering and organizing your database projects:

  • List and search projects across your account with intelligent filtering by name or ID
  • Browse organizations to understand your team structure and access permissions
  • View shared projects to see databases where you have collaborative access
  • Create new projects instantly, with optional organization assignment
  • Inspect project details to understand configuration and status
  • Clean up resources by deleting projects when they're no longer needed

Database Operations

Execute SQL with confidence using intelligent query execution tools:

  • Single statement execution for quick queries and data retrieval
  • Transaction support for running multiple statements atomically
  • Schema inspection to understand table structures and relationships
  • Database exploration to list all tables and objects in your database
  • Connection string generation with automatic configuration of branches, roles, and compute endpoints

Safe Schema Migrations

The server implements a sophisticated migration workflow that eliminates the risk of breaking production databases:

Prepare migrations by describing changes in natural language. The system automatically generates DDL statements, creates a temporary branch, and applies changes there first. You can request operations like:

  • Adding new columns or tables
  • Modifying column types
  • Creating indexes and constraints
  • Renaming database objects
  • Dropping unnecessary elements

Verify changes on the temporary branch before they touch production. The server encourages testing and provides detailed feedback about what will change.

Complete migrations by applying verified changes to your main branch or discarding them if something isn't right. The temporary branch is automatically cleaned up.

The migration process includes automatic retry logic and comprehensive error handling to ensure your database remains stable.

Intelligent Query Performance Tuning

Transform slow queries into fast ones with AI-powered optimization:

The query tuning workflow analyzes your SQL statements, identifies performance bottlenecks, and suggests concrete improvements. The server:

  • Creates a safe testing environment in a temporary branch
  • Extracts query execution plans to understand current performance
  • Analyzes all referenced tables and their schemas
  • Suggests optimizations like index creation or query restructuring
  • Applies changes to the test branch for validation
  • Compares before and after performance metrics
  • Applies approved changes to production or discards unsuccessful experiments

The system provides detailed cost analysis and execution time comparisons, helping you make data-driven decisions about query optimization.

Branch Management

Leverage Neon's powerful branching capabilities for development workflows:

  • Create branches instantly from any point in time
  • Describe branch contents to see the complete object hierarchy
  • Reset branches to match their parent state, with optional preservation of current changes
  • Delete branches when they're no longer needed
  • List compute endpoints to understand available resources

Branches enable zero-downtime migrations, isolated development environments, and safe experimentation with database changes.

Authentication Provisioning

Set up complete authentication infrastructure with a single command:

The provision_neon_auth tool integrates Stack Auth with your Neon database, creating:

  • A dedicated authentication schema
  • User tables synchronized with Stack Auth
  • Client and server credentials for your application

The server provides detailed guidance for integrating Stack Auth with Next.js applications, including setup commands, component usage patterns, and security best practices.

Advanced Capabilities

Slow Query Monitoring: Query the pg_stat_statements extension to identify queries consuming the most execution time. Filter by minimum duration and limit results to focus on the biggest problems.

Query Plan Analysis: Run EXPLAIN ANALYZE on any query to understand execution behavior, index usage, and performance characteristics.

Multiple Database Support: Work across different databases within your projects, with automatic fallback to default databases.

Role-Based Access: Execute queries with specific database roles for fine-grained permission control.

Available Tools

Project Management

list_projects - Retrieves up to 400 projects with pagination support. Filter by organization or search by name/ID using partial matches.

list_organizations - Shows all organizations accessible to the current user with optional search filtering.

list_shared_projects - Displays projects shared with you by other users, with pagination and search capabilities.

create_project - Provisions a new Neon project with optional name and organization assignment.

delete_project - Removes a project and all its resources permanently. Requires project ID.

describe_project - Provides detailed information about a specific project including configuration and status.

Query Execution

run_sql - Executes a single SQL statement against a specified database. Supports branch selection and custom database names.

run_sql_transaction - Runs multiple SQL statements in a single transaction for atomic operations.

explain_sql_statement - Generates query execution plans with optional ANALYZE for performance insights.

list_slow_queries - Identifies queries exceeding a specified execution time threshold, sorted by duration.

Schema Operations

describe_table_schema - Returns complete column information for a table including data types, constraints, and defaults.

get_database_tables - Lists all tables in a database across all schemas.

describe_branch - Provides a tree view of all objects in a branch: databases, schemas, tables, views, and functions.

Migration Management

prepare_database_migration - Initiates a safe migration workflow by creating a temporary branch and applying changes there. Accepts natural language descriptions of schema modifications.

complete_database_migration - Finalizes a migration by applying verified changes to the main branch or discarding them. Requires migration ID from preparation step.

Query Optimization

prepare_query_tuning - Analyzes a slow query, suggests performance improvements, and creates a testing environment for validation.

complete_query_tuning - Applies approved optimization changes to production or cleans up the testing branch. Requires tuning ID and suggested SQL statements.

Branch Operations

create_branch - Creates a new branch from the current state of a project with optional naming.

describe_branch - Explores the complete object hierarchy within a branch.

delete_branch - Removes a branch permanently. Requires project and branch IDs.

reset_from_parent - Resets a branch to match its parent's current state, with optional preservation of changes under a new name.

list_branch_computes - Shows compute endpoints associated with a project or specific branch.

Connection Management

get_connection_string - Generates a properly formatted PostgreSQL connection string with automatic parameter resolution for branches, roles, computes, and databases.

Authentication

provision_neon_auth - Sets up Stack Auth integration with your Neon database, creating authentication schemas and returning credentials for application integration.

Use Cases

This MCP server excels at:

  • Rapid prototyping where you need databases created and configured quickly
  • Safe production changes through the migration workflow with temporary branches
  • Performance troubleshooting by identifying and fixing slow queries
  • Development workflows using branches for isolation and testing
  • Multi-project management for teams working across multiple databases
  • Application setup with integrated authentication provisioning
  • Database exploration to understand existing schema and data structures

The conversational interface makes complex database operations accessible to developers at all skill levels while maintaining the safety and precision required for production systems.

Ready to build with Metorial?

Let's take your AI-powered applications to the next level, together.

About Metorial

Metorial provides developers with instant access to 600+ MCP servers for building AI agents that can interact with real-world tools and services. Built on MCP, Metorial simplifies agent tool integration by offering pre-configured connections to popular platforms like Google Drive, Slack, GitHub, Notion, and hundreds of other APIs. Our platform supports all major AI agent frameworks—including LangChain, AutoGen, CrewAI, and LangGraph—enabling developers to add tool calling capabilities to their agents in just a few lines of code. By eliminating the need for custom integration code, Metorial helps AI developers move from prototype to production faster while maintaining security and reliability. Whether you're building autonomous research agents, customer service bots, or workflow automation tools, Metorial's MCP server library provides the integrations you need to connect your agents to the real world.

Star us on GitHub