-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
33 lines (25 loc) · 884 Bytes
/
Copy pathmain.py
File metadata and controls
33 lines (25 loc) · 884 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import annotations
import os
from fred_mcp.config import load_dotenv_if_available
from fred_mcp.server import mcp
def main() -> None:
load_dotenv_if_available()
transport = os.getenv("MCP_TRANSPORT")
if transport in {"http", "streamable-http", "sse"}:
mcp.run(
transport=transport,
host=os.getenv("MCP_HOST", "127.0.0.1"),
port=int(os.getenv("MCP_PORT", "8000")),
path=os.getenv("MCP_PATH", "/mcp"),
stateless_http=_bool_env("MCP_STATELESS_HTTP", True),
json_response=_bool_env("MCP_JSON_RESPONSE", True),
)
return
mcp.run()
def _bool_env(name: str, default: bool) -> bool:
value = os.getenv(name)
if value is None:
return default
return value.strip().lower() in {"1", "true", "yes", "on"}
if __name__ == "__main__":
main()