Change default binding from 0.0.0.0 to 127.0.0.1 to align with security recommendations (#738)
This commit is contained in:
parent
43ded92633
commit
2ca2de767b
7 changed files with 7 additions and 7 deletions
|
|
@ -114,7 +114,7 @@ def main(port: int, transport: str) -> int:
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
else:
|
else:
|
||||||
from mcp.server.stdio import stdio_server
|
from mcp.server.stdio import stdio_server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ def main(port: int, transport: str) -> int:
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
else:
|
else:
|
||||||
from mcp.server.stdio import stdio_server
|
from mcp.server.stdio import stdio_server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,6 @@ def main(
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -164,6 +164,6 @@ def main(
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ def main(port: int, transport: str) -> int:
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
|
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
else:
|
else:
|
||||||
from mcp.server.stdio import stdio_server
|
from mcp.server.stdio import stdio_server
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class Settings(BaseSettings, Generic[LifespanResultT]):
|
||||||
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
|
log_level: Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "INFO"
|
||||||
|
|
||||||
# HTTP settings
|
# HTTP settings
|
||||||
host: str = "0.0.0.0"
|
host: str = "127.0.0.1"
|
||||||
port: int = 8000
|
port: int = 8000
|
||||||
mount_path: str = "/" # Mount path (e.g. "/github", defaults to root path)
|
mount_path: str = "/" # Mount path (e.g. "/github", defaults to root path)
|
||||||
sse_path: str = "/sse"
|
sse_path: str = "/sse"
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ Example usage:
|
||||||
|
|
||||||
# Create and run Starlette app
|
# Create and run Starlette app
|
||||||
starlette_app = Starlette(routes=routes)
|
starlette_app = Starlette(routes=routes)
|
||||||
uvicorn.run(starlette_app, host="0.0.0.0", port=port)
|
uvicorn.run(starlette_app, host="127.0.0.1", port=port)
|
||||||
```
|
```
|
||||||
|
|
||||||
Note: The handle_sse function must return a Response to avoid a "TypeError: 'NoneType'
|
Note: The handle_sse function must return a Response to avoid a "TypeError: 'NoneType'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue