docuking-mcp 1.2.1 → 1.2.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.
Files changed (2) hide show
  1. package/index.js +88 -25
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -272,7 +272,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
272
272
  },
273
273
  {
274
274
  name: 'docuking_plan',
275
- description: '작업 계획 문서를 z_PlanToResult/ 폴더에 생성하거나 업데이트합니다. 작업 시작 시 계획을 작성하고, 진행하면서 결과를 upsert합니다.',
275
+ description: '작업 계획 문서를 z_Plan_Result/ 폴더에 생성하거나 업데이트합니다. 작업 시작 시 계획을 작성하고, 진행하면서 결과를 upsert합니다.',
276
276
  inputSchema: {
277
277
  type: 'object',
278
278
  properties: {
@@ -413,10 +413,34 @@ zz_Coworker_*/
413
413
  - git 저장소 크기 최적화 (대용량 문서 제외)
414
414
  - DocuKing이 문서 버전 관리를 전담
415
415
 
416
+ ## AI 필수 작업 흐름 (매우 중요!)
417
+
418
+ ### MCP 서버 추가 시 (claude mcp add 명령 실행 후)
419
+ 1. \`claude mcp add docuking ...\` 명령 실행
420
+ 2. 사용자에게 "재시작 후 아래 명령을 다시 붙여넣으세요" 안내
421
+ 3. 재시작 후 \`docuking_init\` 실행
422
+
423
+ ### docuking_init 실행 후 (⚠️ 필수!)
424
+ 1. init 결과에서 \`DOCUKING_REPOS\` 값 확인
425
+ 2. **AI가 직접** \`~/.claude.json\` 파일을 Edit 도구로 수정:
426
+ - 해당 프로젝트의 \`mcpServers.docuking.env\`에 \`DOCUKING_REPOS\` 추가
427
+ - 기존 env에 추가하는 것이므로 DOCUKING_API_KEY는 유지
428
+ 3. 사용자에게 "재시작 후 push 가능" 안내
429
+
430
+ **예시 (AI가 수행할 Edit):**
431
+ \`\`\`json
432
+ // ~/.claude.json의 해당 프로젝트 mcpServers.docuking.env
433
+ {
434
+ "DOCUKING_API_KEY": "sk_xxx...",
435
+ "DOCUKING_REPOS": "{\\"경로\\":{\\"id\\":\\"프로젝트ID\\",\\"name\\":\\"이름\\"}}"
436
+ }
437
+ \`\`\`
438
+
416
439
  ## MCP 도구 목록
417
440
 
418
441
  ### 1. docuking_init
419
442
  프로젝트를 DocuKing에 연결합니다.
443
+ **중요:** init 후 AI가 ~/.claude.json에 DOCUKING_REPOS를 추가해야 함!
420
444
 
421
445
  ### 2. docuking_push
422
446
  로컬 문서를 서버에 업로드합니다. Git의 add + commit + push를 한 번에 수행.
@@ -446,7 +470,7 @@ zz_Coworker_*/
446
470
  - 사용자가 "이거 기록해줘"라고 요청할 때
447
471
 
448
472
  ### 10. docuking_plan
449
- 작업 계획을 \`z_PlanToResult/\` 폴더에 생성/업데이트합니다.
473
+ 작업 계획을 \`z_Plan_Result/\` 폴더에 생성/업데이트합니다.
450
474
  - 작업 시작 시 계획 생성
451
475
  - 진행하면서 단계별 결과 upsert
452
476
  - planId로 기존 계획 찾아서 업데이트
@@ -654,7 +678,7 @@ AI: (결정이 내려졌으므로 docuking_talk 호출)
654
678
  })
655
679
  \`\`\`
656
680
 
657
- **저장 위치:** \`z_Talk/YYYY/MM/YYYY-MM-DD_HHMM__제목.md\`
681
+ **저장 위치:** \`z_DocuKing/z_Talk/YYYY/MM/YYYY-MM-DD_HHMM__제목.md\`
658
682
 
659
683
  ### 작업 계획 관리 (docuking_plan, docuking_done)
660
684
 
@@ -705,7 +729,7 @@ AI: docuking_done({
705
729
  })
706
730
  \`\`\`
707
731
 
708
- **저장 위치:** \`z_PlanToResult/YYYY/MM/YYYY-MM-DD_HHMM__제목__planId.md\`
732
+ **저장 위치:** \`z_DocuKing/z_Plan_Result/YYYY/MM/YYYY-MM-DD_HHMM__제목__planId.md\`
709
733
 
710
734
  **핵심 가치:**
711
735
  - AI 세션이 끊겨도 (컴팩션, 세션 종료) 다음 AI가 계획 문서를 보고 이어서 작업 가능
@@ -885,24 +909,62 @@ MCP 설정에 다음을 추가하세요:
885
909
  };
886
910
  }
887
911
 
888
- // z_DocuKing 폴더 생성 (항상 새로 만듦)
889
- const folderName = 'z_DocuKing';
890
- const docuKingPath = path.join(localPath, folderName);
912
+ // Co-worker 권한은 API Key 형식에서 판단 (sk_xxx_cw_이름_)
913
+ const coworkerMatch = API_KEY.match(/^sk_[a-f0-9]+_cw_([^_]+)_/);
914
+ const isCoworker = !!coworkerMatch;
915
+ const coworkerName = coworkerMatch ? coworkerMatch[1] : null;
891
916
 
892
- if (!fs.existsSync(docuKingPath)) {
893
- fs.mkdirSync(docuKingPath, { recursive: true });
917
+ // 폴더 생성: 코워커는 zz_Coworker_{이름}/, 오너는 z_DocuKing/
918
+ let folderName;
919
+ let workingPath;
920
+
921
+ if (isCoworker) {
922
+ folderName = `zz_Coworker_${coworkerName}`;
923
+ workingPath = path.join(localPath, folderName);
924
+ } else {
925
+ folderName = 'z_DocuKing';
926
+ workingPath = path.join(localPath, folderName);
927
+ }
928
+
929
+ if (!fs.existsSync(workingPath)) {
930
+ fs.mkdirSync(workingPath, { recursive: true });
894
931
  }
895
932
 
896
933
  // JSON 이스케이프 처리
897
934
  const escapedPath = localPath.replace(/\\/g, '\\\\');
898
935
  const repoConfig = `{\\"${escapedPath}\\":{\\"id\\":\\"${projectId}\\",\\"name\\":\\"${projectName}\\"}}`;
899
936
 
900
- // 연결 완료 안내
901
- return {
902
- content: [
903
- {
904
- type: 'text',
905
- text: `DocuKing 연결 완료!
937
+ // 연결 완료 안내 (오너/코워커에 따라 다른 메시지)
938
+ if (isCoworker) {
939
+ return {
940
+ content: [
941
+ {
942
+ type: 'text',
943
+ text: `DocuKing 연결 완료! (참여자)
944
+
945
+ 📁 프로젝트: ${projectName}
946
+ 📂 ${folderName}/ 폴더가 생성되었습니다.
947
+ 👤 참여자: ${coworkerName}
948
+
949
+ 참여자 사용법:
950
+ - "DocuKing에서 가져와" → 오너의 문서를 z_DocuKing/에 Pull
951
+ - ${folderName}/ 폴더에 문서 작성
952
+ - "DocuKing에 올려줘" → 내 문서를 서버에 Push
953
+
954
+ 💡 참여자는 ${folderName}/ 폴더에만 Push할 수 있습니다.
955
+ 오너의 문서는 Pull로 읽을 수 있지만 수정은 제안서 형태로 작성하세요.
956
+
957
+ ⚠️ AI 필수 작업: ~/.claude.json의 docuking MCP env에 DOCUKING_REPOS 추가 필요
958
+ "DOCUKING_REPOS": "${repoConfig}"`,
959
+ },
960
+ ],
961
+ };
962
+ } else {
963
+ return {
964
+ content: [
965
+ {
966
+ type: 'text',
967
+ text: `DocuKing 연결 완료!
906
968
 
907
969
  📁 프로젝트: ${projectName}
908
970
  📂 z_DocuKing/ 폴더가 생성되었습니다.
@@ -915,11 +977,12 @@ MCP 설정에 다음을 추가하세요:
915
977
  - "DocuKing에 올려줘" → 로컬 문서를 서버에 Push
916
978
  - "DocuKing에서 가져와" → 서버 문서를 로컬로 Pull
917
979
 
918
- MCP 설정에 레포 매핑 추가 필요:
980
+ ⚠️ AI 필수 작업: ~/.claude.json의 docuking MCP env에 DOCUKING_REPOS 추가 필요
919
981
  "DOCUKING_REPOS": "${repoConfig}"`,
920
- },
921
- ],
922
- };
982
+ },
983
+ ],
984
+ };
985
+ }
923
986
  }
