Skip to content

Conversation

Shridhad
Copy link
Collaborator

Summary

This PR adds a new search tool to the Neon MCP server that allows users to search across all their organizations, projects, and branches with a single query.

Key Features

  • Comprehensive Search: Searches across organizations, projects (including shared projects), and branches
  • Performance Optimized: Uses parallel API calls for improved search performance
  • Structured Results: Returns objects with id, title, url, and type fields
  • Console Integration: Provides direct links to the Neon Console for easy navigation
  • Flexible Matching: Case-insensitive search on both names and IDs
  • Error Resilient: Gracefully handles API errors and inaccessible resources

Implementation Details

  • Added search tool with query parameter (minimum 3 characters)
  • Implemented parallel branch searching across multiple projects
  • Added helper functions for modular code organization
  • Supports both personal and organization account contexts
  • Returns MCP-compatible resource IDs with type prefixes (org:, project:, branch:)

Test plan

  • TypeScript compilation successful
  • ESLint and Prettier formatting passed
  • Build process completed successfully
  • Tool exported to landing page tools.json
  • Manual testing with real Neon account (recommended)

- Add new search tool that searches across all user organizations, projects, and branches
- Implement parallel branch searching for improved performance
- Support both personal and organization account contexts
- Return structured results with MCP-compatible IDs and console URLs
- Add helper functions for modular code organization
- Minimum query length of 3 characters to optimize performance
- Graceful error handling for inaccessible resources

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@orca-security-us orca-security-us bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Copy link

🚀 Preview deployment ready: https://preview-mcp.neon.tech

@Shridhad Shridhad changed the title feat: add search tool for organizations, projects, and branches feat: add search and fetch tool for organizations, projects, and branches Sep 11, 2025
): Promise<CallToolResult> {
try {
// Parse the ID format
if (id.startsWith('org:') || id.startsWith('org-')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add these to constants

} else if (id.startsWith('branch:')) {
const [projectId, branchId] = id.slice(7).split('/');
return await fetchBranchDetails(projectId, branchId, neonClient, extra);
} else if (id.startsWith('project:')) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for these

projects = projectsData.projects || [];
} catch {
// Skip if we can't access projects
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we paralelize these 2 calls? listProjects and getOrganizationMembers ?

},
{
name: 'fetch' as const,
description: `Fetches detailed information about a specific organization, project, or branch using the ID returned by the search tool. This tool provides comprehensive information about Neon resources for detailed analysis and management.`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that this tool can only be used with the search tool combined?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants