respect WORKSPACE_MCP_BASE_URI everywhere

This commit is contained in:
Taylor Wilsdon
2025-06-08 12:17:06 -04:00
parent 05b9ddadb2
commit 019517beeb
4 changed files with 38 additions and 26 deletions

13
main.py
View File

@@ -48,8 +48,9 @@ def main():
help='Transport mode: stdio (default) or streamable-http')
args = parser.parse_args()
# Set port once for reuse throughout the function
# Set port and base URI once for reuse throughout the function
port = int(os.getenv("PORT", os.getenv("WORKSPACE_MCP_PORT", 8000)))
base_uri = os.getenv("WORKSPACE_MCP_BASE_URI", "http://localhost")
print("🔧 Google Workspace MCP Server")
print("=" * 35)
@@ -57,8 +58,8 @@ def main():
print(f" 📦 Version: 0.1.1")
print(f" 🌐 Transport: {args.transport}")
if args.transport == 'streamable-http':
print(f" 🔗 URL: http://localhost:{port}")
print(f" 🔐 OAuth Callback: http://localhost:{port}/oauth2callback")
print(f" 🔗 URL: {base_uri}:{port}")
print(f" 🔐 OAuth Callback: {base_uri}:{port}/oauth2callback")
print(f" 👤 Mode: {'Single-user' if args.single_user else 'Multi-user'}")
print(f" 🐍 Python: {sys.version.split()[0]}")
print()
@@ -119,13 +120,13 @@ def main():
set_transport_mode(args.transport)
if args.transport == 'streamable-http':
print(f"🚀 Starting server on http://localhost:{port}")
print(f"🚀 Starting server on {base_uri}:{port}")
else:
print("🚀 Starting server in stdio mode")
# Start minimal OAuth callback server for stdio mode
from auth.oauth_callback_server import ensure_oauth_callback_available
if ensure_oauth_callback_available('stdio', port):
print(f" OAuth callback server started on http://localhost:{port}/oauth2callback")
if ensure_oauth_callback_available('stdio', port, base_uri):
print(f" OAuth callback server started on {base_uri}:{port}/oauth2callback")
else:
print(" ⚠️ Warning: Failed to start OAuth callback server")