#!/usr/bin/env python3
"""
Quick tunnel using a simple approach
"""
import subprocess
import time
import sys
def main():
print("π Creating public tunnel for Gmail MCP Server...")
print("π Local server: http://localhost:8000/sse")
# Try using localtunnel with a simple approach
try:
print("\nπ Starting localtunnel...")
print("β³ This may take a moment...")
# Run localtunnel and capture output
result = subprocess.run(
['npx', 'localtunnel', '--port', '8000'],
capture_output=True,
text=True,
timeout=30
)
# Look for the URL in the output
output = result.stdout + result.stderr
print(f"π Output: {output}")
# Extract URL from output
lines = output.split('\n')
for line in lines:
if 'https://' in line and 'loca.lt' in line:
url = line.strip()
if url.startswith('https://'):
print(f"\nβ
SUCCESS! Your Gmail MCP Server is now public!")
print(f"π Public URL: {url}/sse")
print(f"π Full endpoint: {url}/sse")
print("\nπ Usage:")
print(f" - For MCP clients: {url}/sse")
print(f" - For testing: Visit {url}/sse in browser")
return url
print("β Could not extract URL from localtunnel output")
print("π‘ Try running manually: npx localtunnel --port 8000")
except subprocess.TimeoutExpired:
print("β° Timeout waiting for localtunnel")
except Exception as e:
print(f"β Error: {e}")
print("\nπ‘ Alternative: You can manually run:")
print(" npx localtunnel --port 8000")
if __name__ == "__main__":
main()