LiamKhoaLe commited on
Commit
becbb85
·
1 Parent(s): 15dc1af

Upd gemini mcp server script

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -200,18 +200,18 @@ global_mcp_session = None
200
  global_mcp_stdio_ctx = None # Store stdio context to keep it alive
201
  global_mcp_lock = threading.Lock() # Lock for thread-safe session access
202
  # MCP server configuration via environment variables
203
- # Gemini MCP server: Python-based server (gemini_mcp_server.py)
204
  # This works on Hugging Face Spaces without requiring npm/Node.js
205
  # Make sure GEMINI_API_KEY is set in environment variables
206
  #
207
- # Default configuration uses the bundled gemini_mcp_server.py script
208
  # To override:
209
  # export MCP_SERVER_COMMAND="python"
210
- # export MCP_SERVER_ARGS="/path/to/gemini_mcp_server.py"
211
  script_dir = os.path.dirname(os.path.abspath(__file__))
212
- gemini_mcp_server_path = os.path.join(script_dir, "gemini_mcp_server.py")
213
  MCP_SERVER_COMMAND = os.environ.get("MCP_SERVER_COMMAND", "python")
214
- MCP_SERVER_ARGS = os.environ.get("MCP_SERVER_ARGS", gemini_mcp_server_path).split() if os.environ.get("MCP_SERVER_ARGS") else [gemini_mcp_server_path]
215
 
216
  async def get_mcp_session():
217
  """Get or create MCP client session with proper context management"""
 
200
  global_mcp_stdio_ctx = None # Store stdio context to keep it alive
201
  global_mcp_lock = threading.Lock() # Lock for thread-safe session access
202
  # MCP server configuration via environment variables
203
+ # Gemini MCP server: Python-based server (gemini_mcp.py)
204
  # This works on Hugging Face Spaces without requiring npm/Node.js
205
  # Make sure GEMINI_API_KEY is set in environment variables
206
  #
207
+ # Default configuration uses the bundled gemini_mcp.py script
208
  # To override:
209
  # export MCP_SERVER_COMMAND="python"
210
+ # export MCP_SERVER_ARGS="/path/to/gemini_mcp.py"
211
  script_dir = os.path.dirname(os.path.abspath(__file__))
212
+ gemini_mcp_path = os.path.join(script_dir, "gemini_mcp.py")
213
  MCP_SERVER_COMMAND = os.environ.get("MCP_SERVER_COMMAND", "python")
214
+ MCP_SERVER_ARGS = os.environ.get("MCP_SERVER_ARGS", gemini_mcp_path).split() if os.environ.get("MCP_SERVER_ARGS") else [gemini_mcp_path]
215
 
216
  async def get_mcp_session():
217
  """Get or create MCP client session with proper context management"""