From 5f02e488eba82fd253145d7395a9461e79649ed3 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 30 Jul 2026 09:30:39 -0400 Subject: [PATCH] mcp: resolve openapi.json from env/in-repo/same-dir so a standalone copy works --- mcp/shopdb_mcp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mcp/shopdb_mcp.py b/mcp/shopdb_mcp.py index 43d0631..b92432e 100644 --- a/mcp/shopdb_mcp.py +++ b/mcp/shopdb_mcp.py @@ -34,7 +34,15 @@ from fastmcp import FastMCP from fastmcp.server.openapi import MCPType, RouteMap _HERE = os.path.dirname(os.path.abspath(__file__)) -_SPEC = os.path.join(_HERE, '..', 'docs', 'openapi.json') +# Find the OpenAPI spec: explicit env, the in-repo docs/, or next to this script +# (so a standalone copy of mcp/ with openapi.json beside it just works). +_SPEC_CANDIDATES = [ + os.environ.get('SHOPDB_OPENAPI'), + os.path.join(_HERE, '..', 'docs', 'openapi.json'), + os.path.join(_HERE, 'openapi.json'), +] +_SPEC = next((p for p in _SPEC_CANDIDATES if p and os.path.isfile(p)), + _SPEC_CANDIDATES[1]) BASE = os.environ.get('SHOPDB_BASE', 'https://tsgwp00525.wjs.geaerospace.net/shopdb')