"""
Test if we can invoke MCP tools directly through subprocess or file-based IPC
"""
import json
import subprocess
import sys
import os
import tempfile
from pathlib import Path

card_id = "6a1d695a1dc00d256e0dc34b"

# Check environment for MCP server endpoint
env_vars = {k: v for k, v in os.environ.items() if 'MCP' in k or 'TRELLO' in k}
print("Relevant env vars:", env_vars)

# Look for socket or named pipe that might be the MCP server
sock_paths = [
    "/tmp/mcp-*.sock",
    "/var/run/mcp-*.sock",
]

print("\nSearching for MCP sockets...")
for pattern in sock_paths:
    result = subprocess.run(f"ls {pattern} 2>/dev/null || echo 'No match'", 
                          shell=True, capture_output=True, text=True)
    print(f"  {pattern}: {result.stdout.strip()}")

# Check if there's an MCP server running as a process
print("\nLooking for MCP server processes...")
result = subprocess.run("ps aux | grep -i mcp | grep -v grep", 
                       shell=True, capture_output=True, text=True)
if result.stdout:
    print(result.stdout)
else:
    print("  No MCP processes found")

