diff --git a/openproject-mcp.py b/openproject-mcp.py index 5330461..7ed731f 100644 --- a/openproject-mcp.py +++ b/openproject-mcp.py @@ -297,6 +297,18 @@ async def create_work_package(self, data: Dict) -> Dict: if "date" in data: payload["date"] = data["date"] + # Add custom fields (customField1, customField2, etc.) + if "_links" not in payload: + payload["_links"] = {} + for key, value in data.items(): + if key.startswith("customField"): + if isinstance(value, dict) and "href" in value: + # List-type custom field - add to _links + payload["_links"][key] = value + else: + # Text/number custom field - add directly + payload[key] = value + # Create work package return await self._request("POST", "/work_packages", payload) @@ -499,6 +511,18 @@ async def update_work_package(self, work_package_id: int, data: Dict) -> Dict: if "date" in data: payload["date"] = data["date"] + # Add custom fields (customField1, customField2, etc.) + if "_links" not in payload: + payload["_links"] = {} + for key, value in data.items(): + if key.startswith("customField"): + if isinstance(value, dict) and "href" in value: + # List-type custom field - add to _links + payload["_links"][key] = value + else: + # Text/number custom field - add directly + payload[key] = value + return await self._request( "PATCH", f"/work_packages/{work_package_id}", payload )