KhalilGuetari commited on
Commit
7f6faa9
Β·
1 Parent(s): 1b746fa

Enable mcp only with gradio based spaces

Browse files
README.md CHANGED
@@ -3,7 +3,9 @@ title: HF EDA MCP Server
3
  emoji: πŸ”
4
  colorFrom: blue
5
  colorTo: purple
6
- sdk: docker
 
 
7
  pinned: false
8
  license: apache-2.0
9
  app_port: 7860
 
3
  emoji: πŸ”
4
  colorFrom: blue
5
  colorTo: purple
6
+ sdk: gradio
7
+ sdk_version: 5.49.1
8
+ app_file: src/app.py
9
  pinned: false
10
  license: apache-2.0
11
  app_port: 7860
app.py β†’ src/app.py RENAMED
@@ -5,20 +5,13 @@ This file is used when deploying to HuggingFace Spaces.
5
  It imports and launches the main Gradio application.
6
  """
7
 
8
- # import os
9
- # import sys
10
-
11
- # Add src directory to path for imports (needed for HF Spaces)
12
- # sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))
13
-
14
- # from src.hf_eda_mcp.server import create_gradio_app
15
- from hf_eda_mcp.server import create_gradio_app
16
 
17
  # Create and launch the Gradio app
18
  if __name__ == "__main__":
19
- app = create_gradio_app()
20
- app.launch(
21
- server_name="0.0.0.0",
22
- server_port=7860,
23
- share=False
24
  )
 
5
  It imports and launches the main Gradio application.
6
  """
7
 
8
+ from hf_eda_mcp.server import launch_server
9
+ from hf_eda_mcp.config import ServerConfig
 
 
 
 
 
 
10
 
11
  # Create and launch the Gradio app
12
  if __name__ == "__main__":
13
+ launch_server(
14
+ config=ServerConfig.from_env(),
15
+ mcp_server=True,
16
+ port=7860,
 
17
  )
src/hf_eda_mcp/config.py CHANGED
@@ -18,7 +18,7 @@ class ServerConfig:
18
 
19
  # Server settings
20
  port: int = 7860
21
- host: str = "127.0.0.1"
22
  mcp_server: bool = True
23
  share: bool = False
24
 
 
18
 
19
  # Server settings
20
  port: int = 7860
21
+ host: str = "0.0.0.0"
22
  mcp_server: bool = True
23
  share: bool = False
24
 
src/hf_eda_mcp/server.py CHANGED
@@ -323,9 +323,3 @@ def launch_server(
323
  logger.error(f"❌ Failed to launch server: {e}")
324
  logger.exception("Full traceback:")
325
  sys.exit(1)
326
-
327
-
328
- if __name__ == "__main__":
329
- # Load configuration from environment and launch server
330
- config = ServerConfig.from_env()
331
- launch_server(config)
 
323
  logger.error(f"❌ Failed to launch server: {e}")
324
  logger.exception("Full traceback:")
325
  sys.exit(1)