924
987
 
925
988
  // docuking_push 구현
@@ -1833,8 +1896,8 @@ function generatePlanId() {
1833
1896
  async function handleTalk(args) {
1834
1897
  const { localPath, title, content, tags = [] } = args;
1835
1898
 
1836
- // z_Talk 폴더 경로
1837
- const talkBasePath = path.join(localPath, 'z_Talk');
1899
+ // z_Talk 폴더 경로 (z_DocuKing 아래)
1900
+ const talkBasePath = path.join(localPath, 'z_DocuKing', 'z_Talk');
1838
1901
 
1839
1902
  // 날짜 기반 파일명 생성
1840
1903
  const { fileName, yearMonth, timestamp } = generateDateFileName(title);
@@ -1887,8 +1950,8 @@ ${content}
1887
1950
  async function handlePlan(args) {
1888
1951
  const { localPath, planId, title, goal, steps = [], notes } = args;
1889
1952
 
1890
- // z_PlanToResult 폴더 경로
1891
- const planBasePath = path.join(localPath, 'z_PlanToResult');
1953
+ // z_Plan_Result 폴더 경로 (z_DocuKing 아래)
1954
+ const planBasePath = path.join(localPath, 'z_DocuKing', 'z_Plan_Result');
1892
1955
 
1893
1956
  // 기존 계획 업데이트 또는 새 계획 생성
1894
1957
  let targetPlanId = planId;
@@ -2038,8 +2101,8 @@ function findPlanFiles(basePath, planId) {
2038
2101
  async function handleDone(args) {
2039
2102
  const { localPath, planId, summary, artifacts = [] } = args;
2040
2103
 
2041
- // z_PlanToResult 폴더 경로
2042
- const planBasePath = path.join(localPath, 'z_PlanToResult');
2104
+ // z_Plan_Result 폴더 경로 (z_DocuKing 아래)
2105
+ const planBasePath = path.join(localPath, 'z_DocuKing', 'z_Plan_Result');
2043
2106
 
2044
2107
  // 계획 파일 찾기
2045
2108
  const planFiles = findPlanFiles(planBasePath, planId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docuking-mcp",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "DocuKing MCP Server - AI 시대의 문서 협업 플랫폼",
5
5
  "type": "module",
6
6
  "main": "index.js",