Fix OpenAPI endpoint to properly serve openapi.json file
This commit is contained in:
parent
22eb070bcc
commit
be8be95d8b
17
app.py
17
app.py
@ -196,6 +196,11 @@ def get_capabilities():
|
|||||||
"path": "/capabilities",
|
"path": "/capabilities",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"description": "MCP capabilities endpoint"
|
"description": "MCP capabilities endpoint"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/openapi.json",
|
||||||
|
"method": "GET",
|
||||||
|
"description": "OpenAPI specification"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"features": [
|
"features": [
|
||||||
@ -207,6 +212,18 @@ def get_capabilities():
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@app.route('/openapi.json', methods=['GET'])
|
||||||
|
def get_openapi():
|
||||||
|
"""Serve the OpenAPI specification file"""
|
||||||
|
try:
|
||||||
|
# Read the openapi.json file from the filesystem
|
||||||
|
with open('openapi.json', 'r') as f:
|
||||||
|
import json
|
||||||
|
spec = json.load(f)
|
||||||
|
return jsonify(spec)
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({"error": "OpenAPI specification not found"}), 404
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Fix the port issue by using a different port
|
# Fix the port issue by using a different port
|
||||||
app.run(host='0.0.0.0', port=4096, debug=True)
|
app.run(host='0.0.0.0', port=4096, debug=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user