Polarion ALM MCP Server
Project description
Polarion ALM MCP Server
A Model Context Protocol (MCP) server for Polarion ALM (Application Lifecycle Management) integration. This server provides comprehensive tools for managing projects, work items, attachments, comments, linked work items, and other ALM operations through the Polarion REST API.
Features
- Project Management: List and retrieve project information with flexible field filtering
- Work Item Operations: Create, read, update, delete, and query work items with full relationship support
- Assignee Management: Add and retrieve work item assignees
- Attachment Handling: Upload, list, download, and remove attachments
- Comment System: Add, list, update, and remove comments with structured data support
- Linked Work Items: Create, update, delete, and query linked work items with role-based relationships
- Advanced Query Support: Comprehensive query parameters including pagination, field filtering, and includes
- Relationship Management: Detailed support for assignees, categories, linked revisions, votes, and watches
Installation
Option 1: Local Development Setup
- Clone this repository:
git clone <repository-url>
cd alm-mcp
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables (optional):
cp .env.example .env
# Edit .env with your Polarion credentials
Option 2: Package Installation (Future)
# For future package distribution
uvx alm-mcp
# or
pip install alm-mcp
Configuration
The MCP server supports multiple configuration methods with the following priority:
- Command line arguments (highest priority)
- Environment variables (lower priority)
Authentication
For security reasons, only personal access tokens are supported:
POLARION_ACCESS_TOKENor--access-token
Environment Variables
Create a .env file with the following variables:
POLARION_BASE_URL=your-alm-base-url
POLARION_ACCESS_TOKEN=your-access-token
Usage
Running the Server Directly
# Using environment variables
python main.py
# Using command line arguments
python main.py --base-url "your-alm-base-url" --access-token "your-token"
# Mixed approach (args override env vars)
python main.py --access-token "your-token"
VS Code Integration with GitHub Copilot
Setup Steps
-
Install GitHub Copilot Extension in VS Code
-
Create MCP Configuration: Add the following to your project's
.vscode/mcp.json:
{
"mcpServers": {
"alm-mcp-server": {
"command": "python",
"args": ["/absolute/path/to/alm-mcp/main.py"],
"env": {
"POLARION_BASE_URL": "your-alm-base-url",
"POLARION_ACCESS_TOKEN": "${input:alm_access_token}"
},
"type": "stdio"
}
},
"inputs": [
{
"type": "promptString",
"id": "alm_access_token",
"description": "ALM Access Token",
"password": true
}
]
}
-
Update File Paths: Replace
/absolute/path/to/alm-mcp/main.pywith the actual path to yourmain.pyfile -
Restart VS Code to load the MCP server configuration
Available Tools (25 APIs)
Project Operations
get_projects- Get all projectsget_project- Get specific project information
Work Item Operations
get_all_work_items- Get all work items in a projectget_work_item- Get specific work itemcreate_work_item- Create new work itemupdate_work_item- Update existing work itemdelete_work_item- Delete work itemquery_work_items- Query work items using Lucene syntax
Assignee Operations
get_assignees- Get work item assigneesadd_assignee- Add assignee to work item
Attachment Operations
get_attachments- Get work item attachmentsadd_attachment- Add attachment to work itemremove_attachment- Remove attachment from work itemdownload_attachment- Download attachment content
Comment Operations
get_comments- Get work item commentsget_comment_details- Get specific comment detailsadd_comment- Add comment to work itemupdate_comment- Update specific commentremove_comment- Remove comment from work item
Linked Work Items Operations
create_linked_work_items- Create linked work itemsget_linked_work_items- Get all linked work itemsget_linked_work_item- Get specific linked work itemupdate_linked_work_item- Update specific linked work itemdelete_linked_work_items- Delete multiple linked work itemsdelete_linked_work_item- Delete specific linked work item
Query Parameters
Most API endpoints support comprehensive query parameters for filtering and pagination:
Field Filtering
Use fields parameter to specify which fields to return:
{
"fields": {
"workitems": "@basic",
"categories": "@all",
"workitem_comments": "@basic"
}
}
Available field types:
categories,collections,document_attachments,document_commentsdocument_parts,documents,enumerations,externallylinkedworkitemsfeatureselections,globalroles,icons,jobs,linkedoslcresourceslinkedworkitems,page_attachments,pages,plans,projectrolesprojects,projecttemplates,revisions,testparameter_definitionstestparameters,testrecord_attachments,testrecords,testrun_attachmentstestrun_comments,testruns,teststep_results,teststepresult_attachmentsteststeps,usergroups,users,workitem_approvals,workitem_attachmentsworkitem_comments,workitems,workrecords
Field values:
@basic- Basic set of fields@all- All available fields- Custom comma-separated field list
Pagination
{
"page_size": 50,
"page_number": 1
}
Additional Parameters
{
"include": "related_entities",
"revision": "revision_id"
}
Body Parameters
Work Item Creation/Update
{
"data": {
"type": "workitems",
"id": "WORK_ITEM_ID",
"attributes": {
"title": "Work Item Title",
"description": {
"type": "text/html",
"value": "<p>Description content</p>"
},
"dueDate": "2024-12-31",
"priority": "high",
"status": "open",
"severity": "major",
"hyperlinks": [
{
"role": "external_ref",
"title": "External Link",
"uri": "https://example.com"
}
]
},
"relationships": {
"assignee": {
"data": [
{
"id": "user123",
"type": "users"
}
]
},
"categories": {
"data": [
{
"id": "category456",
"type": "categories"
}
]
},
"linkedRevisions": {
"data": [
{
"id": "revision789",
"type": "revisions"
}
]
},
"votes": {
"data": [
{
"id": "user456",
"type": "users"
}
]
},
"watches": {
"data": [
{
"id": "user789",
"type": "users"
}
]
}
}
}
}
Comment Creation
{
"data": [
{
"type": "workitem_comments",
"attributes": {
"resolved": false,
"title": "Comment Title",
"text": {
"type": "text/html",
"value": "<p>Comment content</p>"
}
},
"relationships": {
"author": {
"data": {
"id": "user123",
"type": "users"
}
},
"parentComment": {
"data": {
"id": "parent_comment_id",
"type": "workitem_comments"
}
}
}
}
]
}
Comment Update
{
"data": {
"type": "workitem_comments",
"id": "comment_id",
"attributes": {
"resolved": true
}
}
}
Linked Work Items Creation
{
"data": [
{
"type": "linkedworkitems",
"attributes": {
"revision": "1.0",
"role": "relates_to",
"suspect": false
},
"relationships": {
"workItem": {
"data": {
"id": "target_work_item_id",
"type": "workitems"
}
}
}
}
]
}
Usage Examples
Basic Work Item Query with Field Filtering
{
"name": "get_all_work_items",
"arguments": {
"project_id": "PROJECT_ID",
"page_size": 25,
"page_number": 1,
"fields": {
"workitems": "@basic",
"categories": "@all"
},
"include": "assignee,categories"
}
}
Create Work Item with Relationships
{
"name": "create_work_item",
"arguments": {
"project_id": "PROJECT_ID",
"work_item_data": {
"data": {
"type": "workitems",
"attributes": {
"title": "New Feature Request",
"description": {
"type": "text/html",
"value": "<p>Feature description</p>"
},
"priority": "high"
},
"relationships": {
"assignee": {
"data": [
{
"id": "user123",
"type": "users"
}
]
}
}
}
}
}
}
Update Work Item with Complete Structure
{
"name": "update_work_item",
"arguments": {
"project_id": "PROJECT_ID",
"work_item_id": "WORK_ITEM_ID",
"data": {
"type": "workitems",
"id": "WORK_ITEM_ID",
"attributes": {
"status": "resolved",
"resolution": "fixed"
},
"relationships": {
"assignee": {
"data": [
{
"id": "new_assignee_id",
"type": "users"
}
]
}
}
}
}
}
Add Comment with Rich Structure
{
"name": "add_comment",
"arguments": {
"project_id": "PROJECT_ID",
"work_item_id": "WORK_ITEM_ID",
"data": [
{
"type": "workitem_comments",
"attributes": {
"resolved": false,
"title": "Review Comment",
"text": {
"type": "text/html",
"value": "<p>This needs more testing</p>"
}
},
"relationships": {
"author": {
"data": {
"id": "reviewer_user_id",
"type": "users"
}
}
}
}
]
}
}
Query Work Items with Advanced Filtering
{
"name": "query_work_items",
"arguments": {
"project_id": "PROJECT_ID",
"query": "type:task AND status:open AND assignee.id:user123"
}
}
Create Linked Work Items
{
"name": "create_linked_work_items",
"arguments": {
"project_id": "PROJECT_ID",
"work_item_id": "SOURCE_WORK_ITEM_ID",
"data": [
{
"type": "linkedworkitems",
"attributes": {
"role": "implements",
"suspect": false
},
"relationships": {
"workItem": {
"data": {
"id": "TARGET_WORK_ITEM_ID",
"type": "workitems"
}
}
}
}
]
}
}
Get Linked Work Items with Pagination
{
"name": "get_linked_work_items",
"arguments": {
"project_id": "PROJECT_ID",
"work_item_id": "WORK_ITEM_ID",
"page_size": 10,
"fields": {
"linkedworkitems": "@basic",
"workitems": "@all"
}
}
}
API Endpoints Supported
Based on the Polarion REST API specification, this server supports all 25 APIs:
Core APIs (10-18)
/projects- Project listing and details/projects/{projectId}/workitems- Work item operations/projects/{projectId}/workitems/{workItemId}- Individual work item operations
Management APIs (19-34)
/projects/{projectId}/workitems/{workItemId}/assignees- Assignee management/projects/{projectId}/workitems/{workItemId}/attachments- Attachment management/projects/{projectId}/workitems/{workItemId}/attachments/{attachmentId}/content- Attachment downloads/projects/{projectId}/workitems/{workItemId}/comments- Comment management/projects/{projectId}/workitems/{workItemId}/comments/{commentId}- Individual comment operations
Linked Work Items APIs (35-40)
/projects/{projectId}/workitems/{workItemId}/linkedworkitems- Linked work items management/projects/{projectId}/workitems/{workItemId}/linkedworkitems/{roleId}/{targetProjectId}/{linkedWorkItemId}- Individual linked work item operations
Authentication
The server uses personal access token authentication as required by Polarion:
- Authorization Header:
Bearer {personal_access_token}
Error Handling
The server includes comprehensive error handling:
- HTTP status code validation (401, 403, 404, etc.)
- Connection timeout handling
- JSON parsing error handling
- Missing environment variable validation
- Detailed error logging with truncated responses
Security Notes
- Only personal access tokens are supported for enhanced security
- Never commit credentials to version control
- Use environment variables or secure input prompts for sensitive data
- All authentication tokens are redacted in logs
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License. Copyright (c) 2025 hy74.hwang@gmail.com
Reference
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file alm_mcp-1.0.5.tar.gz.
File metadata
- Download URL: alm_mcp-1.0.5.tar.gz
- Upload date:
- Size: 12.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2bb2b05695e22e7a7a2ee1cb39c7015c7d4b67772956d290ed6832a2511ace5
|
|
| MD5 |
7d40465bacb59cdcc6b10d0f24e1f0be
|
|
| BLAKE2b-256 |
d48f3dc527c39d28e900de6bf8181ea2c0acd4b87e606b71e71c12dae6b5def5
|
File details
Details for the file alm_mcp-1.0.5-py3-none-any.whl.
File metadata
- Download URL: alm_mcp-1.0.5-py3-none-any.whl
- Upload date:
- Size: 13.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a05e31638ff619360aa9105579ba54fd6bf60ac2eec801b713306b8fdece0c3
|
|
| MD5 |
1c25bef550c33a2d3128152f8c466db6
|
|
| BLAKE2b-256 |
f9dd2813e1629f01f34f288414b0aba70300f70147a4efeb599bfb98612e74a9
|