Kaballas commited on
Commit
401cfcb
Β·
1 Parent(s): ba43a31
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -1,9 +1,21 @@
1
  from fastapi import FastAPI
2
  from fastapi_mcp import FastApiMCP
 
3
 
4
- app = FastAPI()
 
 
 
 
 
5
 
 
6
  mcp = FastApiMCP(app)
7
 
 
 
 
 
 
8
  # Mount the MCP server directly to your FastAPI app
9
- mcp.mount()
 
1
  from fastapi import FastAPI
2
  from fastapi_mcp import FastApiMCP
3
+ import requests
4
 
5
+ def get_public_ip():
6
+ try:
7
+ response = requests.get('https://api.ipify.org?format=json')
8
+ return response.json().get('ip')
9
+ except Exception as e:
10
+ return f"Error: {e}"
11
 
12
+ app = FastAPI()
13
  mcp = FastApiMCP(app)
14
 
15
+ # Print IP immediately when module loads
16
+ public_ip = get_public_ip()
17
+ print(f"🌐 Public IP address: {public_ip}")
18
+ print(f"πŸ”— MCP Server will be accessible at: http://{public_ip}:8000/mcp")
19
+
20
  # Mount the MCP server directly to your FastAPI app
21
+ mcp.mount()