Skip to content

Feat - Multiple tool enhancements for managing work package tasks#1

Open
WSJUSA wants to merge 18 commits intowidjis:mainfrom
WSJUSA:main
Open

Feat - Multiple tool enhancements for managing work package tasks#1
WSJUSA wants to merge 18 commits intowidjis:mainfrom
WSJUSA:main

Conversation

@WSJUSA
Copy link
Copy Markdown

@WSJUSA WSJUSA commented Aug 28, 2025

  1. Added path normalization for Windows in src/index.ts to fix main module check compatibility with Windows file paths. Addresses TypeScript strict null checks and ensures cross-platform compatibility.

  1. OpenProject work package descriptions were displaying as [object Object] in MCP output, and description updates were failing silently due to incorrect API payload formatting.

Solution: Implemented comprehensive description handling across all work package operations:

Added extractDescriptionText utility to convert OpenProject's object-based descriptions to readable strings
Fixed getWorkPackages to properly extract description text for display
Fixed createWorkPackage & updateWorkPackage to transform string descriptions to proper OpenProject API format ({ format: 'text', raw: 'content' })

Result:
✅ Descriptions now display correctly instead of [object Object]
✅ Description updates work reliably for both new and existing work packages
✅ Consistent behavior across all work package operations

Testing: Verified with test ticket creation, update, and retrieval operations. All description formatting now works as expected.


  1. Add set Status on Work Package Tasks tool
    Also has a supporting tool to get global status list. Not all statuses are valid and it tries to exit gracefully. No known way to get a list of valid status transitions via API. Is what it is.

4 New MCP Tools for project membership and role management /assignments. Makes it easier to add a user to a project to be able to assign them to a ticket.

WSJUSA added 2 commits August 28, 2025 14:53
- Add extractDescriptionText utility method to convert description objects to readable strings
- Fix getWorkPackages to extract description text for all work packages in collection
- Fix getWorkPackage to extract description text for individual work packages
- Fix createWorkPackage to transform string descriptions to proper OpenProject API format
- Fix updateWorkPackage to transform string descriptions to proper OpenProject API format
- Add comprehensive logging and error handling for all methods

This resolves the '[object Object]' display issue and ensures descriptions are properly stored and retrieved in both create and update operations.
@WSJUSA WSJUSA changed the title make main module check compatible with windows paths Fix description saving for workpackages and make main module check compatible with windows paths Aug 28, 2025
@WSJUSA WSJUSA changed the title Fix description saving for workpackages and make main module check compatible with windows paths Fix description saving for workpackages, add set status on tasks, make main module check compatible with windows paths Aug 29, 2025
## � Core Features Implemented

### 1. Membership Management (CRUD Operations)
- **List Memberships**: Retrieve all project memberships with filtering/pagination support
- **Get Membership**: Retrieve specific membership details by ID
- **Create Membership**: Add users to projects with specific roles
- **Update Membership**: Modify existing user roles within projects
- **Delete Membership**: Remove user access from projects

### 2. Role Management
- **List Roles**: Retrieve all available system roles
- **Get Role**: Retrieve specific role details by ID

### 3. MCP Tool Integration
- **7 New MCP Tools**: Complete tool set for membership and role operations
- **Zod Schema Validation**: Type-safe argument validation for all tools
- **Comprehensive Error Handling**: Proper error responses and logging

### 4. Technical Implementation
- **TypeScript Types**: Complete type definitions for Membership and Role entities
- **OpenProject Client**: New client methods for all membership operations
- **Tool Handlers**: MCP tool handlers with proper response formatting
- **API Integration**: Direct OpenProject API integration with authentication

### 5. Schema & Validation
- **Membership Schema**: Proper _links structure matching OpenProject API
- **Role Schema**: Simplified schema matching actual API responses
- **Collection Responses**: Support for paginated membership and role lists

## � Files Modified
- src/types/openproject.ts: Added Membership and Role schemas/types
- src/tools/index.ts: Added 7 new MCP tool definitions
- src/client/openproject-client.ts: Added membership CRUD client methods
- src/handlers/tool-handlers.ts: Added comprehensive tool handlers

