Spaces:
Sleeping
Sleeping
Update mcp_output/start_mcp.py
Browse files- mcp_output/start_mcp.py +5 -5
mcp_output/start_mcp.py
CHANGED
|
@@ -17,13 +17,11 @@ project_root = os.path.dirname(current_dir)
|
|
| 17 |
if project_root not in sys.path:
|
| 18 |
sys.path.insert(0, project_root)
|
| 19 |
|
| 20 |
-
from mcp_service import
|
| 21 |
|
| 22 |
|
| 23 |
def main():
|
| 24 |
"""Start FastMCP service"""
|
| 25 |
-
app = create_app()
|
| 26 |
-
|
| 27 |
# Use environment variable to configure port, default 7860 (HuggingFace default)
|
| 28 |
port = int(os.environ.get("MCP_PORT", "7860"))
|
| 29 |
|
|
@@ -35,10 +33,12 @@ def main():
|
|
| 35 |
|
| 36 |
if transport == "http":
|
| 37 |
print(f"Port: {port}")
|
| 38 |
-
|
|
|
|
|
|
|
| 39 |
else:
|
| 40 |
# Default to STDIO mode
|
| 41 |
-
|
| 42 |
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|
|
|
|
| 17 |
if project_root not in sys.path:
|
| 18 |
sys.path.insert(0, project_root)
|
| 19 |
|
| 20 |
+
from mcp_service import mcp
|
| 21 |
|
| 22 |
|
| 23 |
def main():
|
| 24 |
"""Start FastMCP service"""
|
|
|
|
|
|
|
| 25 |
# Use environment variable to configure port, default 7860 (HuggingFace default)
|
| 26 |
port = int(os.environ.get("MCP_PORT", "7860"))
|
| 27 |
|
|
|
|
| 33 |
|
| 34 |
if transport == "http":
|
| 35 |
print(f"Port: {port}")
|
| 36 |
+
print(f"SSE endpoint: http://0.0.0.0:{port}/sse")
|
| 37 |
+
# FastMCP 2.x 使用 streamable-http 传输
|
| 38 |
+
mcp.run(transport="sse", host="0.0.0.0", port=port)
|
| 39 |
else:
|
| 40 |
# Default to STDIO mode
|
| 41 |
+
mcp.run()
|
| 42 |
|
| 43 |
|
| 44 |
if __name__ == "__main__":
|