@dod/planax-mcp 0.1.1 → 0.1.3

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
@@ -2,87 +2,11 @@
2
2
 
3
3
  [PlanAX](https://app.planax.app)에 접근할 수 있는 MCP (Model Context Protocol) 서버입니다. PlanAX에 대한 소개는 https://planax.app 에서 볼 수 있습니다.
4
4
 
5
- ## Features
6
-
7
- PlanAX의 프로젝트, 계획, 문서, 작업을 MCP 도구로 다룰 수 있습니다.
8
-
9
- ### Workspaces
10
- - `workspace_list` - 접근 가능한 워크스페이스 목록
11
- - `workspace_get` - 워크스페이스 상세 정보
12
-
13
- ### Projects
14
- - `project_list` - 워크스페이스의 프로젝트 목록
15
- - `project_get` - 프로젝트 상세 정보
16
-
17
- ### Plans
18
- - `plan_check_exists` - Plan 존재 여부 확인
19
- - `plan_create` - Plan 생성 (템플릿 기반 또는 빈 Plan)
20
- - `plan_get_tree` - 전체 Plan 트리 조회
21
- - `plan_list_root_phases` - 최상위 Phase 목록
22
- - `plan_list_all_phases` - 모든 Phase를 경로 정보와 함께 목록으로 조회
23
- - `plan_get_phase_children` - Phase의 하위 항목 조회
24
- - `plan_create_phase` - Phase 생성
25
- - `plan_update_phase` - Phase 수정 (이름, 날짜, 상태)
26
- - `plan_create_task` - Phase에 Task 생성
27
- - `plan_create_document` - Phase에 Document 생성
28
- - `plan_link_task_to_phase` - Task를 Phase에 연결 또는 해제
29
- - `plan_link_document_to_phase` - Document를 Phase에 연결 또는 해제
30
- - `plan_reorder_items` - Plan 항목 순서 변경
31
-
32
- ### Folders
33
- - `folder_list` - 프로젝트의 폴더 트리 조회
34
- - `folder_get` - 폴더 상세 조회
35
- - `folder_create` - 폴더 생성
36
- - `folder_update` - 폴더 수정 (이름, 설명, 색상, 위치)
37
- - `folder_delete` - 빈 폴더 삭제
38
- - `folder_get_path` - 폴더 경로 조회
39
-
40
- ### Tasks
41
- - `task_list` - Task 목록
42
- - `task_get` - Task 상세 정보
43
- - `task_create` - Task 생성
44
- - `task_update` - Task 수정
45
- - `task_delete` - Task 삭제
46
- - `task_restore` - 삭제한 Task 복원
47
- - `task_list_hidden_completed` - 숨겨진 완료 Task 목록
48
- - `task_assign` - Task 담당자 지정
49
-
50
- ### Documents
51
- - `document_list` - Document 목록
52
- - `document_get` - Document 상세 정보
53
- - `document_create_markdown` - Markdown 문서 생성
54
- - `document_get_markdown_content` - Markdown 내용 조회
55
- - `document_update_markdown_content` - Markdown 내용 수정
56
- - `document_upload` - 파일 업로드
57
- - `document_create_placeholder` - 자리표시 문서 생성
58
- - `document_convert_placeholder` - 자리표시 문서를 파일 또는 Markdown으로 변환
59
- - `document_create_link` - 링크 문서 생성
60
- - `document_update_link` - 링크 문서 수정
61
- - `document_update` - Document 정보 수정
62
- - `document_move` - Document 이동
63
- - `document_delete` - Document 삭제
64
- - `document_get_related` - 연관 문서 조회
65
- - `document_get_versions` - 문서 버전 이력 조회
66
-
67
- ### Resource Links
68
- - `resource_link_create` - 리소스 간 링크 생성
69
- - `resource_link_list` - 링크 목록
70
- - `resource_link_delete` - 링크 삭제
71
- - `resource_link_get_types` - 링크 유형 조회
72
- - `resource_link_get_blocking` - 차단 관계 조회
73
- - `resource_link_get_references` - 참조 관계 조회
74
-
75
- ### Comments
76
- - `comment_list` - Task 또는 Document의 댓글 목록
77
- - `comment_create` - 댓글 또는 답글 작성
78
- - `comment_get_replies` - 댓글의 답글 목록
79
- - `comment_delete` - 댓글 삭제
80
-
81
5
  ## Quick Start (npx)
82
6
 
83
- 설치 없이 npm 패키지를 바로 실행할 수 있습니다. MCP를 지원하는 클라이언트라면 어디서든 사용할 수 있고, 클라이언트마다 설정 방법만 다릅니다. Node.js 18 이상이 필요합니다.
7
+ 설치 없이 `npx`로 바로 실행할 수 있습니다. MCP를 지원하는 클라이언트라면 어디서든 사용할 수 있고, 클라이언트마다 설정 방법만 다릅니다. Node.js 18 이상이 필요합니다.
84
8
 
85
- 토큰은 https://app.planax.app 의 설정에서 발급합니다. `PLANAX_API_URL`을 지정하지 않으면 운영 서버를 사용합니다.
9
+ 토큰은 https://app.planax.app 의 설정에서 발급합니다.
86
10
 
87
11
  ### Claude Code
88
12
 
@@ -148,34 +72,122 @@ env = { PLANAX_ACCESS_TOKEN = "your_token_here" }
148
72
  }
