src.integrations.label_helper module#

Helper module for managing labels in kanban-mcp.

This module provides utility functions for working with labels, handling the specific requirements of the kanban-mcp label manager including: - Using proper color names from the allowed enum - Creating labels before adding them to cards - Managing label IDs for card operations

class src.integrations.label_helper.LabelManagerHelper[source]#

Bases: object

Helper class for managing kanban labels.

VALID_COLORS = ['berry-red', 'pumpkin-orange', 'lagoon-blue', 'pink-tulip', 'light-mud', 'orange-peel', 'bright-moss', 'antique-blue', 'dark-granite', 'lagune-blue', 'sunny-grass', 'morning-sky', 'light-orange', 'midnight-blue', 'tank-green', 'gun-metal', 'wet-moss', 'red-burgundy', 'light-concrete', 'apricot-red', 'desert-sand', 'navy-blue', 'egg-yellow', 'coral-green', 'light-cocoa']#
DEFAULT_LABEL_COLORS = {'api': 'berry-red', 'authentication': 'midnight-blue', 'backend': 'berry-red', 'bug': 'midnight-blue', 'complex': 'berry-red', 'database': 'pumpkin-orange', 'deployment': 'pumpkin-orange', 'design': 'lagune-blue', 'devops': 'tank-green', 'django': 'bright-moss', 'documentation': 'sunny-grass', 'enhancement': 'bright-moss', 'feature': 'pink-tulip', 'frontend': 'lagoon-blue', 'fullstack': 'midnight-blue', 'high': 'berry-red', 'high-priority': 'red-burgundy', 'implementation': 'berry-red', 'infrastructure': 'tank-green', 'javascript': 'egg-yellow', 'low': 'bright-moss', 'medium': 'egg-yellow', 'moderate': 'egg-yellow', 'nodejs': 'sunny-grass', 'performance': 'orange-peel', 'python': 'bright-moss', 'react': 'lagoon-blue', 'refactor': 'light-concrete', 'security': 'midnight-blue', 'setup': 'pink-tulip', 'simple': 'bright-moss', 'testing': 'sunny-grass', 'ui': 'lagune-blue', 'urgent': 'red-burgundy', 'ux': 'lagune-blue'}#
__init__(session, board_id)[source]#

Initialize the label manager helper.

Parameters:
  • session (Any) – Active MCP client session

  • board_id (str) – ID of the board to manage labels for

Return type:

None

async refresh_labels()[source]#

Get all labels for the board and refresh the cache.

Returns:

List of all labels on the board

Return type:

List[Dict[str, Any]]

async ensure_label_exists(name, color=None)[source]#

Ensure a label exists, creating it if necessary.

Parameters:
  • name (str) – Name of the label

  • color (Optional[str]) – Color for the label. If not provided, uses default mapping or picks one.

Returns:

ID of the label (existing or newly created)

Return type:

str

Raises:

ValueError – If the color is not in the valid colors list

async add_labels_to_card(card_id, label_names)[source]#

Add multiple labels to a card, creating them if necessary.

Parameters:
  • card_id (str) – ID of the card to add labels to

  • label_names (List[str]) – Names of labels to add

Returns:

List of label IDs that were successfully added

Return type:

List[str]

classmethod get_color_for_label(label_name)[source]#

Get the recommended color for a label name.

Parameters:

label_name (str) – Name of the label

Returns:

Recommended color from the valid colors list

Return type:

str

classmethod map_hex_to_valid_color(hex_color)[source]#

Map a hex color to the closest valid kanban-mcp color.

This is a simple mapping for common colors.

Parameters:

hex_color (str) – Hex color code (e.g., “#4CAF50”)

Returns:

Valid color name from the allowed list

Return type:

str

async src.integrations.label_helper.example_usage(session, board_id, card_id)[source]#

Demonstrate how to use the LabelManagerHelper.

Parameters:
  • session (Any) – Active MCP session

  • board_id (str) – Board ID

  • card_id (str) – Card ID to add labels to

Return type:

None