Skip to main content
Glama

PostgreSQL Read-Only MCP Server

by currentspace
test_shared_tunnel.sh2.21 kB
#!/bin/bash # Test script for shared SSH tunnel functionality echo "=== Testing Shared SSH Tunnel ===" echo # Function to start an instance start_instance() { local instance_num=$1 echo "Starting instance $instance_num..." ./start_mcp.sh > /tmp/mcp_instance_${instance_num}.log 2>&1 & echo $! > /tmp/mcp_instance_${instance_num}.pid sleep 3 } # Function to stop an instance stop_instance() { local instance_num=$1 if [ -f /tmp/mcp_instance_${instance_num}.pid ]; then local pid=$(cat /tmp/mcp_instance_${instance_num}.pid) echo "Stopping instance $instance_num (PID: $pid)..." kill -INT $pid 2>/dev/null || true rm -f /tmp/mcp_instance_${instance_num}.pid sleep 2 fi } # Function to check tunnel status check_tunnel_status() { if [ -f /tmp/pg_mcp_tunnel/tunnel.lock ]; then echo "Tunnel Status:" cat /tmp/pg_mcp_tunnel/tunnel.lock | jq . echo if [ -f /tmp/pg_mcp_tunnel/refs.json ]; then echo "Active References:" cat /tmp/pg_mcp_tunnel/refs.json | jq . fi else echo "No tunnel lock file found" fi echo } # Clean up any existing instances echo "Cleaning up any existing instances..." for i in 1 2 3; do stop_instance $i done rm -rf /tmp/pg_mcp_tunnel sleep 2 # Test 1: Start first instance (should create tunnel) echo "=== Test 1: First Instance ===" start_instance 1 check_tunnel_status # Test 2: Start second instance (should share tunnel) echo "=== Test 2: Second Instance ===" start_instance 2 check_tunnel_status # Test 3: Start third instance (should share tunnel) echo "=== Test 3: Third Instance ===" start_instance 3 check_tunnel_status # Test 4: Stop middle instance (tunnel should remain) echo "=== Test 4: Stop Middle Instance ===" stop_instance 2 check_tunnel_status # Test 5: Stop first instance (tunnel should remain) echo "=== Test 5: Stop First Instance ===" stop_instance 1 check_tunnel_status # Test 6: Stop last instance (tunnel should close) echo "=== Test 6: Stop Last Instance ===" stop_instance 3 check_tunnel_status echo "=== Test Complete ===" echo "Check logs in /tmp/mcp-postgres-debug.log for details"

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/currentspace/pg_mcp_prod'

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