Skip to main content
Glama
nahmanmate

PostgreSQL MCP Server

by nahmanmate

get_setup_instructions

Generate step-by-step PostgreSQL setup instructions for your operating system and use case. Specify platform, version, and environment to get tailored guidance.

Instructions

Get step-by-step PostgreSQL setup instructions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
versionNoPostgreSQL version to install
platformYesOperating system platform
useCaseNoIntended use case

Implementation Reference

  • Core handler function that generates platform-specific PostgreSQL setup instructions, including installation steps, configuration settings, and post-install actions based on version and use case.
    export function getSetupInstructions(
      platform: 'linux' | 'macos' | 'windows',
      version = 'latest',
      useCase: 'development' | 'production' = 'development'
    ): SetupInstructions {
      const instructions: SetupInstructions = {
        steps: [],
        configuration: [],
        postInstall: []
      };
    
      // Installation steps
      switch (platform) {
        case 'linux':
          instructions.steps = [
            '# Add PostgreSQL repository',
            'sudo sh -c \'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list\'',
            'wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -',
            'sudo apt-get update',
            `sudo apt-get install postgresql${version === 'latest' ? '' : `-${version}`}`,
            '# Start PostgreSQL service',
            'sudo systemctl start postgresql',
            'sudo systemctl enable postgresql'
          ];
          break;
    
        case 'macos':
          instructions.steps = [
            '# Install PostgreSQL using Homebrew',
            'brew update',
            `brew install postgresql${version === 'latest' ? '' : '@' + version}`,
            '# Start PostgreSQL service',
            'brew services start postgresql'
          ];
          break;
    
        case 'windows':
          instructions.steps = [
            '# Download PostgreSQL installer',
            'Download the installer from https://www.postgresql.org/download/windows/',
            'Run the installer and follow the setup wizard',
            'Ensure to remember the superuser password you set during installation'
          ];
          break;
      }
    
      // Basic configuration
      instructions.configuration = [
        '# Edit postgresql.conf with recommended settings',
        useCase === 'production' ? 'max_connections = 100' : 'max_connections = 20',
        useCase === 'production' ? 'shared_buffers = 25% of RAM' : 'shared_buffers = 128MB',
        'work_mem = 4MB',
        'maintenance_work_mem = 64MB',
        'effective_cache_size = 50% of RAM',
        'synchronous_commit = on',
        'fsync = on',
        useCase === 'production' ? 'full_page_writes = on' : 'full_page_writes = off',
        'log_destination = \'csvlog\'',
        'logging_collector = on',
        'log_min_duration_statement = 250ms'
      ];
    
      // Security configuration for production
      if (useCase === 'production') {
        instructions.configuration.push(
          '# Security settings',
          'ssl = on',
          'ssl_cert_file = \'server.crt\'',
          'ssl_key_file = \'server.key\'',
          'password_encryption = scram-sha-256',
          'authentication_timeout = 1min'
        );
      }
    
      // Post-installation steps
      instructions.postInstall = [
        '# Create a new database and user',
        'sudo -u postgres psql',
        'CREATE DATABASE myapp;',
        'CREATE USER myuser WITH ENCRYPTED PASSWORD \'mypass\';',
        'GRANT ALL PRIVILEGES ON DATABASE myapp TO myuser;',
        '\\q'
      ];
    
      if (useCase === 'production') {
        instructions.postInstall.push(
          '# Additional production security steps',
          'pg_hba.conf configuration:',
          'hostssl all all 0.0.0.0/0 scram-sha-256',
          'host all all 127.0.0.1/32 scram-sha-256',
          '',
          '# Setup automated backups',
          '# Add to crontab:',
          '0 0 * * * pg_dump -U postgres myapp > /backup/myapp_$(date +%Y%m%d).sql'
        );
      }
    
      return instructions;
    }
  • Input schema defining parameters for the get_setup_instructions tool: platform (required), version, and useCase.
    {
      name: 'get_setup_instructions',
      description: 'Get step-by-step PostgreSQL setup instructions',
      inputSchema: {
        type: 'object',
        properties: {
          version: {
            type: 'string',
            description: 'PostgreSQL version to install'
          },
          platform: {
            type: 'string',
            enum: ['linux', 'macos', 'windows'],
            description: 'Operating system platform'
          },
          useCase: {
            type: 'string',
            enum: ['development', 'production'],
            description: 'Intended use case'
          }
        },
        required: ['platform']
      }
    },
  • src/index.ts:102-107 (registration)
    Registers the get_setup_instructions tool in the MCP server capabilities using TOOL_DEFINITIONS.
      tools: {
        analyze_database: TOOL_DEFINITIONS[0],
        get_setup_instructions: TOOL_DEFINITIONS[1],
        debug_database: TOOL_DEFINITIONS[2]
      },
    },
  • MCP CallToolRequest handler that extracts arguments, calls getSetupInstructions, and formats the response as markdown text.
    case 'get_setup_instructions': {
      const { platform, version, useCase } = request.params.arguments as {
        platform: 'linux' | 'macos' | 'windows';
        version?: string;
        useCase?: 'development' | 'production';
      };
      const instructions = getSetupInstructions(platform, version, useCase);
      return {
        content: [
          {
            type: 'text',
            text: [
              '# Installation Steps',
              ...instructions.steps,
              '',
              '# Configuration',
              ...instructions.configuration,
              '',
              '# Post-Installation Steps',
              ...instructions.postInstall
            ].join('\n')
          }
        ]
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool provides 'step-by-step instructions,' implying a read-only, informational output, but doesn't clarify aspects like response format, potential side effects, or error handling, which are important for a tool with parameters.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose ('Get step-by-step PostgreSQL setup instructions') with zero wasted words, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no annotations, no output schema), the description is minimally adequate. It covers the purpose but lacks details on behavior, usage context, or output, leaving gaps that could hinder effective tool selection and invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters (version, platform, useCase) with descriptions and enums. The description adds no additional parameter details beyond implying setup instructions, which aligns with the schema but doesn't enhance it, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get step-by-step... instructions') and resource ('PostgreSQL setup'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'analyze_database' or 'debug_database', which likely serve different purposes but aren't contrasted here.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. The description lacks context on prerequisites, timing, or comparisons to sibling tools, leaving the agent without usage direction beyond the basic purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nahmanmate/postgresql-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server