Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions openproject-mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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
)
Expand Down