mcp: resolve openapi.json from env/in-repo/same-dir so a standalone copy works
This commit is contained in:
@@ -34,7 +34,15 @@ from fastmcp import FastMCP
|
|||||||
from fastmcp.server.openapi import MCPType, RouteMap
|
from fastmcp.server.openapi import MCPType, RouteMap
|
||||||
|
|
||||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
_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',
|
BASE = os.environ.get('SHOPDB_BASE',
|
||||||
'https://tsgwp00525.wjs.geaerospace.net/shopdb')
|
'https://tsgwp00525.wjs.geaerospace.net/shopdb')
|
||||||
|
|||||||
Reference in New Issue
Block a user