Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -254,44 +254,5 @@ def test_connection() -> str:
|
|
254 |
"""
|
255 |
return "MCP server is working correctly!"
|
256 |
|
257 |
-
@mcp.get("/health")
|
258 |
-
def health_check():
|
259 |
-
"""Health check endpoint for Docker"""
|
260 |
-
return {"status": "healthy", "flask_api_url": FLASK_API_URL}
|
261 |
-
|
262 |
-
@mcp.tool()
|
263 |
-
def check_flask_api() -> dict:
|
264 |
-
"""
|
265 |
-
Checks if the Flask API is available and responding.
|
266 |
-
Returns:
|
267 |
-
dict: Status of the Flask API connection.
|
268 |
-
"""
|
269 |
-
try:
|
270 |
-
response = requests.get(f"{FLASK_API_URL}/", timeout=5)
|
271 |
-
if response.status_code == 200:
|
272 |
-
return {
|
273 |
-
"status": "connected",
|
274 |
-
"message": f"Flask API is available at {FLASK_API_URL}",
|
275 |
-
"flask_status_code": response.status_code
|
276 |
-
}
|
277 |
-
else:
|
278 |
-
return {
|
279 |
-
"status": "error",
|
280 |
-
"message": f"Flask API returned status code {response.status_code}",
|
281 |
-
"flask_status_code": response.status_code
|
282 |
-
}
|
283 |
-
except requests.exceptions.ConnectionError:
|
284 |
-
return {
|
285 |
-
"status": "disconnected",
|
286 |
-
"message": f"Cannot connect to Flask API at {FLASK_API_URL}. Make sure app.py is running.",
|
287 |
-
"flask_status_code": None
|
288 |
-
}
|
289 |
-
except Exception as e:
|
290 |
-
return {
|
291 |
-
"status": "error",
|
292 |
-
"message": f"Error checking Flask API: {str(e)}",
|
293 |
-
"flask_status_code": None
|
294 |
-
}
|
295 |
-
|
296 |
|
297 |
mcp.run(transport="sse")
|
|
|
254 |
"""
|
255 |
return "MCP server is working correctly!"
|
256 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
|
258 |
mcp.run(transport="sse")
|