backlog-mcp 1.0.6__py3-none-any.whl → 1.0.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
app/main.py CHANGED
@@ -10,6 +10,8 @@ app = FastMCP(
10
10
 
11
11
  # Add tool for Backlog MCP
12
12
  app.add_tool(get_issue_details)
13
+ app.add_tool(get_my_issues)
14
+ app.add_tool(get_users_by_project)
13
15
  app.add_tool(get_user_issue_list)
14
16
  app.add_tool(update_issue_description)
15
17
 
app/tools/__init__.py CHANGED
@@ -1,3 +1,5 @@
1
1
  from .get_issue_details import *
2
+ from .get_my_issues import *
3
+ from .get_users_by_project import *
2
4
  from .get_user_issue_list import *
3
5
  from .update_issue_description import *
@@ -0,0 +1,28 @@
1
+ from app.utils.di import create_backlog_context
2
+ from app.utils.ultils import get_current_user, get_user_task
3
+
4
+ async def get_my_issues():
5
+ """
6
+ Retrieves a list of issues assigned to the current user from Backlog.
7
+
8
+ This function automatically determines the current user's ID via API
9
+ and returns only issues assigned to that user.
10
+
11
+ Returns:
12
+ List of issues with {issueKey, title}
13
+ """
14
+ try:
15
+ ctx = create_backlog_context()
16
+ current_user = await get_current_user(
17
+ backlog_domain=ctx.backlog_domain,
18
+ api_key=ctx.api_key,
19
+ )
20
+
21
+ issues = await get_user_task(
22
+ backlog_domain=ctx.backlog_domain,
23
+ api_key=ctx.api_key,
24
+ assignee_ids=[current_user["id"]],
25
+ )
26
+ return issues
27
+ except Exception as e:
28
+ raise e
@@ -1,28 +1,26 @@
1
1
  from app.utils.di import create_backlog_context
2
- from app.utils.ultils import get_user_task, get_current_user
2
+ from app.utils.ultils import get_user_task
3
3
 
4
-
5
- async def get_user_issue_list():
4
+ async def get_user_issue_list(user_id: int):
6
5
  """
7
- Retrieves a list of issues assigned to the current user from Backlog.
6
+ Get issues assigned to a specific user.
8
7
 
9
- This function automatically determines the current user's ID via API
10
- and returns only issues assigned to that user.
11
- """
8
+ Args:
9
+ user_id (int): The Backlog user ID to filter issues by.
12
10
 
11
+ Returns:
12
+ List of issues with {issueKey, title}
13
+ """
13
14
  try:
14
- ctx = create_backlog_context()
15
-
16
- # Fetch current user information
17
- current_user = await get_current_user(ctx.backlog_domain, ctx.api_key)
18
- current_user_id = current_user["id"]
15
+ if not user_id:
16
+ raise ValueError("Please provide a user ID.")
19
17
 
20
- # Get issues assigned to current user
21
- issue_list = await get_user_task(
18
+ ctx = create_backlog_context()
19
+ issues = await get_user_task(
22
20
  backlog_domain=ctx.backlog_domain,
23
21
  api_key=ctx.api_key,
24
- assignee_ids=[current_user_id]
22
+ assignee_ids=[user_id],
25
23
  )
26
- return issue_list
24
+ return issues
27
25
  except Exception as e:
28
- raise e
26
+ raise e
@@ -0,0 +1,24 @@
1
+ from app.utils.di import create_backlog_context
2
+ from app.utils.ultils import get_project_users
3
+
4
+ async def get_users_by_project(project_key: str):
5
+ """
6
+ Get all users in a specific project.
7
+
8
+ Args:
9
+ project_key (str): Project key to search users in (e.g., 'PROJ')
10
+
11
+ Returns:
12
+ List of all users with {id, name, mailAddress}
13
+ """
14
+ try:
15
+ ctx = create_backlog_context()
16
+ project_users = await get_project_users(
17
+ backlog_domain=ctx.backlog_domain,
18
+ api_key=ctx.api_key,
19
+ project_key=project_key
20
+ )
21
+
22
+ return project_users
23
+ except Exception as e:
24
+ raise e
app/utils/ultils.py CHANGED
@@ -301,6 +301,38 @@ async def get_current_user(backlog_domain: str, api_key: str) -> dict:
301
301
  except Exception as e:
302
302
  raise ValueError(f"Unexpected error while getting current user: {e}") from e
303
303
 
304
+ async def get_project_users(backlog_domain: str, api_key: str, project_key: str) -> list[dict]:
305
+ """Get users in a specific project (requires only project access, not admin).
306
+
307
+ Args:
308
+ backlog_domain (str): Backlog domain URL
309
+ api_key (str): API key for authentication
310
+ project_key (str): Project key (e.g., 'PROJ')
311
+
312
+ Returns:
313
+ list[dict]: List of users with {id, name, mailAddress}
314
+ """
315
+ url = f"{backlog_domain}api/v2/projects/{project_key}/users"
316
+ params = {"apiKey": api_key}
317
+
318
+ async with httpx.AsyncClient() as client:
319
+ try:
320
+ response = await client.get(url, params=params, timeout=10.0)
321
+ response.raise_for_status()
322
+ data = response.json()
323
+ return [
324
+ {
325
+ "id": user["id"],
326
+ "name": user["name"],
327
+ "mailAddress": user.get("mailAddress")
328
+ }
329
+ for user in data
330
+ ]
331
+ except httpx.HTTPError as e:
332
+ raise ValueError(f"Failed to get project users: {e}") from e
333
+ except Exception as e:
334
+ raise ValueError(f"Unexpected error while getting project users: {e}") from e
335
+
304
336
 
305
337
  async def update_issue_description_handler(
306
338
  backlog_domain: str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: backlog-mcp
3
- Version: 1.0.6
3
+ Version: 1.0.7
4
4
  Summary: A Model Context Protocol (MCP) server for Backlog project management integration
5
5
  Author-email: BaoNguyen <baonguyen@teqnological.asia>
6
6
  Requires-Python: <3.14,>=3.13
@@ -1,20 +1,22 @@
1
1
  app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  app/logging_config.py,sha256=1tSV1HXExfIi_mxOpugvGL7ywd43SMmsKsjARWXTLnU,999
3
- app/main.py,sha256=iCyuJoQlueVQjZWmAlmb1WuMBDO2arTHSjkjLoXCZqQ,527
3
+ app/main.py,sha256=dem8WRCBkEqTjn6for1bzt93tsuEAnO3QBsfrBIfsc4,590
4
4
  app/server_settings.py,sha256=mI-G1DKJ2IBg9dKuW4Da5MDhFLeYSQwLOGGNEb_kQwM,434
5
5
  app/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  app/constants/constants.py,sha256=DV8HJnvCceHqUmA5csk9CcmcX9Zr0upl56qXVa9tF88,1664
7
7
  app/core/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
8
8
  app/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  app/models/models.py,sha256=y3JhziNew3_2bM4Lw3aVjWcTvhmaEbzz0AaCHsdAkbk,4169
10
- app/tools/__init__.py,sha256=v37to4C68ZJswTDeECaZZT3IPbRIe876CzJ_0XmZYCw,108
10
+ app/tools/__init__.py,sha256=-sQivOZOCZFRegwLAK0IIbM6L5WgjJZO4QF0EtttrOM,173
11
11
  app/tools/get_issue_details.py,sha256=efixu906oloeIZdf-geTlLxt9nLe-tPDqUlDd9HL6-g,973
12
- app/tools/get_user_issue_list.py,sha256=soNX0OfvfT1hIyzeDMPaHpAjHeGqavtZdTl0CemCpyo,865
12
+ app/tools/get_my_issues.py,sha256=lek-ptTfPFHKTAnrdsGnd2ycw31Q9fmn2KgvG-SbQ_E,837
13
+ app/tools/get_user_issue_list.py,sha256=k2kI26HrJzmmhBRDbga8cOHzyOq9vFrO2MwEvvSO-s0,691
14
+ app/tools/get_users_by_project.py,sha256=vqallXqErLNOCXG2A-Nj38q6AnqcytiJp-_3OptBBoE,651
13
15
  app/tools/update_issue_description.py,sha256=Cd9XlgpnqoO2JeKb6Ad7BrGWVb5pk3agOFTp-_llWCs,1057
14
16
  app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
17
  app/utils/di.py,sha256=5MmL6efLAX3uzp5WSMi4E_BDCgapzlr_OERZoN5NGnM,408
16
- app/utils/ultils.py,sha256=_JGcpS-EMgp4gw_A3c4dTdPl5UEvVCM1x61n5VrQt70,13099
17
- backlog_mcp-1.0.6.dist-info/METADATA,sha256=K5O4-UCkxcQYYw1iDJDN7CQ_IjwHwmM1QuCA5My8tJ4,3883
18
- backlog_mcp-1.0.6.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
19
- backlog_mcp-1.0.6.dist-info/entry_points.txt,sha256=h5JeHYUp_uoaya4FO3QelcsgYOu-VRmh5qWRhPrwjtk,46
20
- backlog_mcp-1.0.6.dist-info/RECORD,,
18
+ app/utils/ultils.py,sha256=K-CpjBIjzQNiRBDiBGTYRpbPIUCuhCXyfVGffcE9zB0,14308
19
+ backlog_mcp-1.0.7.dist-info/METADATA,sha256=gmRSrZD1-ggOz7aam7AiYLw2Wuk-9dsBtF1PwnfJWJA,3883
20
+ backlog_mcp-1.0.7.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
21
+ backlog_mcp-1.0.7.dist-info/entry_points.txt,sha256=h5JeHYUp_uoaya4FO3QelcsgYOu-VRmh5qWRhPrwjtk,46
22
+ backlog_mcp-1.0.7.dist-info/RECORD,,