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')