From 3fe6cfe5d5c67f6611378b6a32c1cbaae26ee70a Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 22 Jul 2026 02:47:29 +0000 Subject: [PATCH] chore: update opax-mcp/server.py via opax-mcp --- opax-mcp/server.py | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/opax-mcp/server.py b/opax-mcp/server.py index da7c10a..5a3067d 100644 --- a/opax-mcp/server.py +++ b/opax-mcp/server.py @@ -4,7 +4,6 @@ Auth: Authorization: Bearer OR X-MCP-Secret: OR api-key: < """ import os import json -import uuid import httpx import base64 import google.auth @@ -16,7 +15,6 @@ from google.oauth2 import service_account from fastapi import FastAPI, Request, HTTPException from fastapi.responses import JSONResponse from email.mime.text import MIMEText -from email.mime.text import MIMEText from datetime import datetime, timezone, timedelta from typing import Any, Optional import logging @@ -662,35 +660,6 @@ async def mcp_handler(request: Request): if method.startswith("notifications/"): return JSONResponse(status_code=202, content={}) return JSONResponse(_jsonrpc_err(req_id, -32601, f"Method not found: {method}"), status_code=404) - -async def start_gce_instance(p: dict) -> tuple: - """Starts a GCE instance. Assumes us-central1-b if zone is not specified.""" - import subprocess - instance = p.get("instance") - zone = p.get("zone", "us-central1-b") # Default zone assumption - if not instance: raise ValueError("Missing required parameter: 'instance'") - - result = subprocess.run(["gcloud", "compute", "instances", "start", instance, f"--zone={zone}", f"--project={GOOGLE_CLOUD_PROJECT}"], capture_output=True, text=True, check=False) - if result.returncode != 0: return ({"error": result.stderr}, {"status": "Error", "next_action": "Check instance name and permissions."}) - - raw_data = {"status": f"Start command issued for {instance}."} - custom_meta = {"status": f"Start-kommando sendt til '{instance}'.", "next_action": "Vent 30s og sjekk status med `list_gce_instances`.", "choices": [{"id": f"list_gce_instances", "label": "Sjekk status nå", "style": "primary"}]} - return (raw_data, custom_meta) - -async def stop_gce_instance(p: dict) -> tuple: - """Stops a GCE instance. Assumes us-central1-b if zone is not specified.""" - import subprocess - instance = p.get("instance") - zone = p.get("zone", "us-central1-b") # Default zone assumption - if not instance: raise ValueError("Missing required parameter: 'instance'") - - result = subprocess.run(["gcloud", "compute", "instances", "stop", instance, f"--zone={zone}", f"--project={GOOGLE_CLOUD_PROJECT}"], capture_output=True, text=True, check=False) - if result.returncode != 0: return ({"error": result.stderr}, {"status": "Error", "next_action": "Check instance name and permissions."}) - - raw_data = {"status": f"Stop command issued for {instance}."} - custom_meta = {"status": f"Stopp-kommando sendt til '{instance}'.", "next_action": "Vent 30s og sjekk status med `list_gce_instances`.", "choices": [{"id": f"list_gce_instances", "label": "Sjekk status nå", "style": "primary"}]} - return (raw_data, custom_meta) - # --------------------------------------------------------------------------- # Health (keepalive) # ---------------------------------------------------------------------------