## ✅ Testing & Validation
- **Direct API Testing**: Verified all endpoints with curl before implementation
- **End-to-End Testing**: All 7 tools tested and working correctly
- **Schema Validation**: Zod validation passing for all operations
- **Real-World Usage**: Successfully used to solve project assignment issues

## � Production Ready
- Complete membership lifecycle management
- Proper error handling and logging
- Following repository development standards
- Ready for production deployment

Resolves: Ticket #50 - Add User Project Membership Management to OpenProject MCP Server
@WSJUSA WSJUSA changed the title Fix description saving for workpackages, add set status on tasks, make main module check compatible with windows paths Multiple tool enhancements for managing work package tasks Aug 29, 2025
@WSJUSA WSJUSA changed the title Multiple tool enhancements for managing work package tasks Feat - Multiple tool enhancements for managing work package tasks Aug 29, 2025
WSJUSA added 14 commits August 29, 2025 16:18
…property display

- Fix getWorkPackage and getWorkPackages methods to properly transform _links.status, _links.project, _links.type, etc.
- Resolves bug where status, project, and type fields showed "Unknown" instead of actual values
- Ensures MCP tools display meaningful work package information from OpenProject API responses
Transform OpenProject API response data to properly display status, project, and type information
Extract common transformation logic into utility method, eliminating code duplication across work package methods
- Add upload_attachment tool for uploading files to work packages
- Add get_attachments tool for retrieving work package attachments
- Implement AttachmentSchema and AttachmentCollectionResponseSchema types
- Add uploadAttachment() and getWorkPackageAttachments() methods to OpenProjectClient
- Add proper multipart form data handling using FormData
- Add form-data dependency and types
- Full TypeScript support with Zod validation
- Comprehensive error handling and logging
- Follows OpenProject REST API standards for file uploads

API Endpoints:
- POST /api/v3/work_packages/{id}/attachments - Upload files
- GET /api/v3/work_packages/{id}/attachments - List attachments

Implementation is complete and ready for testing.
… content

- Updated UploadAttachmentArgsSchema to use filePath instead of fileName/fileContent/contentType
- Modified uploadAttachment method in OpenProjectClient to read files from filesystem
- Added automatic content type detection based on file extension
- Updated tool handler to use new signature
- MCP server now handles all file reading and encoding requirements
- Add formatSortByParameter method to handle different API endpoint formats
- Projects API: sort=field:direction format
- Work Packages API: sortBy=[[field,direction]] format
- Support multiple sort criteria and direction normalization
- Fix API errors when using sortBy parameter
- Tested with projects and work packages sorting

Resolves ticket 121 - OpenProject Projects SortBy bug
- Add upload_attachment tool to upload files to work packages
- Add get_attachments tool to retrieve work package attachments
- Implement manual multipart form data construction for API compliance
- Add comprehensive MIME type detection for 25+ file formats
- Update attachment schemas to match OpenProject API response format
- Add proper error handling and logging for file operations
- Fix attachment description handling for string/object formats

Closes ticket #120: Feat - add upload tool to OpenProject MCP
- Add upload attachment tools for OpenProject MCP
- Implements file upload and attachment retrieval functionality
- Fixes merge conflicts by choosing feature branch implementation
- Add CreateTaskArgsSchema for task creation parameters
- Add create_task tool definition with simplified interface
- Implement handleCreateTask method that automatically sets typeId to 1 (Task)
- Register the new tool and handler in the MCP server
- Update exports to include CreateTaskArgsSchema

The create_task tool provides a convenient wrapper around create_work_package
that automatically sets the work package type to Task (ID: 1), eliminating
the need for users to remember type IDs and avoiding parameter validation
issues with other type IDs.

Task ID: 140 - Feat - Add create_task tool to OpenProject MCP
… handling; implement handler; tests via MCP complete (ticket 139)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant