backlog-mcp-server 0.15.0 → 0.16.0

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.
Files changed (118) hide show
  1. package/README.ja.md +20 -10
  2. package/README.md +20 -10
  3. package/build/auth/backlogAuthContext.d.ts +2 -0
  4. package/build/auth/backlogOAuthClient.d.ts +10 -0
  5. package/build/auth/backlogOAuthConfig.d.ts +9 -0
  6. package/build/auth/bearerAuthMiddleware.d.ts +4 -0
  7. package/build/auth/oauthRoutes.d.ts +4 -0
  8. package/build/auth/tokenStore.d.ts +62 -0
  9. package/build/backlog/backlogErrorHandler.d.ts +2 -0
  10. package/build/backlog/customFields.d.ts +29 -0
  11. package/build/backlog/parseBacklogAPIError.d.ts +8 -0
  12. package/build/createBacklogMcpServer.d.ts +29 -0
  13. package/build/createBacklogMcpServer.js +9 -4
  14. package/build/createDescriptionHelper.d.ts +18 -0
  15. package/build/createDescriptionHelper.js +24 -0
  16. package/build/handlers/builders/composeToolHandler.d.ts +31 -0
  17. package/build/handlers/builders/composeToolHandler.js +21 -9
  18. package/build/handlers/transformers/wrapWithErrorHandling.d.ts +2 -0
  19. package/build/handlers/transformers/wrapWithFieldPicking.d.ts +4 -0
  20. package/build/handlers/transformers/wrapWithOrganizationContext.d.ts +3 -0
  21. package/build/handlers/transformers/wrapWithTokenLimit.d.ts +2 -0
  22. package/build/handlers/transformers/wrapWithToolResult.d.ts +6 -0
  23. package/build/httpMcpServer.d.ts +22 -0
  24. package/build/index.d.ts +2 -0
  25. package/build/index.js +29 -11
  26. package/build/lib.d.ts +25 -0
  27. package/build/lib.js +20 -0
  28. package/build/loadDescriptionOverrides.d.ts +17 -0
  29. package/build/loadDescriptionOverrides.js +24 -0
  30. package/build/registerTools.d.ts +5 -0
  31. package/build/registerTools.js +7 -6
  32. package/build/tools/addDocument.d.ts +15 -0
  33. package/build/tools/addIssue.d.ts +30 -0
  34. package/build/tools/addIssueComment.d.ts +14 -0
  35. package/build/tools/addProject.d.ts +18 -0
  36. package/build/tools/addPullRequest.d.ts +20 -0
  37. package/build/tools/addPullRequestComment.d.ts +16 -0
  38. package/build/tools/addRelatedIssue.d.ts +12 -0
  39. package/build/tools/addVersionMilestone.d.ts +15 -0
  40. package/build/tools/addWatching.d.ts +11 -0
  41. package/build/tools/addWiki.d.ts +13 -0
  42. package/build/tools/countIssues.d.ts +48 -0
  43. package/build/tools/deleteIssue.d.ts +11 -0
  44. package/build/tools/deleteProject.d.ts +11 -0
  45. package/build/tools/deleteVersion.d.ts +12 -0
  46. package/build/tools/deleteWatching.d.ts +10 -0
  47. package/build/tools/dynamicTools/organizations.d.ts +6 -0
  48. package/build/tools/dynamicTools/toolsets.d.ts +15 -0
  49. package/build/tools/getCategories.d.ts +11 -0
  50. package/build/tools/getCustomFields.d.ts +12 -0
  51. package/build/tools/getDocument.d.ts +10 -0
  52. package/build/tools/getDocumentTree.d.ts +10 -0
  53. package/build/tools/getDocuments.d.ts +11 -0
  54. package/build/tools/getGitRepositories.d.ts +11 -0
  55. package/build/tools/getGitRepository.d.ts +13 -0
  56. package/build/tools/getIssue.d.ts +11 -0
  57. package/build/tools/getIssueComments.d.ts +18 -0
  58. package/build/tools/getIssueTypes.d.ts +11 -0
  59. package/build/tools/getIssues.d.ts +75 -0
  60. package/build/tools/getMyself.d.ts +7 -0
  61. package/build/tools/getNotifications.d.ts +16 -0
  62. package/build/tools/getNotificationsCount.d.ts +11 -0
  63. package/build/tools/getPriorities.d.ts +7 -0
  64. package/build/tools/getProject.d.ts +11 -0
  65. package/build/tools/getProjectList.d.ts +11 -0
  66. package/build/tools/getProjectUsers.d.ts +11 -0
  67. package/build/tools/getPullRequest.d.ts +14 -0
  68. package/build/tools/getPullRequestComments.d.ts +21 -0
  69. package/build/tools/getPullRequests.d.ts +19 -0
  70. package/build/tools/getPullRequestsCount.d.ts +17 -0
  71. package/build/tools/getRelatedIssues.d.ts +11 -0
  72. package/build/tools/getResolutions.d.ts +7 -0
  73. package/build/tools/getSpace.d.ts +7 -0
  74. package/build/tools/getSpaceActivities.d.ts +45 -0
  75. package/build/tools/getUserRecentUpdates.d.ts +46 -0
  76. package/build/tools/getUserStarsCount.d.ts +12 -0
  77. package/build/tools/getUsers.d.ts +7 -0
  78. package/build/tools/getVersionMilestoneList.d.ts +11 -0
  79. package/build/tools/getWatchingListCount.d.ts +10 -0
  80. package/build/tools/getWatchingListItems.d.ts +10 -0
  81. package/build/tools/getWiki.d.ts +10 -0
  82. package/build/tools/getWikiPages.d.ts +12 -0
  83. package/build/tools/getWikisCount.d.ts +11 -0
  84. package/build/tools/markNotificationAsRead.d.ts +13 -0
  85. package/build/tools/markWatchingAsRead.d.ts +13 -0
  86. package/build/tools/removeRelatedIssue.d.ts +12 -0
  87. package/build/tools/resetUnreadNotificationCount.d.ts +7 -0
  88. package/build/tools/shared/customFieldFiltersSchema.d.ts +21 -0
  89. package/build/tools/tools.d.ts +4 -0
  90. package/build/tools/updateIssue.d.ts +34 -0
  91. package/build/tools/updateIssueComment.d.ts +13 -0
  92. package/build/tools/updateProject.d.ts +21 -0
  93. package/build/tools/updatePullRequest.d.ts +20 -0
  94. package/build/tools/updatePullRequestComment.d.ts +16 -0
  95. package/build/tools/updateVersionMilestone.d.ts +17 -0
  96. package/build/tools/updateWatching.d.ts +11 -0
  97. package/build/tools/updateWiki.d.ts +13 -0
  98. package/build/types/mcp.d.ts +10 -0
  99. package/build/types/result.d.ts +10 -0
  100. package/build/types/tool.d.ts +24 -0
  101. package/build/types/toolsets.d.ts +16 -0
  102. package/build/types/zod/backlogOutputDefinition.d.ts +3334 -0
  103. package/build/types/zod/backlogOutputDefinition.js +0 -16
  104. package/build/utils/backlogClientRegistry.d.ts +28 -0
  105. package/build/utils/backlogClientRegistry.js +4 -0
  106. package/build/utils/backlogOrganizationContext.d.ts +2 -0
  107. package/build/utils/generateFieldsDescription.d.ts +5 -0
  108. package/build/utils/logger.d.ts +2 -0
  109. package/build/utils/logger.js +27 -14
  110. package/build/utils/resolveIdOrKey.d.ts +18 -0
  111. package/build/utils/runToolSafely.d.ts +6 -0
  112. package/build/utils/tokenCounter.d.ts +1 -0
  113. package/build/utils/toolRegistrar.d.ts +5 -0
  114. package/build/utils/toolsetUtils.d.ts +6 -0
  115. package/build/utils/toolsetUtils.js +0 -20
  116. package/build/utils/wrapServerWithToolRegistry.d.ts +6 -0
  117. package/package.json +12 -3
  118. package/build/createTranslationHelper.js +0 -28
@@ -0,0 +1,34 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { IssueSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateIssueSchema: (t: DescriptionHelper["t"]) => {
7
+ issueId: z.ZodOptional<z.ZodNumber>;
8
+ issueKey: z.ZodOptional<z.ZodString>;
9
+ summary: z.ZodOptional<z.ZodString>;
10
+ issueTypeId: z.ZodOptional<z.ZodNumber>;
11
+ priorityId: z.ZodOptional<z.ZodNumber>;
12
+ description: z.ZodOptional<z.ZodString>;
13
+ startDate: z.ZodOptional<z.ZodString>;
14
+ dueDate: z.ZodOptional<z.ZodString>;
15
+ estimatedHours: z.ZodOptional<z.ZodNumber>;
16
+ actualHours: z.ZodOptional<z.ZodNumber>;
17
+ categoryId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
18
+ versionId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
19
+ milestoneId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
20
+ statusId: z.ZodOptional<z.ZodNumber>;
21
+ resolutionId: z.ZodOptional<z.ZodNumber>;
22
+ assigneeId: z.ZodOptional<z.ZodNumber>;
23
+ notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
24
+ attachmentId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
25
+ parentIssueId: z.ZodOptional<z.ZodNumber>;
26
+ comment: z.ZodOptional<z.ZodString>;
27
+ customFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
+ id: z.ZodNumber;
29
+ value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodArray<z.ZodString>, z.ZodArray<z.ZodNumber>]>>;
30
+ otherValue: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>>;
32
+ };
33
+ export declare const updateIssueTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateIssueSchema>, (typeof IssueSchema)["shape"]>;
34
+ export {};
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { IssueCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateIssueCommentSchema: (t: DescriptionHelper["t"]) => {
7
+ issueId: z.ZodOptional<z.ZodNumber>;
8
+ issueKey: z.ZodOptional<z.ZodString>;
9
+ commentId: z.ZodNumber;
10
+ content: z.ZodString;
11
+ };
12
+ export declare const updateIssueCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateIssueCommentSchema>, (typeof IssueCommentSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { ProjectSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateProjectSchema: (t: DescriptionHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ name: z.ZodOptional<z.ZodString>;
10
+ key: z.ZodOptional<z.ZodString>;
11
+ chartEnabled: z.ZodOptional<z.ZodBoolean>;
12
+ subtaskingEnabled: z.ZodOptional<z.ZodBoolean>;
13
+ projectLeaderCanEditProjectLeader: z.ZodOptional<z.ZodBoolean>;
14
+ textFormattingRule: z.ZodOptional<z.ZodEnum<{
15
+ backlog: "backlog";
16
+ markdown: "markdown";
17
+ }>>;
18
+ archived: z.ZodOptional<z.ZodBoolean>;
19
+ };
20
+ export declare const updateProjectTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateProjectSchema>, (typeof ProjectSchema)["shape"]>;
21
+ export {};
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { PullRequestSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updatePullRequestSchema: (t: DescriptionHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ repoId: z.ZodOptional<z.ZodNumber>;
10
+ repoName: z.ZodOptional<z.ZodString>;
11
+ number: z.ZodNumber;
12
+ summary: z.ZodOptional<z.ZodString>;
13
+ description: z.ZodOptional<z.ZodString>;
14
+ issueId: z.ZodOptional<z.ZodNumber>;
15
+ assigneeId: z.ZodOptional<z.ZodNumber>;
16
+ notifiedUserId: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
17
+ statusId: z.ZodOptional<z.ZodNumber>;
18
+ };
19
+ export declare const updatePullRequestTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updatePullRequestSchema>, (typeof PullRequestSchema)["shape"]>;
20
+ export {};
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { PullRequestCommentSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updatePullRequestCommentSchema: (t: DescriptionHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ repoId: z.ZodOptional<z.ZodNumber>;
10
+ repoName: z.ZodOptional<z.ZodString>;
11
+ number: z.ZodNumber;
12
+ commentId: z.ZodNumber;
13
+ content: z.ZodString;
14
+ };
15
+ export declare const updatePullRequestCommentTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updatePullRequestCommentSchema>, (typeof PullRequestCommentSchema)["shape"]>;
16
+ export {};
@@ -0,0 +1,17 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { VersionSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateVersionMilestoneSchema: (t: DescriptionHelper["t"]) => {
7
+ projectId: z.ZodOptional<z.ZodNumber>;
8
+ projectKey: z.ZodOptional<z.ZodString>;
9
+ id: z.ZodNumber;
10
+ name: z.ZodString;
11
+ description: z.ZodOptional<z.ZodString>;
12
+ startDate: z.ZodOptional<z.ZodString>;
13
+ releaseDueDate: z.ZodOptional<z.ZodString>;
14
+ archived: z.ZodOptional<z.ZodBoolean>;
15
+ };
16
+ export declare const updateVersionMilestoneTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateVersionMilestoneSchema>, (typeof VersionSchema)["shape"]>;
17
+ export {};
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { WatchingListItemSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateWatchingSchema: (t: DescriptionHelper["t"]) => {
7
+ watchId: z.ZodNumber;
8
+ note: z.ZodString;
9
+ };
10
+ export declare const updateWatchingTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateWatchingSchema>, (typeof WatchingListItemSchema)["shape"]>;
11
+ export {};
@@ -0,0 +1,13 @@
1
+ import { z } from 'zod';
2
+ import { Backlog } from 'backlog-js';
3
+ import { ToolDefinition } from '../types/tool.js';
4
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
5
+ import { WikiSchema } from '../types/zod/backlogOutputDefinition.js';
6
+ declare const updateWikiSchema: (t: DescriptionHelper["t"]) => {
7
+ wikiId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
+ name: z.ZodOptional<z.ZodString>;
9
+ content: z.ZodOptional<z.ZodString>;
10
+ mailNotify: z.ZodOptional<z.ZodBoolean>;
11
+ };
12
+ export declare const updateWikiTool: (backlog: Backlog, { t }: DescriptionHelper) => ToolDefinition<ReturnType<typeof updateWikiSchema>, (typeof WikiSchema)["shape"]>;
13
+ export {};
@@ -0,0 +1,10 @@
1
+ export type MCPOptions = {
2
+ useFields: boolean;
3
+ maxTokens: number;
4
+ prefix: string;
5
+ /**
6
+ * Whether tools take an `organization` parameter. Only true when more than one
7
+ * Backlog space is configured; see `BacklogClientRegistry.isMultiOrganization`.
8
+ */
9
+ useOrganization: boolean;
10
+ };
@@ -0,0 +1,10 @@
1
+ export type ErrorLike = {
2
+ kind: 'error';
3
+ message: string;
4
+ };
5
+ export type Success<T> = {
6
+ kind: 'ok';
7
+ data: T;
8
+ };
9
+ export type SafeResult<T> = Success<T> | ErrorLike;
10
+ export declare function isErrorLike<T>(res: SafeResult<T>): res is ErrorLike;
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import { DescriptionHelper } from '../createDescriptionHelper.js';
3
+ import { CallToolResult } from '@modelcontextprotocol/server';
4
+ export type ToolDefinition<Shape extends z.ZodRawShape, OutputShape extends z.ZodRawShape> = {
5
+ name: string;
6
+ description: string;
7
+ schema: z.ZodObject<Shape>;
8
+ outputSchema: z.ZodObject<OutputShape>;
9
+ handler: (input: z.infer<z.ZodObject<Shape>> & {
10
+ fields?: string;
11
+ organization?: string;
12
+ }) => Promise<z.infer<z.ZodObject<OutputShape>> | z.infer<z.ZodObject<OutputShape>>[]>;
13
+ importantFields?: (keyof z.infer<z.ZodObject<OutputShape>>)[];
14
+ };
15
+ export declare const buildToolSchema: <T extends z.ZodRawShape>(fn: (t: DescriptionHelper["t"]) => T) => (t: DescriptionHelper["t"]) => T;
16
+ export type DynamicToolDefinition<Shape extends z.ZodRawShape> = {
17
+ name: string;
18
+ description: string;
19
+ schema: z.ZodObject<Shape>;
20
+ handler: (input: z.infer<z.ZodObject<Shape>>) => Promise<CallToolResult>;
21
+ };
22
+ export interface ToolRegistrar {
23
+ enableToolsetAndRefresh(toolset: string): Promise<string>;
24
+ }
@@ -0,0 +1,16 @@
1
+ import { DynamicToolDefinition, ToolDefinition } from './tool.js';
2
+ type BaseToolset<TTool> = {
3
+ name: string;
4
+ description: string;
5
+ enabled: boolean;
6
+ tools: TTool[];
7
+ };
8
+ export type Toolset = BaseToolset<ToolDefinition<any, any>>;
9
+ export type ToolsetGroup = {
10
+ toolsets: Toolset[];
11
+ };
12
+ export type DynamicToolset = BaseToolset<DynamicToolDefinition<any>>;
13
+ export type DynamicToolsetGroup = {
14
+ toolsets: DynamicToolset[];
15
+ };
16
+ export {};