get_path.pyā¢983 B
"""
Helper script to get the absolute path for MCP configuration
Run this to get the correct path to use in mcp_config.json
"""
import os
# Get the absolute path of this directory
current_dir = os.path.dirname(os.path.abspath(__file__))
mcp_server_path = os.path.join(current_dir, "mcp_server.py")
# Convert to format suitable for JSON (Windows backslashes)
if os.name == 'nt': # Windows
json_path = mcp_server_path.replace('\\', '\\\\')
else: # Unix-like
json_path = mcp_server_path
print("=" * 60)
print("MCP Server Configuration Helper")
print("=" * 60)
print(f"\nAbsolute path to mcp_server.py:")
print(f" {mcp_server_path}")
print(f"\nPath formatted for JSON (Windows):")
print(f" {json_path}")
print("\n" + "=" * 60)
print("\nCopy this into your Gemini CLI mcp_config.json:")
print("=" * 60)
print(f"""
{{
"mcpServers": {{
"weather-info": {{
"command": "python",
"args": ["{json_path}"],
"env": {{}}
}}
}}
}}
""")
print("=" * 60)