@dod/planax-mcp 0.1.5 → 0.3.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.
package/README.md CHANGED
@@ -83,26 +83,31 @@ env = { PLANAX_ACCESS_TOKEN = "your_token_here" }
83
83
  연결하면 AI 어시스턴트가 PlanAX의 데이터를 조회하고 변경할 수 있습니다. 영역을 펼치면 사용할 수 있는 도구를 볼 수 있습니다.
84
84
 
85
85
  <details>
86
- <summary><b>Workspace, Project</b> (4)</summary>
86
+ <summary><b>Workspace, Project</b> (8)</summary>
87
87
 
88
88
  - `workspace_list` - 접근 가능한 워크스페이스 목록
89
89
  - `workspace_get` - 워크스페이스 상세 정보
90
90
  - `project_list` - 워크스페이스의 프로젝트 목록
91
91
  - `project_get` - 프로젝트 상세 정보
92
+ - `project_list_members` - 프로젝트 멤버 목록 (담당자 지정 · 댓글 멘션에 쓸 userId)
93
+ - `workspace_list_members` - 워크스페이스 멤버 목록
94
+ - `workspace_list_templates` - Plan 템플릿 목록 (`plan_create` 의 templateId)
95
+ - `workspace_get_template` - Plan 템플릿 상세 (구조 포함)
92
96
 
93
97
  </details>
94
98
 
95
99
  <details>
96
- <summary><b>Plan</b> (14)</summary>
100
+ <summary><b>Plan</b> (15)</summary>
97
101
 
98
102
  - `plan_check_exists` - 프로젝트에 Plan이 있는지 확인
99
103
  - `plan_create` - Plan 생성 (템플릿 기반 또는 빈 Plan)
100
- - `plan_get_tree` - 전체 Plan 트리 조회 (Phase, Task, Document 포함)
104
+ - `plan_get_tree` - 전체 Plan 트리 조회 (Phase와 Phase에 연결된 Task, Document)
105
+ - `plan_get_root_items` - 어느 Phase에도 연결되지 않은 Task, Document 조회
101
106
  - `plan_list_root_phases` - 최상위 Phase 목록
102
107
  - `plan_list_all_phases` - 모든 Phase를 경로 정보와 함께 목록으로 조회
103
108
  - `plan_get_phase_children` - Phase의 하위 항목(하위 Phase, Task, Document) 조회
104
- - `plan_create_phase` - Phase 생성
105
- - `plan_update_phase` - Phase 수정 (이름, 날짜, 상태)
109
+ - `plan_create_phase` - Phase 생성 (최대 3단계)
110
+ - `plan_update_phase` - Phase 수정 (이름, 날짜, 상태 `pending` / `in_progress` / `completed` / `blocked`)
106
111
  - `plan_delete_phase` - Phase 삭제 (하위 Phase 포함)
107
112
  - `plan_create_task` - Plan에 Task 생성
108
113
  - `plan_create_document` - Plan에 자리표시 문서 생성
@@ -120,41 +125,45 @@ env = { PLANAX_ACCESS_TOKEN = "your_token_here" }
120
125
  - `task_create` - Task 생성
121
126
  - `task_update` - Task 수정 (제목, 설명, 상태 등)
122
127
  - `task_delete` - Task 삭제
123
- - `task_restore` - 삭제한 Task 복원
128
+ - `task_restore` - 삭제한 Task 복원 (삭제할 때 쓴 taskId)
124
129
  - `task_list_hidden_completed` - 숨겨진 완료 Task 목록
125
- - `task_assign` - Task 담당자 지정 또는 변경
130
+ - `task_assign` - Task 담당자 지정, 변경 또는 해제
126
131
 
127
132
  </details>
128
133
 
129
134
  <details>
130
- <summary><b>Document</b> (16)</summary>
135
+ <summary><b>Document</b> (20)</summary>
131
136
 
132
- - `document_list` - 프로젝트의 문서 목록 (필터 지원)
137
+ - `document_list` - 프로젝트의 문서 목록 (상태 · 종류 · 담당자 · 마감일 · 루트만 등 필터)
133
138
  - `document_get` - 문서 상세 정보
134
139
  - `document_create_markdown` - Markdown 문서 생성
135
140
  - `document_get_markdown_content` - Markdown 문서 내용 조회
136
141
  - `document_update_markdown_content` - Markdown 문서 내용 수정 (기본은 현재 버전 덮어쓰기, `createNewVersion: true` 면 새 버전 + 변경 사유)
137
142
  - `document_upload` - 파일(PDF, Word, Excel, 이미지 등) 업로드
138
- - `document_replace_file` - 기존 문서의 파일을 새 파일로 교체 (새 버전으로 올라가고 이전 버전은 이력에 남음)
143
+ - `document_replace_file` - 기존 문서의 파일을 새 파일로 교체 (새 버전으로 올라가고 이전 버전은 이력에 남음, 새 버전 유효기간 함께 지정 가능)
139
144
  - `document_create_placeholder` - 나중에 채울 자리표시 문서 생성
140
145
  - `document_convert_placeholder` - 자리표시 문서를 실제 문서로 변환
141
146
  - `document_create_link` - 외부 콘텐츠를 가리키는 링크 문서 생성
142
147
  - `document_update_link` - 링크 문서의 URL 또는 유형 수정
143
- - `document_update` - 문서 정보 수정 (제목, 설명, 상태)
148
+ - `document_update` - 문서 정보 수정 (제목, 설명, 상태, 태그, 폴더, 날짜, 담당자, 검토자, Phase)
144
149
  - `document_move` - 문서를 다른 폴더로 이동
145
- - `document_delete` - 문서 삭제
146
- - `document_get_related` - 문서와 관련된 항목 조회
147
- - `document_get_versions` - 문서 버전 이력 조회
150
+ - `document_delete` - 문서 삭제 (휴지통으로 이동)
151
+ - `document_list_trash` - 휴지통의 문서 목록
152
+ - `document_restore` - 휴지통의 문서 복원
153
+ - `document_get_versions` - 문서 버전 이력 조회 (서명 상태 · 유효기간 포함)
154
+ - `document_update_version_validity` - 문서 버전의 유효기간(시작일 · 종료일 · 다음 검토일) 설정
155
+ - `document_get_download_url` - 파일 문서의 내려받기 · 미리보기 주소 (현재 또는 특정 버전) — 원본 파일
156
+ - `document_get_signed_download_url` - 서명본 PDF(서명 · 감사 기록 페이지 포함) 내려받기 주소 (특정 버전 또는 최신 버전)
148
157
 
149
158
  </details>
150
159
 
151
160
  <details>
152
161
  <summary><b>Folder</b> (6)</summary>
153
162
 
154
- - `folder_list` - 프로젝트의 폴더 트리 조회
163
+ - `folder_list` - 프로젝트의 폴더 트리 조회 (검색 · 상위 폴더로 거르면 평평한 목록)
155
164
  - `folder_get` - 폴더 상세 정보
156
165
  - `folder_create` - 폴더 생성 (최상위 또는 하위)
157
- - `folder_update` - 폴더 수정 (이름, 설명, 색상, 위치)
166
+ - `folder_update` - 폴더 수정 (이름, 설명, 색상, 다른 폴더 아래로 이동)
158
167
  - `folder_delete` - 빈 폴더 삭제
159
168
  - `folder_get_path` - 폴더 경로 조회
160
169
 
@@ -176,7 +185,7 @@ env = { PLANAX_ACCESS_TOKEN = "your_token_here" }
176
185
  <summary><b>Comment</b> (4)</summary>
177
186
 
178
187
  - `comment_list` - Task 또는 Document의 댓글 목록
179
- - `comment_create` - 댓글 또는 답글 작성
188
+ - `comment_create` - 댓글 또는 답글 작성 (본문에 `@{userId}` 로 멘션)
180
189
  - `comment_get_replies` - 댓글의 답글 목록
181
190
  - `comment_delete` - 댓글 삭제
182
191
 
