Spaces:
Sleeping
Sleeping
Upload 8 files
Browse files- Dockerfile +2 -2
- arithmetic_server.py +1 -1
- backend.py +4 -6
- stock_server.py +1 -1
Dockerfile
CHANGED
@@ -24,5 +24,5 @@ EXPOSE 8501
|
|
24 |
# Health check for Streamlit
|
25 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
26 |
|
27 |
-
# Run Streamlit
|
28 |
-
CMD
|
|
|
24 |
# Health check for Streamlit
|
25 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
|
26 |
|
27 |
+
# Run MCP servers in background, then Streamlit (using shell for &)
|
28 |
+
CMD sh -c "python /app/arithmetic_server.py & python /app/stock_server.py & sleep 5 && streamlit run /app/frontend.py --server.port=8501 --server.address=0.0.0.0"
|
arithmetic_server.py
CHANGED
@@ -27,4 +27,4 @@ def divide(a: int, b: int) -> float:
|
|
27 |
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
-
mcp.run(transport="
|
|
|
27 |
|
28 |
|
29 |
if __name__ == "__main__":
|
30 |
+
mcp.run(transport="streamable_http", port=8001, address="0.0.0.0")
|
backend.py
CHANGED
@@ -174,14 +174,12 @@ class MCPAgent:
|
|
174 |
# Start the Stock server separately first: `python stockserver.py`
|
175 |
self.client = MultiServerMCPClient({
|
176 |
"arithmetic": {
|
177 |
-
"
|
178 |
-
"
|
179 |
-
"transport": "stdio",
|
180 |
},
|
181 |
"stocks": {
|
182 |
-
"
|
183 |
-
"
|
184 |
-
"transport": "stdio",
|
185 |
},
|
186 |
}
|
187 |
)
|
|
|
174 |
# Start the Stock server separately first: `python stockserver.py`
|
175 |
self.client = MultiServerMCPClient({
|
176 |
"arithmetic": {
|
177 |
+
"url": "http://localhost:8001/mcp",
|
178 |
+
"transport": "streamable_http",
|
|
|
179 |
},
|
180 |
"stocks": {
|
181 |
+
"url": "http://localhost:8002/mcp",
|
182 |
+
"transport": "streamable_http",
|
|
|
183 |
},
|
184 |
}
|
185 |
)
|
stock_server.py
CHANGED
@@ -60,4 +60,4 @@ async def get_company_news(symbol: str, limit: int = 3) -> str:
|
|
60 |
3. {symbol} unveils new product line for 2025"""
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
-
mcp.run(transport="
|
|
|
60 |
3. {symbol} unveils new product line for 2025"""
|
61 |
|
62 |
if __name__ == "__main__":
|
63 |
+
mcp.run(transport="streamable_http", port=8002, address="0.0.0.0")
|