backlog-mcp 1.0.1__py3-none-any.whl → 1.0.3__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/server_settings.py +0 -3
- app/tools/get_issue_details.py +1 -8
- app/tools/get_user_issue_list.py +10 -52
- app/utils/ultils.py +27 -2
- {backlog_mcp-1.0.1.dist-info → backlog_mcp-1.0.3.dist-info}/METADATA +3 -18
- {backlog_mcp-1.0.1.dist-info → backlog_mcp-1.0.3.dist-info}/RECORD +8 -8
- {backlog_mcp-1.0.1.dist-info → backlog_mcp-1.0.3.dist-info}/WHEEL +0 -0
- {backlog_mcp-1.0.1.dist-info → backlog_mcp-1.0.3.dist-info}/entry_points.txt +0 -0
app/server_settings.py
CHANGED
app/tools/get_issue_details.py
CHANGED
|
@@ -4,7 +4,6 @@ from app.utils.ultils import get_issue_detail_handler
|
|
|
4
4
|
|
|
5
5
|
async def get_issue_details(
|
|
6
6
|
issue_key: str,
|
|
7
|
-
issue_title: str | None,
|
|
8
7
|
timezone: str = "UTC"
|
|
9
8
|
):
|
|
10
9
|
"""
|
|
@@ -12,17 +11,11 @@ async def get_issue_details(
|
|
|
12
11
|
|
|
13
12
|
Args:
|
|
14
13
|
issue_key (str): The key of the Backlog issue to retrieve.
|
|
15
|
-
issue_title (str): The title of the Backlog issue, used for logging or reference purposes.
|
|
16
14
|
timezone (str, optional): The timezone to format datetime fields. Defaults to "UTC".
|
|
17
15
|
"""
|
|
18
16
|
try:
|
|
19
|
-
if not issue_key
|
|
17
|
+
if not issue_key:
|
|
20
18
|
raise ValueError("Please provide an issue key.")
|
|
21
|
-
elif issue_title and not issue_key:
|
|
22
|
-
raise ValueError(
|
|
23
|
-
"Cannot retrieve task information with only the issue title. "
|
|
24
|
-
"Please provide an issue key. Searching by title is not supported yet."
|
|
25
|
-
)
|
|
26
19
|
ctx = create_backlog_context()
|
|
27
20
|
result = await get_issue_detail_handler(
|
|
28
21
|
backlog_domain=ctx.backlog_domain,
|
app/tools/get_user_issue_list.py
CHANGED
|
@@ -1,69 +1,27 @@
|
|
|
1
1
|
from app.utils.di import create_backlog_context
|
|
2
|
-
from app.utils.ultils import get_user_task
|
|
2
|
+
from app.utils.ultils import get_user_task, get_current_user
|
|
3
3
|
|
|
4
|
-
from app.server_settings import settings
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
async def get_user_issue_list(
|
|
8
|
-
project_ids: list[int] | None = None,
|
|
9
|
-
assignee_ids: list[int] | None = None,
|
|
10
|
-
status_ids: list[int] | None = None,
|
|
11
|
-
milestone_ids: list[int] | None = None,
|
|
12
|
-
parent_issue_ids: list[int] | None = None,
|
|
13
|
-
created_since: str | None = None,
|
|
14
|
-
created_until: str | None = None,
|
|
15
|
-
updated_since: str | None = None,
|
|
16
|
-
updated_until: str | None = None,
|
|
17
|
-
start_date_since: str | None = None,
|
|
18
|
-
start_date_until: str | None = None,
|
|
19
|
-
due_date_since: str | None = None,
|
|
20
|
-
due_date_until: str | None = None,
|
|
21
|
-
):
|
|
5
|
+
async def get_user_issue_list():
|
|
22
6
|
"""
|
|
23
|
-
Retrieves a
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
project_ids (list[int], optional): List of project IDs to filter issues.
|
|
27
|
-
assignee_ids (list[int], optional): List of assignee IDs to filter issues (defaults to current user).
|
|
28
|
-
status_ids (list[int], optional): List of status IDs to filter issues (defaults to all non-closed statuses).
|
|
29
|
-
milestone_ids (list[int], optional): List of milestone IDs to filter issues.
|
|
30
|
-
parent_issue_ids (list[int], optional): List of parent issue IDs to filter issues.
|
|
31
|
-
|
|
32
|
-
created_since (str, optional): Created since (YYYY-MM-DD).
|
|
33
|
-
created_until (str, optional): Created until (YYYY-MM-DD).
|
|
34
|
-
|
|
35
|
-
updated_since (str, optional): Updated since (YYYY-MM-DD).
|
|
36
|
-
updated_until (str, optional): Updated until (YYYY-MM-DD).
|
|
37
|
-
|
|
38
|
-
start_date_since (str, optional): Start Date since (YYYY-MM-DD).
|
|
39
|
-
start_date_until (str, optional): Start Date until (YYYY-MM-DD).
|
|
7
|
+
Retrieves a list of issues assigned to the current user from Backlog.
|
|
40
8
|
|
|
41
|
-
|
|
42
|
-
|
|
9
|
+
This function automatically determines the current user's ID via API
|
|
10
|
+
and returns only issues assigned to that user.
|
|
43
11
|
"""
|
|
44
12
|
|
|
45
13
|
try:
|
|
46
14
|
ctx = create_backlog_context()
|
|
47
15
|
|
|
48
|
-
|
|
49
|
-
|
|
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"]
|
|
50
19
|
|
|
20
|
+
# Get issues assigned to current user
|
|
51
21
|
issue_list = await get_user_task(
|
|
52
22
|
backlog_domain=ctx.backlog_domain,
|
|
53
23
|
api_key=ctx.api_key,
|
|
54
|
-
|
|
55
|
-
assignee_ids=assignee_ids,
|
|
56
|
-
status_ids=status_ids,
|
|
57
|
-
milestone_ids=milestone_ids,
|
|
58
|
-
parent_issue_ids=parent_issue_ids,
|
|
59
|
-
created_since=created_since,
|
|
60
|
-
created_until=created_until,
|
|
61
|
-
updated_since=updated_since,
|
|
62
|
-
updated_until=updated_until,
|
|
63
|
-
start_date_since=start_date_since,
|
|
64
|
-
start_date_until=start_date_until,
|
|
65
|
-
due_date_since=due_date_since,
|
|
66
|
-
due_date_until=due_date_until
|
|
24
|
+
assignee_ids=[current_user_id]
|
|
67
25
|
)
|
|
68
26
|
return issue_list
|
|
69
27
|
except Exception as e:
|
app/utils/ultils.py
CHANGED
|
@@ -46,8 +46,9 @@ def time_in_range(time: str, start_range: str, end_range: str):
|
|
|
46
46
|
return start_range_time <= time_to_be_compared <= end_range_time
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
def process_issue_detail(issue_detail, timezone):
|
|
49
|
+
def process_issue_detail(issue_detail, timezone, issue_key):
|
|
50
50
|
processed_issue = {
|
|
51
|
+
"issue_key": issue_key,
|
|
51
52
|
"summary": issue_detail["summary"],
|
|
52
53
|
"description": issue_detail["description"]
|
|
53
54
|
}
|
|
@@ -108,7 +109,7 @@ async def get_issue_detail_handler(
|
|
|
108
109
|
comments_in_time_range.append(comment)
|
|
109
110
|
|
|
110
111
|
issue_detail.update({"comments": comments_in_time_range})
|
|
111
|
-
processed_detail = process_issue_detail(issue_detail, timezone)
|
|
112
|
+
processed_detail = process_issue_detail(issue_detail, timezone, issue_key)
|
|
112
113
|
return processed_detail
|
|
113
114
|
|
|
114
115
|
except Exception as e:
|
|
@@ -266,3 +267,27 @@ async def get_project_list(backlog_domain: str, api_key: str) -> list[int]:
|
|
|
266
267
|
raise ValueError(f"Failed to get project list: {e}") from e
|
|
267
268
|
except Exception as e:
|
|
268
269
|
raise ValueError(f"Unexpected error while getting project list: {e}") from e
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
async def get_current_user(backlog_domain: str, api_key: str) -> dict:
|
|
273
|
+
"""Get current user information from Backlog API.
|
|
274
|
+
|
|
275
|
+
Returns:
|
|
276
|
+
dict: {"id": int, "name": str}
|
|
277
|
+
"""
|
|
278
|
+
url = f"{backlog_domain}api/v2/users/myself"
|
|
279
|
+
params = {"apiKey": api_key}
|
|
280
|
+
|
|
281
|
+
async with httpx.AsyncClient() as client:
|
|
282
|
+
try:
|
|
283
|
+
response = await client.get(url, params=params, timeout=10.0)
|
|
284
|
+
response.raise_for_status()
|
|
285
|
+
data = response.json()
|
|
286
|
+
return {
|
|
287
|
+
"id": data["id"],
|
|
288
|
+
"name": data["name"]
|
|
289
|
+
}
|
|
290
|
+
except httpx.HTTPError as e:
|
|
291
|
+
raise ValueError(f"Failed to get current user: {e}") from e
|
|
292
|
+
except Exception as e:
|
|
293
|
+
raise ValueError(f"Unexpected error while getting current user: {e}") from e
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: backlog-mcp
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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
|
|
@@ -55,22 +55,9 @@ Get detailed information about a Backlog issue by its issue key.
|
|
|
55
55
|
|
|
56
56
|
### `get_user_issue_list`
|
|
57
57
|
|
|
58
|
-
Retrieve a
|
|
58
|
+
Retrieve a list of issues assigned to the current user.
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
- `project_ids` (List[int], optional): List of project IDs.
|
|
62
|
-
- `assignee_ids` (List[int], optional): List of assignee IDs (defaults to current user).
|
|
63
|
-
- `status_ids` (List[int], optional): List of status IDs (defaults to non-closed).
|
|
64
|
-
- `milestone_ids` (List[int], optional): List of milestone IDs.
|
|
65
|
-
- `parent_issue_ids` (List[int], optional): List of parent issue IDs.
|
|
66
|
-
- `created_since` (str, optional): Created since (YYYY-MM-DD).
|
|
67
|
-
- `created_until` (str, optional): Created until (YYYY-MM-DD).
|
|
68
|
-
- `updated_since` (str, optional): Updated since (YYYY-MM-DD).
|
|
69
|
-
- `updated_until` (str, optional): Updated until (YYYY-MM-DD).
|
|
70
|
-
- `start_date_since` (str, optional): Start Date since (YYYY-MM-DD).
|
|
71
|
-
- `start_date_until` (str, optional): Start Date until (YYYY-MM-DD).
|
|
72
|
-
- `due_date_since` (str, optional): Due Date since (YYYY-MM-DD).
|
|
73
|
-
- `due_date_until` (str, optional): Due Date until (YYYY-MM-DD).
|
|
60
|
+
This tool automatically determines the current user's ID and returns only issues assigned to that user. No parameters are required.
|
|
74
61
|
|
|
75
62
|
## Running the Server Locally
|
|
76
63
|
|
|
@@ -89,13 +76,11 @@ Create a `.env` file in the root directory and add the following environment var
|
|
|
89
76
|
# Backlog API Settings
|
|
90
77
|
BACKLOG_API_KEY=your_backlog_api_key_here
|
|
91
78
|
BACKLOG_DOMAIN=your-space.backlog.com
|
|
92
|
-
USER_ID=your_user_id
|
|
93
79
|
```
|
|
94
80
|
|
|
95
81
|
> **Important:**
|
|
96
82
|
> - Replace `your_backlog_api_key_here` with your actual Backlog API key
|
|
97
83
|
> - Replace `your-space.backlog.com` with your actual Backlog domain
|
|
98
|
-
> - Replace `your_user_id` with your actual Backlog user ID
|
|
99
84
|
|
|
100
85
|
### 3. Start the server
|
|
101
86
|
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
app/logging_config.py,sha256=1tSV1HXExfIi_mxOpugvGL7ywd43SMmsKsjARWXTLnU,999
|
|
3
3
|
app/main.py,sha256=IZ-oDlynIZN-knCZqbUlnTMZ1YDJ-mHpUdAgv-Q-Lp4,488
|
|
4
|
-
app/server_settings.py,sha256=
|
|
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
10
|
app/tools/__init__.py,sha256=LxxyJiqccPQCNjei_YvtNJgEMs4U7IzKEsAaNKToaKg,68
|
|
11
|
-
app/tools/get_issue_details.py,sha256=
|
|
12
|
-
app/tools/get_user_issue_list.py,sha256=
|
|
11
|
+
app/tools/get_issue_details.py,sha256=GMuC6lf33z0YTREq8VQ9oWwRe59XyHCnfpja0BMXjCw,819
|
|
12
|
+
app/tools/get_user_issue_list.py,sha256=soNX0OfvfT1hIyzeDMPaHpAjHeGqavtZdTl0CemCpyo,865
|
|
13
13
|
app/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
app/utils/di.py,sha256=5MmL6efLAX3uzp5WSMi4E_BDCgapzlr_OERZoN5NGnM,408
|
|
15
|
-
app/utils/ultils.py,sha256=
|
|
16
|
-
backlog_mcp-1.0.
|
|
17
|
-
backlog_mcp-1.0.
|
|
18
|
-
backlog_mcp-1.0.
|
|
19
|
-
backlog_mcp-1.0.
|
|
15
|
+
app/utils/ultils.py,sha256=LuTHKOZGhjU9LHGLNNzQJeck-UJYu49L4MK9ZfUoRtg,10798
|
|
16
|
+
backlog_mcp-1.0.3.dist-info/METADATA,sha256=tLveO9390Py9GBN-YLzcvIEQYfW4EjR_8Cs5L45JaMA,3883
|
|
17
|
+
backlog_mcp-1.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
18
|
+
backlog_mcp-1.0.3.dist-info/entry_points.txt,sha256=h5JeHYUp_uoaya4FO3QelcsgYOu-VRmh5qWRhPrwjtk,46
|
|
19
|
+
backlog_mcp-1.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|