@@ -98,17 +98,24 @@ export class PlanaxApiClient {
98
98
  handleError(error) {
99
99
  if (error instanceof AxiosError) {
100
100
  const status = error.response?.status;
101
- const message = error.response?.data?.message || error.message;
101
+ const data = error.response?.data;
102
+ // 백엔드 오류는 error.message 에 있다 (ApiResponse.error). 예전 모양(맨 위 message)도 받아 준다
103
+ const backendMessage = data?.error?.message ?? data?.message;
104
+ const code = data?.error?.code;
105
+ const fields = data?.error?.fields?.length
106
+ ? ` (fields: ${data.error.fields.map((f) => `${f.field} ${f.code}`).join(', ')})`
107
+ : '';
102
108
  if (status === 401) {
103
109
  return new Error('Authentication failed. Please check your access token.');
104
110
  }
105
111
  if (status === 403) {
106
- return new Error('Access denied. You do not have permission for this action.');
112
+ return new Error(backendMessage ? `Access denied: ${backendMessage}` : 'Access denied. You do not have permission for this action.');
107
113
  }
108
114
  if (status === 404) {
109
- return new Error('Resource not found.');
115
+ return new Error(backendMessage ? `Not found: ${backendMessage}` : 'Resource not found.');
110
116
  }
111
- return new Error(`API Error: ${message}`);
117
+ const label = code ? `${status} ${code}` : `${status}`;
118
+ return new Error(`API Error (${label}): ${backendMessage || error.message}${fields}`);
112
119
  }
113
120
  return error instanceof Error ? error : new Error('Unknown error occurred');
114
121
  }
package/dist/server.js CHANGED
@@ -1,6 +1,9 @@
1
+ import { createRequire } from 'module';
1
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
3
  import { PlanaxApiClient } from './api-client.js';
3
4
  import { planTools, planItemsTools, workspaceTools, projectTools, folderTools, taskTools, documentTools, commentTools, resourceLinkTools } from './tools/index.js';
5
+ // dist/server.js 기준 ../package.json = 패키지 루트 (npm 패키지에도 항상 들어간다)
6
+ const pkg = createRequire(import.meta.url)('../package.json');
4
7
  /**
5
8
  * Create an MCP server with every PlanAX tool module registered.
6
9
  * Shared by the stdio and HTTP transports.
@@ -8,7 +11,7 @@ import { planTools, planItemsTools, workspaceTools, projectTools, folderTools, t
8
11
  export function createServer(config) {
9
12
  const server = new McpServer({
10
13
  name: 'planax-mcp',
11
- version: '0.1.3',
14
+ version: pkg.version,
12
15
  });
13
16
  const toolContext = {
14
17
  server,
@@ -1,5 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { successResponse, errorResponse } from './types.js';
3
+ const MENTION_TOKEN = /@\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\}/g;
4
+ const MAX_VISIBLE_LENGTH = 1000;
5
+ /** 화면에 보이는 글자 수: 멘션 토큰은 1자 (백엔드 MentionTokens.visibleLength 와 같은 규칙) */
6
+ function visibleLength(content) {
7
+ return content.replace(MENTION_TOKEN, '@').length;
8
+ }
3
9
  /**
4
10
  * Comment Tools Module
5
11
  *
@@ -32,8 +38,10 @@ export function register({ server, apiClient }) {
32
38
  3. With pagination:
33
39
  { resourceType: "Task", resourceId: "task-uuid", page: 2, limit: 50 }
34
40
 
35
- **Returns:** Paginated list of comments with metadata (page, limit, total, totalPages).
36
- Each comment includes id, content, author, createdAt, replyCount, and parentCommentId.`,
41
+ **Returns:** Paginated list of top-level comments (page, limit, total, totalPages). Replies: comment_get_replies.
42
+ Each comment: id, content, author, createdAt, replyCount, parentCommentId, isEdited, attachments, reactions,
43
+ mentionedUserDetails [{ id, name, memberStatus: MEMBER | NOT_MEMBER }].
44
+ Mentions appear in content as tokens like @{user-uuid}; look the name up in mentionedUserDetails.`,
37
45
  inputSchema: {
38
46
  resourceType: z
39
47
  .enum(['Task', 'Document'])
@@ -51,8 +59,9 @@ Each comment includes id, content, author, createdAt, replyCount, and parentComm
51
59
  .enum(['newest', 'oldest'])
52
60
  .optional()
53
61
  .describe('Sort order (default: newest)'),
62
+ authorId: z.string().uuid().optional().describe('Only comments by this user'),
54
63
  },
55
- }, async ({ resourceType, resourceId, page, limit, sort }) => {
64
+ }, async ({ resourceType, resourceId, page, limit, sort, authorId }) => {
56
65
  try {
57
66
  const params = new URLSearchParams({ resourceType, resourceId });
58
67
  if (page)
@@ -61,6 +70,8 @@ Each comment includes id, content, author, createdAt, replyCount, and parentComm
61
70
  params.append('limit', String(limit));
62
71
  if (sort)
63
72
  params.append('sort', sort);
73
+ if (authorId)
74
+ params.append('authorId', authorId);
64
75
  const result = await apiClient.get(`/comments?${params.toString()}`);
65
76
  return successResponse(result);
66
77
  }
@@ -91,13 +102,24 @@ Each comment includes id, content, author, createdAt, replyCount, and parentComm
91
102
  parentCommentId: "parent-comment-uuid"
92
103
  }
93
104
 
105
+ **Mentions:** write \`@{userId}\` in content, e.g. "@{3fa85f64-5717-4562-b3fc-2c963f66afa6} please check".
106
+ Find user ids with project_list_members. Writing "@name" is plain text, not a mention. Only project members can be mentioned; they get a notification.
107
+
108
+ **Rules:**
109
+ - Max 1000 visible characters (a mention token counts as 1).
110
+ - A reply must be on the same task/document as its parent; you cannot reply to a deleted comment.
111
+
94
112
  **Returns:** The created comment object with id, content, author, and createdAt.`,
95
113
  inputSchema: {
96
114
  resourceType: z
97
115
  .enum(['Task', 'Document'])
98
116
  .describe('Resource type to comment on (Task or Document)'),
99
117
  resourceId: z.string().uuid().describe('Task or Document ID (UUID) - required'),
100
- content: z.string().min(1).describe('Comment text (required, non-blank)'),
118
+ content: z
119
+ .string()
120
+ .refine((v) => v.trim().length > 0, 'Comment cannot be blank')
121
+ .refine((v) => visibleLength(v) <= MAX_VISIBLE_LENGTH, `Max ${MAX_VISIBLE_LENGTH} visible characters (a mention token counts as 1)`)
122
+ .describe('Comment text. Mention users with @{userId}'),
101
123
  parentCommentId: z
102
124
  .string()
103
125
  .uuid()
@@ -151,7 +173,7 @@ Each comment includes id, content, author, createdAt, replyCount, and parentComm
151
173
  - Remove a comment you posted on a task or document
152
174
 
153
175
  **Notes:**
154
- - Only the comment's author can delete it.
176
+ - The comment's author or a project manager can delete it.
155
177
  - A comment that has replies cannot be deleted.
156
178
 
157
179
  **Examples:**