149
73
  ```
150
74
 
151
- > 이 서버는 로컬에서 실행되는 stdio 방식입니다. URL로 연결하는 원격 MCP 방식은 지원하지 않습니다.
152
-
153
75
  ## Configuration
154
76
 
155
- 환경 변수로 설정합니다. `.env` 파일을 사용해도 됩니다:
77
+ | 환경 변수 | 필수 | 설명 |
78
+ |---|---|---|
79
+ | `PLANAX_ACCESS_TOKEN` | 필수 | PlanAX 액세스 토큰 (https://app.planax.app 의 설정에서 발급) |
156
80
 
157
- ```env
158
- # Backend API URL
159
- PLANAX_API_URL=https://nexus-backend.dodlab.xyz
81
+ ## Features
160
82
 
161
- # Personal Access Token (https://app.planax.app 의 설정에서 생성)
162
- PLANAX_ACCESS_TOKEN=your_personal_access_token_here
163
- ```
83
+ 연결하면 AI 어시스턴트가 PlanAX의 데이터를 조회하고 변경할 수 있습니다. 영역을 펼치면 사용할 수 있는 도구를 볼 수 있습니다.
164
84
 
165
- ## Remote Mode (HTTP)
85
+ <details>
86
+ <summary><b>Workspace, Project</b> (4)</summary>
166
87
 
167
- 로컬 실행 대신 서버로 띄워서 URL로 연결하는 방식입니다. 원격 MCP 서버만 지원하는 클라이언트에서 사용합니다.
88
+ - `workspace_list` - 접근 가능한 워크스페이스 목록
89
+ - `workspace_get` - 워크스페이스 상세 정보
90
+ - `project_list` - 워크스페이스의 프로젝트 목록
91
+ - `project_get` - 프로젝트 상세 정보
168
92
 
169
- ```bash
170
- planax-mcp --http # 또는 MCP_TRANSPORT=http
171
- PORT=3000 npm run start:http
172
- ```
93
+ </details>
94
+
95
+ <details>
96
+ <summary><b>Plan</b> (14)</summary>
97
+
98
+ - `plan_check_exists` - 프로젝트에 Plan이 있는지 확인
99
+ - `plan_create` - Plan 생성 (템플릿 기반 또는 빈 Plan)
100
+ - `plan_get_tree` - 전체 Plan 트리 조회 (Phase, Task, Document 포함)
101
+ - `plan_list_root_phases` - 최상위 Phase 목록
102
+ - `plan_list_all_phases` - 모든 Phase를 경로 정보와 함께 목록으로 조회
103
+ - `plan_get_phase_children` - Phase의 하위 항목(하위 Phase, Task, Document) 조회
104
+ - `plan_create_phase` - Phase 생성
105
+ - `plan_update_phase` - Phase 수정 (이름, 날짜, 상태)
106
+ - `plan_delete_phase` - Phase 삭제 (하위 Phase 포함)
107
+ - `plan_create_task` - Plan에 Task 생성
108
+ - `plan_create_document` - Plan에 자리표시 문서 생성
109
+ - `plan_link_task_to_phase` - Task를 Phase에 연결 또는 해제
110
+ - `plan_link_document_to_phase` - Document를 Phase에 연결 또는 해제
111
+ - `plan_reorder_items` - Phase, Task, Document 순서 변경
112
+
113
+ </details>
114
+
115
+ <details>
116
+ <summary><b>Task</b> (8)</summary>
117
+
118
+ - `task_list` - 프로젝트의 Task 목록 (필터 지원)
119
+ - `task_get` - Task 상세 정보
120
+ - `task_create` - Task 생성
121
+ - `task_update` - Task 수정 (제목, 설명, 상태 등)
122
+ - `task_delete` - Task 삭제
123
+ - `task_restore` - 삭제한 Task 복원
124
+ - `task_list_hidden_completed` - 숨겨진 완료 Task 목록
125
+ - `task_assign` - Task 담당자 지정 또는 변경
126
+
127
+ </details>
128
+
129
+ <details>
130
+ <summary><b>Document</b> (16)</summary>
131
+
132
+ - `document_list` - 프로젝트의 문서 목록 (필터 지원)
133
+ - `document_get` - 문서 상세 정보
134
+ - `document_create_markdown` - Markdown 문서 생성
135
+ - `document_get_markdown_content` - Markdown 문서 내용 조회
136
+ - `document_update_markdown_content` - Markdown 문서 내용 수정
137
+ - `document_upload` - 파일(PDF, Word, Excel, 이미지 등) 업로드
138
+ - `document_replace_file` - 기존 문서의 파일을 새 파일로 교체 (새 버전으로 올라가고 이전 버전은 이력에 남음)
139
+ - `document_create_placeholder` - 나중에 채울 자리표시 문서 생성
140
+ - `document_convert_placeholder` - 자리표시 문서를 실제 문서로 변환
141
+ - `document_create_link` - 외부 콘텐츠를 가리키는 링크 문서 생성
142
+ - `document_update_link` - 링크 문서의 URL 또는 유형 수정
143
+ - `document_update` - 문서 정보 수정 (제목, 설명, 상태)
144
+ - `document_move` - 문서를 다른 폴더로 이동
145
+ - `document_delete` - 문서 삭제
146
+ - `document_get_related` - 문서와 관련된 항목 조회
147
+ - `document_get_versions` - 문서 버전 이력 조회
148
+
149
+ </details>
150
+
151
+ <details>
152
+ <summary><b>Folder</b> (6)</summary>
153
+
154
+ - `folder_list` - 프로젝트의 폴더 트리 조회
155
+ - `folder_get` - 폴더 상세 정보
156
+ - `folder_create` - 폴더 생성 (최상위 또는 하위)
157
+ - `folder_update` - 폴더 수정 (이름, 설명, 색상, 위치)
158
+ - `folder_delete` - 빈 폴더 삭제
159
+ - `folder_get_path` - 폴더 경로 조회
160
+
161
+ </details>
162
+
163
+ <details>
164
+ <summary><b>Resource Link</b> (6)</summary>
165
+
166
+ - `resource_link_create` - Task 또는 Document 사이의 연결 생성
167
+ - `resource_link_list` - 리소스의 연결 목록
168
+ - `resource_link_delete` - 연결 삭제
169
+ - `resource_link_get_types` - 사용할 수 있는 연결 유형과 규칙 조회
170
+ - `resource_link_get_blocking` - Task를 막고 있는(차단하는) 관계 조회
171
+ - `resource_link_get_references` - 리소스가 참조하는 관계 조회
172
+
173
+ </details>
174
+
175
+ <details>
176
+ <summary><b>Comment</b> (4)</summary>
177
+
178
+ - `comment_list` - Task 또는 Document의 댓글 목록
179
+ - `comment_create` - 댓글 또는 답글 작성
180
+ - `comment_get_replies` - 댓글의 답글 목록
181
+ - `comment_delete` - 댓글 삭제
182
+
183
+ </details>
184
+
185
+ ## Example Prompts
173
186
 
174
- - 엔드포인트: `POST /mcp`(MCP), `GET /health`(상태 확인)
175
- - 기본 포트는 `3000`이고 `PORT` 환경 변수로 바꿀 수 있습니다.
176
- - 인증: 요청마다 `Authorization: Bearer <PlanAX 액세스 토큰>` 헤더를 보내야 합니다. 토큰은 해당 요청을 처리하는 동안에만 백엔드로 전달되고, 서버에 저장되거나 서버 환경 변수에서 읽지 않습니다. 헤더가 없으면 `401`을 반환합니다.
177
- - 세션을 유지하지 않는 stateless 방식이라, 서버를 여러 대로 늘려도 됩니다.
178
- - HTTPS는 서버 앞단(리버스 프록시, 로드밸런서)에서 처리합니다.
187
+ - "내 워크스페이스의 프로젝트 목록을 보여줘"
188
+ - "이번 프로젝트의 Plan에서 진행 중인 단계와 작업을 정리해줘"
189
+ - "개발 단계에 'API 명세 검토' 작업을 만들고 나에게 지정해줘"
190
+ - "이 회의록을 Markdown 문서로 올려줘"
179
191
 
180
192
  ## License
181
193
 
@@ -43,8 +43,20 @@ export class PlanaxApiClient {
43
43
  * Multipart/form-data POST request (file upload)
44
44
  */
45
45
  async postForm(path, form) {
46
+ return this.sendForm('post', path, form);
47
+ }
48
+ /**
49
+ * Multipart/form-data PATCH request (file replace)
50
+ */
51
+ async patchForm(path, form) {
52
+ return this.sendForm('patch', path, form);
53
+ }
54
+ async sendForm(method, path, form) {
46
55
  try {
47
- const response = await this.client.post(path, form, {
56
+ const response = await this.client.request({
57
+ method,
58
+ url: path,
59
+ data: form,
48
60
  headers: { 'Content-Type': 'multipart/form-data' },
49
61
  maxBodyLength: Infinity,
50
62
  maxContentLength: Infinity,
package/dist/server.js CHANGED
@@ -8,7 +8,7 @@ import { planTools, planItemsTools, workspaceTools, projectTools, folderTools, t
8
8
  export function createServer(config) {
9
9
  const server = new McpServer({
10
10
  name: 'planax-mcp',
11
- version: '0.1.1',
11
+ version: '0.1.3',
12
12
  });
13
13
  const toolContext = {
14
14
  server,
@@ -3,6 +3,44 @@ import { basename } from 'node:path';
3
3
  import { z } from 'zod';
4
4
  import { successResponse, errorResponse } from './types.js';
5
5
  const MAX_UPLOAD_BYTES = 50 * 1024 * 1024;
6
+ const MIME_BY_EXTENSION = {
7
+ pdf: 'application/pdf',
8
+ jpg: 'image/jpeg',
9
+ jpeg: 'image/jpeg',
10
+ png: 'image/png',
11
+ gif: 'image/gif',
12
+ webp: 'image/webp',
13
+ svg: 'image/svg+xml',
14
+ bmp: 'image/bmp',
15
+ txt: 'text/plain',
16
+ csv: 'text/csv',
17
+ md: 'text/markdown',
18
+ html: 'text/html',
19
+ json: 'application/json',
20
+ xml: 'application/xml',
21
+ zip: 'application/zip',
22
+ doc: 'application/msword',
23
+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
24
+ xls: 'application/vnd.ms-excel',
25
+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
26
+ ppt: 'application/vnd.ms-powerpoint',
27
+ pptx: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
28
+ hwp: 'application/x-hwp',
29
+ mp4: 'video/mp4',
30
+ mov: 'video/quicktime',
31
+ mp3: 'audio/mpeg',
32
+ wav: 'audio/wav',
33
+ };
34
+ /**
35
+ * Guess a MIME type from the file extension.
36
+ * An empty Blob type makes the multipart part go out without Content-Type,
37
+ * so the server stores application/octet-stream and the preview does not show.
38
+ */
39
+ function guessMimeType(fileName) {
40
+ const dot = fileName.lastIndexOf('.');
41
+ const extension = dot >= 0 ? fileName.slice(dot + 1).toLowerCase() : '';
42
+ return MIME_BY_EXTENSION[extension] ?? 'application/octet-stream';
43
+ }
6
44
  /**
7
45
  * Build a Blob from a local file path or base64 content for multipart upload.
8
46
  */
@@ -21,7 +59,7 @@ async function loadFilePart(filePath, contentBase64, fileName) {
21
59
  if (!name) {
22
60
  throw new Error('fileName is required when using contentBase64.');
23
61
  }
24
- return { blob: new Blob([new Uint8Array(buffer)]), name };
62
+ return { blob: new Blob([new Uint8Array(buffer)], { type: guessMimeType(name) }), name };
25
63
  }
26
64
  /**
27
65
  * Document Tools Module
@@ -637,6 +675,50 @@ export function register({ server, apiClient }) {
637
675
  return errorResponse(error);
638
676
  }
639
677
  });
678
+ // ===== Document Replace File (new version) =====
679
+ server.registerTool('document_replace_file', {
680
+ description: `Replace the file of an existing document with a new one. The document gets a new version; earlier versions stay in version history.
681
+
682
+ **When to use:**
683
+ - Upload a revised file (e.g., "protocol v2.pdf") to a document that already exists
684
+ - Use document_upload instead to create a new document
685
+
686
+ **Note:**
687
+ - Not allowed while a signature process is in progress on the document (cancel it first in the web app)
688
+ - A MARKDOWN document becomes a FILE document; its previous text stays in version history
689
+ - If the replaced version went through signing, the document status resets to DRAFT
690
+
691
+ **Input:** Provide either \`filePath\` (absolute path on the machine running this MCP server) or \`contentBase64\` with \`fileName\`. Max 50MB.
692
+
693
+ **Example:**
694
+ { projectId: "...", documentId: "...", filePath: "/Users/me/Documents/protocol_v2.pdf", changeReason: "IRB 의견 반영" }
695
+
696
+ **Returns:** Updated document (new version number)`,
697
+ inputSchema: {
698
+ projectId: z.string().uuid().describe('Project ID (UUID) - required'),
699
+ documentId: z.string().uuid().describe('Document ID (UUID) to replace the file of'),
700
+ filePath: z.string().optional().describe('Absolute path of the local file to upload'),
701
+ contentBase64: z.string().optional().describe('Base64-encoded file content (use with fileName)'),
702
+ fileName: z.string().optional().describe('File name with extension (required with contentBase64)'),
703
+ changeReason: z.string().max(500).optional().describe('Reason shown in version history'),
704
+ versionLabel: z.string().optional().describe('Version label (e.g., "v2.0")'),
705
+ },
706
+ }, async ({ projectId, documentId, filePath, contentBase64, fileName, changeReason, versionLabel }) => {
707
+ try {
708
+ const { blob, name } = await loadFilePart(filePath, contentBase64, fileName);
709
+ const form = new FormData();
710
+ form.append('file', blob, name);
711
+ if (changeReason)
712
+ form.append('changeReason', changeReason);
713
+ if (versionLabel)
714
+ form.append('versionLabel', versionLabel);
715
+ const result = await apiClient.patchForm(`/projects/${projectId}/documents/${documentId}/replace-file`, form);
716
+ return successResponse(result, `File replaced with "${name}" (new version)`);
717
+ }
718
+ catch (error) {
719
+ return errorResponse(error);
720
+ }
721
+ });
640
722
  // ===== Document Convert Placeholder =====
641
723
  server.registerTool('document_convert_placeholder', {
642
724
  description: `Convert a placeholder document to an actual document.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dod/planax-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "PlanAX MCP Server - Access projects, documents, and tasks via Model Context Protocol",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",