diff --git a/mcp_server/server.py b/mcp_server/server.py index 7971472..d096023 100644 --- a/mcp_server/server.py +++ b/mcp_server/server.py @@ -32,10 +32,12 @@ mcp = FastMCP( # --------------------------------------------------------------------------- def _client() -> httpx.Client: - return httpx.Client(base_url=API_BASE, timeout=30.0) + return httpx.Client(base_url=API_BASE, timeout=30.0, follow_redirects=True) def _get(path: str, params: dict | None = None) -> Any: + if not path.endswith("/"): + path = path + "/" with _client() as c: r = c.get(path, params={k: v for k, v in (params or {}).items() if v is not None}) r.raise_for_status() @@ -52,6 +54,8 @@ def _post(path: str, body: dict) -> Any: def _patch(path: str, body: dict) -> Any: + if not path.endswith("/"): + path = path + "/" with _client() as c: r = c.patch(path, json={k: v for k, v in body.items() if v is not None}) r.raise_for_status()