GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
116
Forks
0
Issues
0
Neon DB Organization MCP Server
A Model Context Protocol (MCP) server for querying Neon DB organization-level API endpoints.
This server provides tools to manage and query your Neon projects, branches, databases, roles, and operations programmatically.
Features
- Project Management: List all projects, get project details, search projects by name
- Branch Operations: List branches for projects
- Database Management: List databases for specific branches
- Role Management: List roles for specific branches
- Operations Monitoring: Get recent operations for projects
- Endpoint Management: List compute endpoints for projects
- Organization Info: Get organization and user details
- Consumption Metrics: Query usage and billing data
Setup
1. Install Dependencies
pip install httpx mcp
2. Get Neon API Key
- Log in to the Neon Console
- Go to Account Settings โ API Keys
- Create a new API key
- Copy the API key
3. Set Environment Variable
Set your Neon API key as an environment variable:
# Windows PowerShell
$env:NEON_API_KEY = "your-api-key-here"
# Windows Command Prompt
set NEON_API_KEY=your-api-key-here
# Linux/macOS
export NEON_API_KEY=your-api-key-here
4. Run the MCP Server
python neonorgdb.py
Available Tools
๐๏ธ Project Management
list_projects(cursor?, limit?)
โ List all projects in the organizationget_project_details(project_id)
โ Get detailed information about a specific projectsearch_projects_by_name(name_pattern)
โ Search projects by name pattern
๐ฟ Branch Management
list_project_branches(project_id)
โ List all branches for a project
๐๏ธ Database Management
list_branch_databases(project_id, branch_id)
โ List databases for a specific branch
๐ค Role Management
list_branch_roles(project_id, branch_id)
โ List roles for a specific branch
๐งพ Operations
get_project_operations(project_id, cursor?, limit?)
โ Get recent operations for a project
๐ Endpoints
list_project_endpoints(project_id)
โ List compute endpoints for a project
๐ข Organization
get_organization_info()
โ Get organization and user informationget_consumption_metrics(cursor?, limit?, from_date?, to_date?)
โ Get consumption history
API Reference
This MCP server uses the Neon API v2.
๐ Authentication
Uses Bearer token authentication with your Neon API key.
Ensure the NEON_API_KEY
environment variable is set before running the server.
๐ฆ Rate Limiting
The Neon API has rate limits.
This server includes basic error handling for HTTP errors. For production use, implement:
- Retry logic
- Backoff strategies
๐ Pagination
Many endpoints use cursor-based pagination.
Use the cursor
parameter to retrieve additional pages of results.
Example Usage
Once the MCP server is running, MCP-compatible clients can:
- List all projects โ Get an overview of all projects in your organization
- Monitor operations โ Check the status of recent operations
- Analyze consumption โ Query usage metrics and billing data
- Manage resources โ List branches, databases, and roles across projects
Error Handling
Basic error handling covers:
- Missing API key
- HTTP errors from the Neon API
- Invalid project/branch IDs
โ For Production
Consider adding:
- Retry logic for transient errors
- Detailed error logging
- Rate limit handling
Contributing
Feel free to submit issues and enhancement requests!
License
MIT License