DocumentationNeuronMCP Documentation
Documentation Branch: You are viewing documentation for the main branch (3.0.0-devel). Select a branch to view its documentation:

PostgreSQL Tools for NeuronMCP - Comprehensive Reference Guide

PostgreSQL Tools for NeuronMCP - Comprehensive Reference Guide

Complete, detailed documentation for all 29 PostgreSQL administration tools


Table of Contents

  1. Introduction
  2. Quick Start Guide
  3. Tool Categories Overview
  4. Server Information Tools (5 tools)
  5. Database Object Management Tools (8 tools)
  6. User and Role Management Tools (3 tools)
  7. Performance and Statistics Tools (7 tools)
  8. Size and Storage Tools (6 tools)
  9. Integration with NeuronDB
  10. Use Cases and Workflows
  11. Best Practices
  12. Troubleshooting Guide
  13. API Reference
  14. Examples Gallery

Introduction

NeuronMCP provides 29 comprehensive PostgreSQL administration and monitoring tools that deliver 100% coverage of PostgreSQL database management capabilities. These tools seamlessly combine standard PostgreSQL administration with NeuronDB's advanced vector search, machine learning, and AI capabilities, creating the most complete and powerful database management solution available.

Why NeuronMCP PostgreSQL Tools?

  • Complete Coverage: Every aspect of PostgreSQL administration from basic version info to advanced performance tuning
  • Real-time Monitoring: Live statistics, active queries, wait events, and connection monitoring
  • Performance Analysis: Detailed metrics for tables, indexes, queries, and system resources
  • Storage Management: Size analysis, bloat detection, and vacuum recommendations
  • Security Management: Comprehensive user, role, and permission auditing
  • NeuronDB Integration: Seamless integration with NeuronDB vector search and ML capabilities
  • Operational focus: Designed for day-to-day administration and monitoring
  • Easy to Use: Simple, intuitive API accessible via MCP protocol

Architecture

┌─────────────────────────────────────────────────────────┐
│                  MCP Client                             │
│  (Claude Desktop, Custom Client, etc.)                 │
└────────────────────┬────────────────────────────────────┘
                     │ JSON-RPC 2.0 over stdio
┌────────────────────▼────────────────────────────────────┐
│              NeuronMCP Server                           │
│  ┌──────────────────────────────────────────────────┐  │
│  │       PostgreSQL Tools (29 tools)                │  │
│  │  • Server Information                             │  │
│  │  • Object Management                               │  │
│  │  • User/Role Management                            │  │
│  │  • Performance Monitoring                          │  │
│  │  • Size and Storage                                │  │
│  └──────────────────────────────────────────────────┘  │
└────────────────────┬────────────────────────────────────┘
                     │ SQL Queries
┌────────────────────▼────────────────────────────────────┐
│         PostgreSQL + NeuronDB                          │
│  • PostgreSQL 16+                                      │
│  • NeuronDB Extension                                  │
│  • Vector Search, ML, AI                               │
└─────────────────────────────────────────────────────────┘

Tool Statistics

  • Total Tools: 29
  • Server Information: 5 tools
  • Database Object Management: 8 tools
  • User and Role Management: 3 tools
  • Performance and Statistics: 7 tools
  • Size and Storage: 6 tools

Quick Start Guide

Prerequisites

  1. PostgreSQL 16 or later installed and running
  2. NeuronDB extension installed in your database
  3. NeuronMCP server configured and running
  4. Database connection configured in neuronmcp_server.json

Basic Usage Examples

1. Check PostgreSQL Version

# Using MCP client
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_version"

# Expected output
{
  "version": "PostgreSQL 16.1 on x86_64-pc-linux-gnu...",
  "server_version": "16.1",
  "major_version": 16,
  "minor_version": 1,
  "patch_version": 0
}

2. Get Comprehensive Server Statistics

# Get all statistics
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_stats"

# Get only performance metrics
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_stats:include_database_stats=false,include_table_stats=false,include_connection_stats=false,include_performance_stats=true"

3. List All Tables

# List all user tables
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_tables"

# List tables in specific schema
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_tables:schema=public"

4. Monitor Active Queries

# Show only active queries
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_active_queries"

# Include idle queries too
./bin/neurondb-mcp-client -c neuronmcp_server.json -e "postgresql_active_queries:include_idle=true,limit=50"

Using with Claude Desktop

All PostgreSQL tools are automatically available in Claude Desktop when NeuronMCP is configured. Simply ask Claude:

Examples:

  • "Show me all PostgreSQL tables and their sizes"
  • "What queries are currently running?"
  • "Check database bloat and recommend maintenance actions"
  • "List all indexes and show which ones are being used"
  • "Show me connection statistics"
  • "What are the performance metrics for the database?"

JSON-RPC 2.0 Format

All tools use the standard MCP protocol format:

{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "postgresql_version",
"arguments": {}
}
}

Response format:

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "{\"version\":\"PostgreSQL 16.1...\",\"major_version\":16,...}"
}
]
}
}

Tool Categories Overview

Server Information Tools (5 tools)

Essential tools for understanding your PostgreSQL server configuration and status.

ToolPurposeKey Use Cases
postgresql_versionGet server version and build infoVersion checking, compatibility verification
postgresql_statsComprehensive server-wide statisticsHealth monitoring, capacity planning
postgresql_databasesList all databases with sizesDatabase inventory, size monitoring
postgresql_settingsConfiguration settingsPerformance tuning, configuration audit
postgresql_extensionsInstalled extensionsExtension management, compatibility check

Database Object Management Tools (8 tools)

Tools for managing and inspecting database schema objects.

ToolPurposeKey Use Cases
postgresql_tablesTables with metadata and statisticsSchema exploration, table inventory
postgresql_indexesIndexes with usage statisticsIndex optimization, unused index detection
postgresql_schemasSchema listing and permissionsSchema management, permission audit
postgresql_viewsViews with definitionsView management, dependency tracking
postgresql_sequencesSequences with current valuesSequence monitoring, ID generation tracking
postgresql_functionsFunctions with parameters and definitionsFunction inventory, code review
postgresql_triggersTriggers with event typesTrigger audit, event tracking
postgresql_constraintsConstraints (PK, FK, unique, check)Data integrity audit, constraint analysis

User and Role Management Tools (3 tools)

Security and access control management.

ToolPurposeKey Use Cases
postgresql_usersUser accounts and capabilitiesSecurity audit, user management
postgresql_rolesRoles with membershipsRole hierarchy, permission management
postgresql_permissionsObject-level permissionsAccess control audit, security review

Performance and Statistics Tools (7 tools)

Real-time monitoring and performance analysis.

ToolPurposeKey Use Cases
postgresql_table_statsPer-table performance metricsPerformance tuning, bottleneck identification
postgresql_index_statsPer-index usage statisticsIndex optimization, query performance
postgresql_active_queriesCurrently running queriesQuery monitoring, performance debugging
postgresql_wait_eventsQuery blocking and wait eventsLock detection, performance troubleshooting
postgresql_connectionsConnection details and statesConnection pooling, resource management
postgresql_locksLock information and conflictsDeadlock detection, concurrency analysis
postgresql_replicationReplication status and lagHigh availability monitoring, replication health

Size and Storage Tools (6 tools)

Storage analysis and maintenance.

ToolPurposeKey Use Cases
postgresql_table_sizeTable size breakdownCapacity planning, storage optimization
postgresql_index_sizeIndex size analysisIndex size monitoring, storage management
postgresql_bloatTable and index bloat detectionMaintenance planning, performance optimization
postgresql_vacuum_statsVacuum recommendationsMaintenance scheduling, performance tuning