Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from mcp.server.fastmcp import FastMCP
|
| 2 |
import httpx
|
| 3 |
import os
|
|
|
|
| 4 |
|
| 5 |
# SAP API Configuration
|
| 6 |
SAP_API_URL = "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata4/sap/api_purchaserequisition_2/srvd_a2x/sap/purchaserequisition/0001/PurchaseReqn"
|
|
@@ -26,7 +27,7 @@ async def get_purchase_requisitions(top: int = 50) -> dict:
|
|
| 26 |
}
|
| 27 |
|
| 28 |
params = {
|
| 29 |
-
"$top": min(top, 100)
|
| 30 |
}
|
| 31 |
|
| 32 |
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
@@ -84,6 +85,9 @@ async def get_purchase_requisition_summary(top: int = 10) -> str:
|
|
| 84 |
|
| 85 |
return summary
|
| 86 |
|
|
|
|
|
|
|
|
|
|
| 87 |
if __name__ == "__main__":
|
| 88 |
-
|
| 89 |
-
|
|
|
|
| 1 |
from mcp.server.fastmcp import FastMCP
|
| 2 |
import httpx
|
| 3 |
import os
|
| 4 |
+
import uvicorn
|
| 5 |
|
| 6 |
# SAP API Configuration
|
| 7 |
SAP_API_URL = "https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata4/sap/api_purchaserequisition_2/srvd_a2x/sap/purchaserequisition/0001/PurchaseReqn"
|
|
|
|
| 27 |
}
|
| 28 |
|
| 29 |
params = {
|
| 30 |
+
"$top": min(top, 100)
|
| 31 |
}
|
| 32 |
|
| 33 |
async with httpx.AsyncClient(timeout=30.0) as client:
|
|
|
|
| 85 |
|
| 86 |
return summary
|
| 87 |
|
| 88 |
+
# Create ASGI app
|
| 89 |
+
app = mcp.http_app()
|
| 90 |
+
|
| 91 |
if __name__ == "__main__":
|
| 92 |
+
port = int(os.getenv("PORT", 7860))
|
| 93 |
+
uvicorn.run(app, host="0.0.0.0", port=port)
|