From bd691f01b19bd5056b9e91ea8a00434b011e6799 Mon Sep 17 00:00:00 2001 From: "Jokob @NetAlertX" <96159884+jokob-sk@users.noreply.github.com> Date: Sun, 7 Dec 2025 10:51:18 +0000 Subject: [PATCH] MCP refactor + cryptography build prevention Signed-off-by: GitHub --- Dockerfile | 3 ++- server/api_server/api_server_start.py | 17 ----------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3ecf53fe..ef86ecae 100755 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,8 @@ RUN apk add --no-cache bash shadow python3 python3-dev gcc musl-dev libffi-dev o # Create virtual environment owned by root, but readable by everyone else. This makes it easy to copy # into hardened stage without worrying about permissions and keeps image size small. Keeping the commands # together makes for a slightly smaller image size. -RUN pip install --no-cache-dir -r /tmp/requirements.txt && \ +RUN python -m pip install --upgrade pip setuptools wheel && \ + pip install --no-cache-dir -r /tmp/requirements.txt && \ chmod -R u-rwx,g-rwx /opt # second stage is the main runtime stage with just the minimum required to run the application diff --git a/server/api_server/api_server_start.py b/server/api_server/api_server_start.py index 7725d013..00b420ad 100755 --- a/server/api_server/api_server_start.py +++ b/server/api_server/api_server_start.py @@ -3,7 +3,6 @@ import sys import os from flask import Flask, request, jsonify, Response -import requests from models.device_instance import DeviceInstance # noqa: E402 from flask_cors import CORS @@ -116,26 +115,10 @@ CORS( # MCP bridge variables + helpers (moved from mcp_routes) # ------------------------------------------------------------------------------- -mcp_openapi_spec_cache = None - BACKEND_PORT = get_setting_value("GRAPHQL_PORT") API_BASE_URL = f"http://localhost:{BACKEND_PORT}" -def get_openapi_spec_local(): - global mcp_openapi_spec_cache - if mcp_openapi_spec_cache: - return mcp_openapi_spec_cache - try: - resp = requests.get(f"{API_BASE_URL}/mcp/openapi.json", timeout=10) - resp.raise_for_status() - mcp_openapi_spec_cache = resp.json() - return mcp_openapi_spec_cache - except Exception as e: - mylog('minimal', [f"Error fetching OpenAPI spec: {e}"]) - return None - - @app.route('/mcp/sse', methods=['GET', 'POST']) def api_mcp_sse(): if not is_authorized():