Automate workflows and connect AI agents to Neon. Metorial is built for developers. Handling OAuth, compliance, observability, and more.
The Neon integration lets you connect to your Neon Postgres databases to query data, inspect schemas, and manage database operations directly from your AI assistant.
Metorial has 600+ integrations available. Here are some related ones you might find interesting.
The Hackernews integration lets you search and retrieve stories, comments, and user data from Hackernews directly within your workflow, enabling you to analyze trends, monitor discussions, and gather insights from the tech community.
The Exa integration lets you search the web using neural search capabilities and retrieve high-quality, AI-ready content directly within your MCP-enabled applications.
The Google Drive integration lets you search, read, create, and manage files and folders in your Drive directly through AI interactions. Use it to organize documents, retrieve file contents, share files, and automate common Drive tasks without switching to your browser.
The Neon integration lets you connect to your Neon Postgres databases to query data, inspect schemas, and manage database operations directly from your AI assistant.
The Supabase integration lets you query and manage your database, authentication, and storage directly from your AI assistant, enabling natural language database operations and real-time data access.
The Linear integration lets you create, update, and search issues directly from your workspace, enabling seamless project management and task tracking without leaving your development environment.
The Gmail integration lets you read, send, and manage emails directly from your workspace, enabling you to automate email workflows and quickly access your inbox without switching applications.
The Sentry integration lets you monitor and debug application errors directly from your development environment, enabling you to query issues, view stack traces, and manage error reports without leaving your workflow.
The Firecrawl integration lets you scrape websites, extract structured data, and convert web pages into LLM-ready formats directly from your MCP-enabled applications.
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.
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.
Lists all organizations that the current user has access to. Optionally filter by organization name or ID using the `search` parameter.
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 a new Neon project. If someone is trying to create a database, use this tool.
Delete a Neon project
Describes a Neon project
<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>
<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 the schema of a table in a Neon database
Get all tables in a Neon database
Create a branch in a Neon project
<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>
Find guides and articles to help you get started with Neon on Metorial.
Neon
Neon
Neon
Neon
Neon
Neon
Neon
Neon
The Neon MCP Server provides comprehensive integration with Neon's serverless Postgres platform, enabling AI assistants to manage database projects, execute queries, perform schema migrations, optimize query performance, and provision authentication—all through natural language interactions. This server transforms complex database operations into simple conversational workflows, making database management accessible while maintaining safety through features like temporary branch testing and automated rollback capabilities.
Neon is a serverless Postgres platform that separates storage and compute, offering instant provisioning, automatic scaling, and branching capabilities similar to Git. This MCP server exposes Neon's powerful API and database operations as tools that AI assistants can use to help developers manage their database infrastructure, write and optimize SQL queries, perform schema migrations safely, and set up authentication systems.
The server handles everything from project creation and management to advanced operations like query tuning with execution plan analysis, safe schema migrations using temporary branches, and Stack Auth integration for authentication. Whether you're creating a new database, analyzing slow queries, or performing complex schema changes, the Neon MCP Server provides the tools to accomplish these tasks through conversational AI.
The server provides comprehensive control over Neon projects and organizations. You can list all projects in your account with support for pagination and filtering by name or ID. The search functionality allows you to quickly find specific projects, and you can scope searches to particular organizations. Projects can be created with custom names and assigned to specific organizations, making it easy to organize your database infrastructure. The server also supports listing shared projects that other users have granted you access to, facilitating team collaboration.
One of Neon's most powerful features is database branching, which this server fully supports. You can create branches of your database for testing, development, or staging purposes. Each branch is an isolated copy-on-write clone that shares the parent's data until modifications are made. The server enables you to describe branch contents, delete branches when no longer needed, and reset branches from their parent to discard changes and start fresh. The reset operation optionally preserves the current state under a new branch name, preventing accidental data loss.
Execute SQL queries directly against your Neon databases through simple tool calls. The server supports both single SQL statements and multi-statement transactions, ensuring atomicity for complex operations. You can target specific branches for testing without affecting production data, and optionally specify custom database names and roles. This flexibility makes it easy to test queries safely before running them in production environments.
Understanding your database structure is essential for effective management. The server provides tools to discover all tables in a database, describe detailed table schemas including columns, data types, constraints, and indexes, and get comprehensive tree views of branch contents showing all databases, schemas, tables, views, and functions. This introspection capability helps AI assistants understand your database structure and provide accurate assistance.
Database schema changes are risky operations that can cause data loss or downtime if not handled carefully. The Neon MCP Server implements a two-phase migration workflow that maximizes safety. First, the prepare_database_migration
tool creates a temporary branch and applies your migration there. You can then test the changes thoroughly using SQL queries against the temporary branch. The tool accepts natural language migration requests like "Add email column to users table" or "Create posts table with title and content columns" and generates the appropriate SQL DDL statements.
After verification, the complete_database_migration
tool applies the changes to your main branch and cleans up the temporary branch. If testing reveals issues, you can simply reject the migration, and the temporary branch is deleted without affecting production data. The system automatically retries failed operations once and provides detailed error information if problems persist.
Slow queries can significantly impact application performance. The server includes sophisticated query tuning capabilities that help identify and resolve performance bottlenecks. The prepare_query_tuning
tool analyzes your SQL query by examining its execution plan, extracting all referenced tables, gathering detailed schema information, and suggesting optimizations like adding indexes, restructuring queries, or identifying bottlenecks.
Like migrations, query tuning uses a temporary branch for testing. The tool applies suggested changes to the temporary branch, allowing you to compare performance before and after optimization. You can then use complete_query_tuning
to apply approved changes to your main branch or discard them if they don't provide sufficient improvement. The server also provides a list_slow_queries
tool that identifies problematic queries by querying the pg_stat_statements extension, showing queries sorted by execution time with configurable thresholds.
Understanding how Postgres executes your queries is crucial for optimization. The explain_sql_statement
tool runs EXPLAIN (ANALYZE) on your queries, providing detailed execution plans that show table scans, index usage, join methods, and cost estimates. This information helps identify why queries are slow and what optimizations might help.
Modern applications require robust authentication systems, but setting them up can be complex and time-consuming. The provision_neon_auth
tool automates authentication infrastructure setup by creating an integration with Stack Auth. The tool establishes a connection between your Neon project and Stack Auth, creates a dedicated authentication schema in your database, sets up synchronized user tables, and generates client and secret keys for your application.
The server provides comprehensive Stack Auth integration guidelines, including setup instructions for Next.js applications, component usage patterns for sign-in and user management, client and server component examples, and page protection strategies using middleware or hooks. This automation eliminates hours of manual configuration and ensures best practices are followed.
Connecting to your Neon databases requires properly formatted connection strings with correct credentials and endpoints. The get_connection_string
tool generates PostgreSQL connection strings with all necessary parameters, supporting custom branches, roles, compute endpoints, and database names. All parameters are optional, with sensible defaults for common use cases.
Lists the first 10 Neon projects in your account with support for pagination through cursor-based navigation. You can increase the limit up to 400 projects per request and filter results by project name or ID using partial matching. The tool also supports filtering by organization ID to scope results to specific organizations.
Parameters:
limit
(number, default: 10): Number of projects to return (1-400)cursor
(string, optional): Pagination cursor from previous responseorg_id
(string, optional): Filter by organization IDsearch
(string, optional): Filter by project name or ID (supports partial matching)Lists all organizations that the current user has access to, with optional filtering by organization name or ID using partial matching. This helps you understand your organization structure and scope other operations appropriately.
Parameters:
search
(string, optional): Filter by organization name or ID (supports partial matching)Lists projects that other users have shared with you, enabling collaboration on databases. Supports pagination and filtering by project name or ID, similar to the regular project listing.
Parameters:
limit
(number, default: 10): Number of shared projects to return (1-400)cursor
(string, optional): Pagination cursor from previous responsesearch
(string, optional): Filter by project name or ID (supports partial matching)Creates a new Neon project with optional custom name and organization assignment. If someone requests a database, this tool handles the creation. The newly created project includes a default branch with a Postgres database ready for use.
Parameters:
name
(string, optional): Custom project nameorg_id
(string, optional): Organization ID to create the project inPermanently deletes a Neon project and all its associated data, including all branches, databases, and backups. This operation cannot be undone, so use with caution.
Parameters:
projectId
(string, required): ID of the project to deleteRetrieves detailed information about a specific Neon project, including configuration, region, branches, and resource usage. This provides a comprehensive view of the project's current state.
Parameters:
projectId
(string, required): ID of the project to describeExecutes a single SQL statement against a Neon database. You can target specific branches for testing, specify custom database names, and use different roles. The tool is particularly useful for testing migrations in temporary branches.
Parameters:
sql
(string, required): SQL query to executeprojectId
(string, required): Project IDbranchId
(string, optional): Branch ID (defaults to main branch)databaseName
(string, optional): Database name (defaults to neondb or first available)Executes multiple SQL statements as a single atomic transaction, ensuring all statements succeed or all fail together. This is essential for complex operations that must maintain database consistency.
Parameters:
sqlStatements
(array of strings, required): SQL statements to executeprojectId
(string, required): Project IDbranchId
(string, optional): Branch ID (defaults to main branch)databaseName
(string, optional): Database name (defaults to neondb or first available)Retrieves comprehensive schema information for a specific table, including column definitions with data types and constraints, primary and foreign keys, indexes, and check constraints. This helps understand table structure for queries and migrations.
Parameters:
tableName
(string, required): Name of the tableprojectId
(string, required): Project IDbranchId
(string, optional): Branch ID (defaults to main branch)databaseName
(string, optional): Database name (defaults to neondb or first available)Lists all tables in a database, providing an overview of the database structure. This is useful for discovery and understanding what data exists.
Parameters:
projectId
(string, required): Project IDbranchId
(string, optional): Branch ID (defaults to main branch)databaseName
(string, optional): Database name (defaults to neondb or first available)Creates a new branch from an existing branch (defaults to main). Branches are copy-on-write clones that share the parent's data initially, making them fast to create and storage-efficient until modifications occur.
Parameters:
projectId
(string, required): Project IDbranchName
(string, optional): Custom branch nameInitiates a safe two-phase migration workflow by creating a temporary branch, generating SQL DDL from natural language requests, and applying changes to the test branch. Supports CREATE, ALTER, and DROP operations for tables, columns, constraints, and indexes. The tool automatically retries once on failure and provides detailed error information.
Parameters:
migrationSql
(string, required): SQL DDL statements to executeprojectId
(string, required): Project IDdatabaseName
(string, optional): Database name (defaults to neondb or first available)Completes a migration by applying verified changes to the main branch and cleaning up the temporary branch. This tool must be called even when migrations are rejected to ensure proper cleanup. It requires the migration ID from the prepare phase.
Parameters:
migrationId
(string, required): Migration ID from prepare phaseProvides a comprehensive tree view of all objects in a branch, including databases, schemas, tables, views, functions, and their relationships. This gives a complete picture of the branch structure.
Parameters:
projectId
(string, required): Project IDbranchId
(string, required): Branch IDdatabaseName
(string, optional): Database name (defaults to neondb or first available)Permanently deletes a branch and all its associated data. This cannot be undone, so ensure the branch is no longer needed before deletion.
Parameters:
projectId
(string, required): Project IDbranchId
(string, required): Branch ID to deleteResets a branch to match its parent's current state, discarding all changes. Optionally preserves the current state under a new branch name before resetting, preventing data loss. This is useful for creating fresh development branches or undoing experimental changes.
Parameters:
projectId
(string, required): Project IDbranchIdOrName
(string, required): Branch ID or name to resetpreserveUnderName
(string, optional): Name for preserving current state as new branchGenerates a properly formatted PostgreSQL connection string with all necessary parameters for connecting to your Neon database. All parameters are optional with sensible defaults.
Parameters:
projectId
(string, required): Project IDbranchId
(string, optional): Branch ID or name (defaults to main branch)roleName
(string, optional): Role name (defaults to database owner)computeId
(string, optional): Compute endpoint ID (defaults to read-write compute)databaseName
(string, optional): Database name (defaults to neondb or first available)Automates authentication infrastructure setup by integrating with Stack Auth. Creates authentication schemas, sets up user tables, and generates API keys. Includes comprehensive Stack Auth setup guidelines for Next.js applications with component usage examples and best practices.
Parameters:
projectId
(string, required): Project IDdatabase
(string, optional): Database name (defaults to neondb or first available)Analyzes SQL query execution plans using EXPLAIN (ANALYZE) to understand query performance. Shows table scans, index usage, join methods, cost estimates, and actual execution times. Essential for identifying optimization opportunities.
Parameters:
sql
(string, required): SQL statement to analyzeprojectId
(string, required): Project IDanalyze
(boolean, default: true): Include ANALYZE in EXPLAIN commandbranchId
(string, optional): Branch ID (defaults to main branch)databaseName
(string, optional): Database name (defaults to neondb or first available)Initiates query performance optimization by creating a temporary branch, analyzing execution plans, gathering schema information for all referenced tables, suggesting improvements like indexes or query restructuring, and applying changes to the test branch for verification. Automatically retries once on failure.
Parameters:
sql
(string, required): SQL statement to optimizeprojectId
(string, required): Project IDdatabaseName
(string, required): Database nameroleName
(string, optional): Role name (defaults to neondb_owner)Completes query optimization by applying approved changes to the main branch or specified branch and cleaning up the temporary branch. Must be called even when changes are rejected to ensure proper cleanup. Requires the tuning ID from the prepare phase.
Parameters:
tuningId
(string, required): Tuning ID from prepare phaseprojectId
(string, required): Project IDdatabaseName
(string, required): Database nametemporaryBranchId
(string, required): Temporary branch ID to clean upsuggestedSqlStatements
(array of strings, required): SQL DDL statements to applyapplyChanges
(boolean, default: false): Whether to apply changes to main branchbranchId
(string, optional): Target branch (defaults to main branch)roleName
(string, optional): Role name (defaults to neondb_owner)shouldDeleteTemporaryBranch
(boolean, default: true): Whether to delete temporary branchIdentifies slow-running queries by querying the pg_stat_statements extension. Returns queries sorted by execution time with configurable minimum execution time thresholds and result limits. Essential for proactive performance monitoring.
Parameters:
projectId
(string, required): Project IDlimit
(number, default: 10): Maximum number of queries to returnminExecutionTime
(number, default: 1000): Minimum execution time in millisecondsbranchId
(string, optional): Branch ID (defaults to main branch)computeId
(string, optional): Compute endpoint ID (defaults to read-write compute)databaseName
(string, optional): Database name (defaults to neondb or first available)Lists compute endpoints for a project or specific branch, showing available compute resources for connections. Compute endpoints represent the actual Postgres instances serving queries.
Parameters:
projectId
(string, optional): Project ID (defaults to only available project)branchId
(string, optional): Branch ID (shows endpoints for specific branch)The Neon MCP Server enables numerous practical workflows:
Database Setup and Management: Create new projects for different applications or environments, organize projects within teams using organizations, share database access with collaborators, and manage the complete lifecycle from creation to deletion.
Safe Schema Evolution: Test schema changes in isolated branches before production deployment, use natural language to describe desired changes without writing DDL manually, verify migrations thoroughly before committing to main branch, and automatically rollback if issues are discovered during testing.
Performance Optimization: Identify slow queries affecting application performance, analyze execution plans to understand query behavior, receive AI-generated optimization suggestions based on schema analysis, test optimizations in temporary branches, and apply proven improvements to production with confidence.
Development Workflows: Create feature branches for developing new functionality with database changes, test database-dependent features in isolation, reset development branches from updated production data, and collaborate on database changes through shared projects.
Authentication Integration: Set up complete authentication infrastructure in minutes rather than hours, integrate with modern authentication providers like Stack Auth, follow best practices automatically through provided guidelines, and get working code examples for common authentication patterns.
To use the Neon MCP Server, you'll need a Neon account with valid API credentials. Once configured, AI assistants can immediately begin helping with database tasks through natural conversation. Ask questions like "Show me my Neon projects," "Create a new database for my blog application," "Add an email column to the users table," or "Why is this query slow and how can I optimize it?"
The server handles all the complexity of API calls, SQL generation, branch management, and safety checks, allowing you to focus on your application logic while maintaining database best practices.
Let's take your AI-powered applications to the next level, together.
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.