backlog-mcp-server 0.8.1 → 0.9.1
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.
package/build/index.js
CHANGED
|
@@ -18,9 +18,6 @@ import { wrapServerWithToolRegistry } from './utils/wrapServerWithToolRegistry.j
|
|
|
18
18
|
import packageJson from '../package.json' with { type: 'json' };
|
|
19
19
|
const { version } = packageJson;
|
|
20
20
|
dotenv.config();
|
|
21
|
-
const domain = env.get('BACKLOG_DOMAIN').required().asString();
|
|
22
|
-
const apiKey = env.get('BACKLOG_API_KEY').required().asString();
|
|
23
|
-
const backlog = new backlogjs.Backlog({ host: domain, apiKey: apiKey });
|
|
24
21
|
const argv = yargs(hideBin(process.argv))
|
|
25
22
|
.option('max-tokens', {
|
|
26
23
|
type: 'number',
|
|
@@ -60,6 +57,9 @@ Available toolsets:
|
|
|
60
57
|
default: env.get('ENABLE_DYNAMIC_TOOLSETS').default('false').asBool(),
|
|
61
58
|
})
|
|
62
59
|
.parseSync();
|
|
60
|
+
const domain = env.get('BACKLOG_DOMAIN').required().asString();
|
|
61
|
+
const apiKey = env.get('BACKLOG_API_KEY').required().asString();
|
|
62
|
+
const backlog = new backlogjs.Backlog({ host: domain, apiKey: apiKey });
|
|
63
63
|
const useFields = argv.optimizeResponse;
|
|
64
64
|
const server = wrapServerWithToolRegistry(new McpServer({
|
|
65
65
|
name: 'backlog',
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { ActivitySchema, ActivityTypeSchema, } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
+
const getUserRecentUpdatesSchema = buildToolSchema((t) => ({
|
|
5
|
+
userId: z
|
|
6
|
+
.number()
|
|
7
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_USER_ID', 'ID of the user to retrieve activities for')),
|
|
8
|
+
activityTypeId: z
|
|
9
|
+
.array(ActivityTypeSchema)
|
|
10
|
+
.optional()
|
|
11
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_ACTIVITY_TYPE_ID', 'Activity type IDs to filter by')),
|
|
12
|
+
minId: z
|
|
13
|
+
.number()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_MIN_ID', 'Minimum activity ID')),
|
|
16
|
+
maxId: z
|
|
17
|
+
.number()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_MAX_ID', 'Maximum activity ID')),
|
|
20
|
+
count: z
|
|
21
|
+
.number()
|
|
22
|
+
.min(1)
|
|
23
|
+
.max(100)
|
|
24
|
+
.default(20)
|
|
25
|
+
.optional()
|
|
26
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_COUNT', 'Number of activities to retrieve (1-100, default: 20)')),
|
|
27
|
+
order: z
|
|
28
|
+
.enum(['asc', 'desc'])
|
|
29
|
+
.default('desc')
|
|
30
|
+
.optional()
|
|
31
|
+
.describe(t('TOOL_GET_USER_RECENT_UPDATES_ORDER', 'Sort order ("asc" or "desc", default: "desc")')),
|
|
32
|
+
}));
|
|
33
|
+
export const getUserRecentUpdatesTool = (backlog, { t }) => {
|
|
34
|
+
return {
|
|
35
|
+
name: 'get_user_recent_updates',
|
|
36
|
+
description: t('TOOL_GET_USER_RECENT_UPDATES_DESCRIPTION', 'Returns recent updates (activities) for a specific user'),
|
|
37
|
+
schema: z.object(getUserRecentUpdatesSchema(t)),
|
|
38
|
+
outputSchema: ActivitySchema,
|
|
39
|
+
importantFields: ['id', 'type', 'content', 'created'],
|
|
40
|
+
handler: async ({ userId, activityTypeId, minId, maxId, count, order }) => backlog.getUserActivities(userId, {
|
|
41
|
+
activityTypeId,
|
|
42
|
+
minId,
|
|
43
|
+
maxId,
|
|
44
|
+
count,
|
|
45
|
+
order,
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { buildToolSchema } from '../types/tool.js';
|
|
3
|
+
import { StarCountSchema } from '../types/zod/backlogOutputDefinition.js';
|
|
4
|
+
const getUserStarsCountSchema = buildToolSchema((t) => ({
|
|
5
|
+
userId: z
|
|
6
|
+
.number()
|
|
7
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_USER_ID', 'User ID')),
|
|
8
|
+
since: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_SINCE', 'Count stars received after this date (yyyy-MM-dd)')),
|
|
12
|
+
until: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe(t('TOOL_GET_USER_STARS_COUNT_UNTIL', 'Count stars received before this date (yyyy-MM-dd)')),
|
|
16
|
+
}));
|
|
17
|
+
export const getUserStarsCountTool = (backlog, { t }) => {
|
|
18
|
+
return {
|
|
19
|
+
name: 'get_user_stars_count',
|
|
20
|
+
description: t('TOOL_GET_USER_STARS_COUNT_DESCRIPTION', 'Returns the count of stars received by a user'),
|
|
21
|
+
schema: z.object(getUserStarsCountSchema(t)),
|
|
22
|
+
outputSchema: StarCountSchema,
|
|
23
|
+
handler: async ({ userId, since, until }) => backlog.getUserStarsCount(userId, { since, until }),
|
|
24
|
+
};
|
|
25
|
+
};
|
package/build/tools/tools.js
CHANGED
|
@@ -29,7 +29,9 @@ import { getPullRequestsCountTool } from './getPullRequestsCount.js';
|
|
|
29
29
|
import { getResolutionsTool } from './getResolutions.js';
|
|
30
30
|
import { getSpaceTool } from './getSpace.js';
|
|
31
31
|
import { getSpaceActivitiesTool } from './getSpaceActivities.js';
|
|
32
|
+
import { getUserStarsCountTool } from './getUserStarsCount.js';
|
|
32
33
|
import { getUsersTool } from './getUsers.js';
|
|
34
|
+
import { getUserRecentUpdatesTool } from './getUserRecentUpdates.js';
|
|
33
35
|
import { getWatchingListCountTool } from './getWatchingListCount.js';
|
|
34
36
|
import { getWatchingListItemsTool } from './getWatchingListItems.js';
|
|
35
37
|
import { addWatchingTool } from './addWatching.js';
|
|
@@ -64,7 +66,9 @@ export const allTools = (backlog, helper) => {
|
|
|
64
66
|
getSpaceTool(backlog, helper),
|
|
65
67
|
getSpaceActivitiesTool(backlog, helper),
|
|
66
68
|
getUsersTool(backlog, helper),
|
|
69
|
+
getUserStarsCountTool(backlog, helper),
|
|
67
70
|
getMyselfTool(backlog, helper),
|
|
71
|
+
getUserRecentUpdatesTool(backlog, helper),
|
|
68
72
|
],
|
|
69
73
|
},
|
|
70
74
|
{
|
|
@@ -402,6 +402,9 @@ export const SpaceSchema = z.object({
|
|
|
402
402
|
export const WatchingListCountSchema = z.object({
|
|
403
403
|
count: z.number(),
|
|
404
404
|
});
|
|
405
|
+
export const StarCountSchema = z.object({
|
|
406
|
+
count: z.number(),
|
|
407
|
+
});
|
|
405
408
|
export const WikiListItemSchema = z.object({
|
|
406
409
|
id: z.number(),
|
|
407
410
|
projectId: z.number(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backlog-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"backlog-mcp-server": "./build/index.js"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"build"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
31
31
|
"backlog-js": "^0.16.0",
|
|
32
32
|
"cosmiconfig": "^9.0.0",
|
|
33
33
|
"dotenv": "^16.5.0",
|