docuking-mcp 2.9.0 → 2.9.2

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/index.js CHANGED
@@ -1,830 +1,866 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * DocuKing MCP Server v2.0
5
- *
6
- * AI 시대의 문서 협업 플랫폼 - AI가 문서를 Push/Pull 할 수 있게 해주는 MCP 서버
7
- *
8
- * 폴더 구조:
9
- * - xx_Infra_Config/ : 시스템 설정 (.env 백업, 배포 정보 등) - Push 대상
10
- * - xx_Policy/ : 정책 문서 (AI 행동 지침) - Push 대상, 킹캐스트 대상
11
- * - yy_All_Docu/ : 문서 동기화 폴더 (Push/Pull 대상)
12
- * - yy_All_Docu/_Private/ : 오너 비공개 폴더 (오너만 접근)
13
- * - yy_Coworker_{폴더명}/ : 협업자 폴더 (yy_All_Docu와 별도, 동기화 대상)
14
- * - zz_ai_1_Talk/ : AI 대화록 (킹톡, Push 대상)
15
- * - zz_ai_2_Todo/ : AI 투두 (킹투두, Push 대상)
16
- * - zz_ai_3_Plan/ : AI 플랜 (킹플랜, Push 대상)
17
- *
18
- * 접두사 규칙:
19
- * - xx_ : 시스템용 폴더 (인프라, 정책) - Push 대상
20
- * - yy_ : 사람용 폴더 (문서, 협업자) - Push 대상
21
- * - zz_ai_ : AI용 폴더 (Talk, Todo, Plan) - Push 대상
22
- * - _ : 비공개 폴더 (본인만 접근)
23
- *
24
- * 도구:
25
- * - docuking_init: 레포 연결, yy_All_Docu/ 폴더 생성
26
- * - docuking_push: 로컬 → 서버 (.env 자동 백업)
27
- * - docuking_pull: 서버 → 로컬
28
- */
29
-
30
- import { Server } from '@modelcontextprotocol/sdk/server/index.js';
31
- import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
32
- import {
33
- CallToolRequestSchema,
34
- ListToolsRequestSchema,
35
- ListResourcesRequestSchema,
36
- ReadResourceRequestSchema,
37
- } from '@modelcontextprotocol/sdk/types.js';
38
-
39
- // 핸들러 import
40
- import {
41
- handleInit,
42
- handlePush,
43
- handlePull,
44
- handleList,
45
- handleStatus,
46
- } from './handlers/sync.js';
47
-
48
- import {
49
- handleLog,
50
- handleDiff,
51
- handleRollback,
52
- } from './handlers/version.js';
53
-
54
- import {
55
- handleTodo,
56
- handleTalk,
57
- handlePlan,
58
- handleDone,
59
- handleUrgent,
60
- } from './handlers/docs.js';
61
-
62
- import { handleValidate } from './handlers/validate.js';
63
-
64
- // MCP 서버 생성
65
- const server = new Server(
66
- {
67
- name: 'docuking-mcp',
68
- version: '1.0.0',
69
- },
70
- {
71
- capabilities: {
72
- tools: {},
73
- resources: {},
74
- },
75
- }
76
- );
77
-
78
- // 도구 목록
79
- server.setRequestHandler(ListToolsRequestSchema, async () => {
80
- return {
81
- tools: [
82
- {
83
- name: 'docuking_init',
84
- description: `프로젝트를 DocuKing에 연결합니다. .docuking/config.json에 설정 저장, yy_All_Docu/ 폴더 생성.
85
-
86
- **필수 파라미터:**
87
- - projectId: 프로젝트 UUID
88
- - projectName: 프로젝트 이름 (표시용)
89
- - apiKey: API (sk_xxx 형식)
90
- - localPath: 로컬 프로젝트 경로
91
-
92
- **오너 초기화 시:**
93
- - xx_Infra_Config/, xx_Policy/ 폴더 생성 (시스템 설정)
94
- - yy_All_Docu/, yy_All_Docu/_Private/ 폴더 생성
95
- - zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ 폴더 생성
96
- - CLAUDE.md에 DocuKing 연결 안내 추가
97
- - 초기화 완료 정책 문서 작성 가이드 제공
98
-
99
- **협업자 초기화 시:**
100
- - yy_Coworker_{폴더명}/ 폴더 생성 (안에 _Private/, zz_ai_*/ 포함)
101
- - CLAUDE.md에 DocuKing 연결 안내 추가
102
- - "Pull을 실행하세요" 안내 (오너 정책이 킹캐스트로 로컬화됨)
103
-
104
- **정책 문서 템플릿 (오너용, xx_Policy/ 폴더에 작성):**
105
-
106
- [필수]
107
- - 00_project_overview.md - 프로젝트 개요, 기술 스택, 팀 구성, 주요 URL
108
-
109
- [구조/규칙]
110
- - 01_folder_structure.md - 폴더 구조 규칙, 파일 명명 규칙
111
- - 02_naming_convention.md - 변수/함수/클래스 명명 규칙
112
- - 03_api_convention.md - API 엔드포인트 규칙, 요청/응답 형식, 에러 코드
113
-
114
- [데이터베이스]
115
- - 05_database_schema.md - 테이블/컬럼 명명, 타입 규칙, 필수 컬럼(id, createdAt 등)
116
- - 06_database_migration.md - 마이그레이션 절차, 브랜치별 스키마 관리, 충돌 해결법
117
-
118
- [개발 정책]
119
- - 10_coding_style.md - 코딩 스타일, 린터 설정, 포매터 규칙
120
- - 11_git_workflow.md - 브랜치 전략, 커밋 메시지 규칙, PR 규칙
121
- - 12_testing_policy.md - 테스트 작성 규칙, 커버리지 기준
122
- - 13_error_handling.md - 에러 처리 패턴, 로깅 규칙
123
-
124
- [디자인/UI]
125
- - 20_design_system.md - 디자인 시스템, 컬러, 타이포그래피
126
- - 21_component_guide.md - 컴포넌트 작성 규칙, 스타일링 방식
127
-
128
- [인프라/보안]
129
- - 30_deployment.md - 배포 절차, 환경별 설정
130
- - 31_security_policy.md - 보안 규칙, 인증/인가, 민감정보 처리
131
-
132
- [AI 전용]
133
- - 99_for_claude.md - Claude Code 행동 지침, 금지/필수 사항
134
-
135
- init 완료 후 오너에게 "정책 문서를 작성하시겠습니까?" 제안할 것.`,
136
- inputSchema: {
137
- type: 'object',
138
- properties: {
139
- projectId: {
140
- type: 'string',
141
- description: 'DocuKing 프로젝트 ID',
142
- },
143
- projectName: {
144
- type: 'string',
145
- description: 'DocuKing 프로젝트 이름 (표시용)',
146
- },
147
- apiKey: {
148
- type: 'string',
149
- description: 'API 키 (sk_xxx 형식)',
150
- },
151
- localPath: {
152
- type: 'string',
153
- description: '로컬 프로젝트 경로 (예: /Users/user/my-project)',
154
- },
155
- },
156
- required: ['projectId', 'projectName', 'apiKey', 'localPath'],
157
- },
158
- },
159
- {
160
- name: 'docuking_push',
161
- description: `문서를 DocuKing 서버에 동기화합니다. 내부적으로 Pull → Push 순서로 실행 (git pull && git push 패턴).
162
-
163
- **AI 필독: 다음 상황에서 자발적으로 이 도구 사용을 제안하세요:**
164
- - zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ 문서를 생성/수정한
165
- - yy_All_Docu/ 에 문서를 생성/수정한 후
166
- - docuking_plan, docuking_done, docuking_talk, docuking_todo 실행
167
- - 사용자가 "올려", "푸시", "동기화" 등을 언급할 때
168
-
169
- 제안 예시: "킹폴더에 문서가 생성되었습니다. DocuKing에 올릴까요?"`,
170
- inputSchema: {
171
- type: 'object',
172
- properties: {
173
- localPath: {
174
- type: 'string',
175
- description: '로컬 프로젝트 경로 (레포 매핑에서 projectId 찾음)',
176
- },
177
- filePath: {
178
- type: 'string',
179
- description: '푸시할 파일 경로 (Z_DocuKing/ 기준 상대경로). 생략 시 전체 동기화.',
180
- },
181
- message: {
182
- type: 'string',
183
- description: '커밋 메시지 (필수). Git 커밋 메시지처럼 명확하고 구체적으로 작성. 예: "README에 설치 가이드 추가"',
184
- },
185
- author: {
186
- type: 'string',
187
- description: '작성자 (선택). 생략 시 현재 사용자.',
188
- },
189
- },
190
- required: ['localPath', 'message'],
191
- },
192
- },
193
- {
194
- name: 'docuking_pull',
195
- description: '서버에서 문서를 다운로드합니다. "DocuKing에서 가져와" 요청 시 사용.\n\n**킹캐스트**: Pull 후 xx_Policy/, xx_Infra_Config/ 폴더 변경이 감지되면 자동으로 .claude/rules/local/에 로컬화됩니다.',
196
- inputSchema: {
197
- type: 'object',
198
- properties: {
199
- localPath: {
200
- type: 'string',
201
- description: '로컬 프로젝트 경로',
202
- },
203
- filePath: {
204
- type: 'string',
205
- description: '풀할 파일 경로 (생략 시 전체 동기화)',
206
- },
207
- },
208
- required: ['localPath'],
209
- },
210
- },
211
- {
212
- name: 'docuking_list',
213
- description: '서버에 저장된 파일 목록을 조회합니다.',
214
- inputSchema: {
215
- type: 'object',
216
- properties: {
217
- localPath: {
218
- type: 'string',
219
- description: '로컬 프로젝트 경로 (레포 매핑에서 projectId 찾음)',
220
- },
221
- },
222
- required: ['localPath'],
223
- },
224
- },
225
- {
226
- name: 'docuking_status',
227
- description: '로컬과 서버의 동기화 상태를 확인합니다. 사용자 권한(오너/참여자), 변경/추가/삭제된 파일 목록 표시.',
228
- inputSchema: {
229
- type: 'object',
230
- properties: {
231
- localPath: {
232
- type: 'string',
233
- description: '로컬 프로젝트 경로',
234
- },
235
- },
236
- required: ['localPath'],
237
- },
238
- },
239
- {
240
- name: 'docuking_log',
241
- description: '커밋 히스토리를 조회합니다. Git log와 동일.',
242
- inputSchema: {
243
- type: 'object',
244
- properties: {
245
- localPath: {
246
- type: 'string',
247
- description: '로컬 프로젝트 경로',
248
- },
249
- path: {
250
- type: 'string',
251
- description: '특정 파일/폴더의 히스토리만 조회 (선택)',
252
- },
253
- limit: {
254
- type: 'number',
255
- description: '최근 N개 커밋만 조회 (기본값: 20)',
256
- },
257
- },
258
- required: ['localPath'],
259
- },
260
- },
261
- {
262
- name: 'docuking_diff',
263
- description: '버전 간 차이를 비교합니다.',
264
- inputSchema: {
265
- type: 'object',
266
- properties: {
267
- localPath: {
268
- type: 'string',
269
- description: '로컬 프로젝트 경로',
270
- },
271
- path: {
272
- type: 'string',
273
- description: '파일 경로',
274
- },
275
- version: {
276
- type: 'string',
277
- description: '비교할 커밋 ID (선택, 생략 시 최신 vs 이전)',
278
- },
279
- },
280
- required: ['localPath', 'path'],
281
- },
282
- },
283
- {
284
- name: 'docuking_rollback',
285
- description: '특정 커밋으로 되돌립니다.',
286
- inputSchema: {
287
- type: 'object',
288
- properties: {
289
- localPath: {
290
- type: 'string',
291
- description: '로컬 프로젝트 경로',
292
- },
293
- commitId: {
294
- type: 'string',
295
- description: '되돌릴 커밋 ID',
296
- },
297
- path: {
298
- type: 'string',
299
- description: '특정 파일만 롤백 (선택, 생략 시 전체)',
300
- },
301
- },
302
- required: ['localPath', 'commitId'],
303
- },
304
- },
305
- {
306
- name: 'docuking_talk',
307
- description: '의미 있는 대화 내용을 zz_ai_1_Talk/ 폴더에 기록합니다 (Push 대상, 킹톡). AI가 중요한 논의/결정이라고 판단하거나, 사용자가 "이거 기록해줘"라고 요청할 때 사용.',
308
- inputSchema: {
309
- type: 'object',
310
- properties: {
311
- localPath: {
312
- type: 'string',
313
- description: '로컬 프로젝트 경로',
314
- },
315
- title: {
316
- type: 'string',
317
- description: '대화록 제목 (예: "인증 방식 결정", "API 설계 논의")',
318
- },
319
- content: {
320
- type: 'string',
321
- description: '대화 내용 요약 (마크다운 형식)',
322
- },
323
- tags: {
324
- type: 'array',
325
- items: { type: 'string' },
326
- description: '태그 목록 (예: ["설계", "결정", "API"])',
327
- },
328
- },
329
- required: ['localPath', 'title', 'content'],
330
- },
331
- },
332
- {
333
- name: 'docuking_plan',
334
- description: '작업 계획 문서를 zz_ai_3_Plan/ 폴더에 생성/업데이트합니다 (Push 대상, 킹플랜). 작업 시작 시 계획을 작성하고, 진행하면서 결과를 upsert합니다.',
335
- inputSchema: {
336
- type: 'object',
337
- properties: {
338
- localPath: {
339
- type: 'string',
340
- description: '로컬 프로젝트 경로',
341
- },
342
- planId: {
343
- type: 'string',
344
- description: '계획 ID (기존 계획 업데이트 시 사용, 생략하면 새 계획 생성)',
345
- },
346
- title: {
347
- type: 'string',
348
- description: '작업 제목 (예: "MCP 활동 로깅 구현")',
349
- },
350
- goal: {
351
- type: 'string',
352
- description: '작업 목표',
353
- },
354
- steps: {
355
- type: 'array',
356
- items: {
357
- type: 'object',
358
- properties: {
359
- name: { type: 'string', description: '단계 이름' },
360
- status: { type: 'string', enum: ['pending', 'in_progress', 'done'], description: '상태' },
361
- result: { type: 'string', description: '결과 (완료 시)' },
362
- },
363
- },
364
- description: '작업 단계 목록',
365
- },
366
- notes: {
367
- type: 'string',
368
- description: '추가 노트/메모',
369
- },
370
- },
371
- required: ['localPath', 'title'],
372
- },
373
- },
374
- {
375
- name: 'docuking_done',
376
- description: '작업 계획을 완료 상태로 변경하고 최종 결과를 기록합니다.',
377
- inputSchema: {
378
- type: 'object',
379
- properties: {
380
- localPath: {
381
- type: 'string',
382
- description: '로컬 프로젝트 경로',
383
- },
384
- planId: {
385
- type: 'string',
386
- description: '완료할 계획 ID',
387
- },
388
- summary: {
389
- type: 'string',
390
- description: '작업 완료 요약',
391
- },
392
- artifacts: {
393
- type: 'array',
394
- items: { type: 'string' },
395
- description: '산출물 목록 (파일 경로, URL 등)',
396
- },
397
- },
398
- required: ['localPath', 'planId', 'summary'],
399
- },
400
- },
401
- {
402
- name: 'docuking_todo',
403
- description: `킹투두(King Todo) - 프로젝트 공식 할일을 zz_ai_2_Todo/z_King_Todo.md에 관리합니다 (Push 대상).
404
-
405
- **AI 내장 TodoWrite와 다름!** 킹투두는 웹에 동기화되고 팀과 공유됩니다.
406
-
407
- **작성 형식:**
408
- \`\`\`
409
- 1. ✅ **[태그] 키워드** 12.30/12.30
410
- 설명 (7칸 들여쓰기)
411
-
412
- 2. ⚙️ **[태그] 키워드** 12.30
413
- 설명
414
- \`\`\`
415
-
416
- **형식 규칙:**
417
- - 완료 / ⚙️ 진행중
418
- - **[태그] 키워드** 볼드 처리
419
- - 날짜 1개 = 등록일(진행중), 2개 = 등록일/완료일(완료)
420
- - 설명은 7칸 들여쓰기 ([ 기호 아래 정렬)
421
-
422
- **사용자에게 "킹투두에 등록했습니다" 형식으로 보고하세요.**`,
423
- inputSchema: {
424
- type: 'object',
425
- properties: {
426
- localPath: {
427
- type: 'string',
428
- description: '로컬 프로젝트 경로',
429
- },
430
- action: {
431
- type: 'string',
432
- enum: ['add', 'done', 'list'],
433
- description: 'add: 할일 추가, done: 완료 표시, list: 목록 조회',
434
- },
435
- todo: {
436
- type: 'string',
437
- description: '할일 내용 (add 필수). 형식: "[태그] 키워드 - 설명" 예: "[보안] API 인증 강화 - JWT 토큰 검증"',
438
- },
439
- todoId: {
440
- type: 'number',
441
- description: '할일 번호 (done 시 필수)',
442
- },
443
- },
444
- required: ['localPath', 'action'],
445
- },
446
- },
447
- {
448
- name: 'docuking_urgent',
449
- description: `긴급 보고를 xx_Urgent/ 폴더에 작성합니다 (킹어전트).
450
-
451
- **AI 필독: 다음 상황에서 자동으로 이 도구를 사용하세요:**
452
- - 정책(xx_Policy/)에 정의되지 않은 예외 상황 발견 시
453
- - 코드 작업 중 정책과 충돌하는 상황 발생 시
454
- - 정책 명확화가 필요한 애매한 상황 발생 시
455
- - 버그나 이슈 발견 시 (오너에게 보고 필요)
456
-
457
- **⚠️ 보고 작성 지침 (매우 중요):**
458
- 오너 AI가 보고를 읽고 **추가 질문 없이 바로 이해하고 조치**할 수 있어야 합니다.
459
- - situation: 구체적인 상황 설명 (어떤 파일에서, 어떤 작업 중, 무엇이 문제인지)
460
- - policyGap: 어떤 정책이 없거나 불명확한지 명확히 기술
461
- - suggestion: 구체적인 정책 추가/수정 제안 (예시 포함)
462
-
463
- **나쁜 예:** "API 응답 형식이 불명확합니다"
464
- **좋은 예:** "GET /api/users 엔드포인트 개발 중, 에러 응답 형식이 xx_Policy/03_api_convention.md에 정의되어 있지 않습니다.
465
- 현재 {error: string} 형식을 사용했으나, 다른 API들은 {code: number, message: string} 형식입니다.
466
- 제안: 03_api_convention.md에 '에러 응답 형식: {code: number, message: string, details?: any}' 추가"
467
-
468
- **xx_Urgent/ 폴더 특징:**
469
- - 유일하게 협업자도 쓰기 가능한 xx_ 폴더
470
- - 오너만 삭제 가능 (처리 완료 표시)
471
- - Push하면 오너가 Pull 자동 알림
472
-
473
- **피드백 루프:**
474
- 1. 협업자 AI: 예외 상황 발견 → docuking_urgent 호출
475
- 2. 협업자: Push
476
- 3. 오너: Pull "긴급 보고 N건 있습니다" 알림
477
- 4. 오너: 검토 후 xx_Policy/ 업데이트 → Push
478
- 5. 킹캐스트: 모든 협업자에게 정책 전파
479
- 6. 오너: xx_Urgent/ 해당 파일 삭제Push`,
480
- inputSchema: {
481
- type: 'object',
482
- properties: {
483
- localPath: {
484
- type: 'string',
485
- description: '로컬 프로젝트 경로',
486
- },
487
- title: {
488
- type: 'string',
489
- description: '보고 제목 (예: "API 응답 형식 정책 불명확", "DB 스키마 충돌 발생")',
490
- },
491
- situation: {
492
- type: 'string',
493
- description: '발생 상황 설명 (어떤 작업 중 어떤 문제가 발생했는지)',
494
- },
495
- policyGap: {
496
- type: 'string',
497
- description: '정책 공백 (어떤 정책이 없거나 불명확한지)',
498
- },
499
- suggestion: {
500
- type: 'string',
501
- description: '제안 사항 (이렇게 정책을 추가/수정하면 어떨지)',
502
- },
503
- priority: {
504
- type: 'string',
505
- enum: ['high', 'medium', 'low'],
506
- description: '우선순위 (high: 작업 중단 필요, medium: 임시 처리 후 진행, low: 참고용)',
507
- },
508
- },
509
- required: ['localPath', 'title', 'situation'],
510
- },
511
- },
512
- {
513
- name: 'docuking_validate',
514
- description: `코드가 정책을 준수하는지 검증합니다 (킹밸리데이트).
515
-
516
- **사용 시점:**
517
- - "정책 검증해줘", "킹밸리데이트", "validate" 요청 시
518
- - Pull 후 킹캐스트에서 정책 변경 감지 시 (자동 제안)
519
- - PR/커밋 코드 검증 시
520
-
521
- **검증 대상:**
522
- - .claude/rules/local/ 정책 파일 기준 (킹캐스트로 로컬화된 정책)
523
- - xx_Policy/ 정책 파일도 참조
524
- - 폴더 구조, 명명 규칙, API 규칙, DB 스키마 등
525
-
526
- **출력:**
527
- - 정책별 위반 목록
528
- - 파일:라인 위치
529
- - 수정 제안
530
-
531
- **예시:**
532
- \`\`\`
533
- [위반] 01_folder_structure.md
534
- - src/utils/helper.js:1 - utils 폴더에 직접 파일 금지 (하위 폴더로 분류 필요)
535
- - src/components/button.tsx:1 - 컴포넌트 파일명은 PascalCase 필수
536
-
537
- [위반] 05_database_schema.md
538
- - backend/src/entities/user.entity.ts:15 - createdAt 컬럼 누락
539
- \`\`\``,
540
- inputSchema: {
541
- type: 'object',
542
- properties: {
543
- localPath: {
544
- type: 'string',
545
- description: '로컬 프로젝트 경로',
546
- },
547
- policy: {
548
- type: 'string',
549
- description: '특정 정책만 검증 (예: 05_database_schema.md). 생략 시 전체 검증.',
550
- },
551
- targetPath: {
552
- type: 'string',
553
- description: '특정 파일/폴더만 검증 (예: src/components). 생략 전체.',
554
- },
555
- autoFix: {
556
- type: 'boolean',
557
- description: '자동 수정 시도 여부 (기본값: false). 안전한 수정만 자동, 위험한 수정은 제안만.',
558
- },
559
- },
560
- required: ['localPath'],
561
- },
562
- },
563
- ],
564
- };
565
- });
566
-
567
- // Resources 목록
568
- server.setRequestHandler(ListResourcesRequestSchema, async () => {
569
- return {
570
- resources: [
571
- {
572
- uri: "docuking://docs/manual",
573
- name: "DocuKing 사용 설명서",
574
- description: "AI가 DocuKing을 이해하고 사용하기 위한 기초 지식",
575
- mimeType: "text/markdown"
576
- }
577
- ]
578
- };
579
- });
580
-
581
- // Resource 읽기
582
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
583
- if (request.params.uri === "docuking://docs/manual") {
584
- const manual = `# DocuKing - AI 시대의 문서 협업 플랫폼 (AI용 매뉴얼)
585
-
586
- DocuKing은 문서 버전 관리 시스템입니다. Git이 코드를 관리하듯, DocuKing은 문서를 관리합니다.
587
-
588
- ## 핵심 개념
589
-
590
- - **로컬**: 사용자의 yy_All_Docu/ 폴더 (동기화 대상)
591
- - **웹탐색기**: DocuKing 서버의 파일 저장소 (킹폴더)
592
- - **캔버스**: 선택된 파일을 시각화하는 작업 공간
593
- - **AI 작업 폴더**: zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ (Push 대상)
594
-
595
- 작동 방식: 로컬 yy_All_Docu/ → Push → 킹폴더 → 캔버스에서 시각화
596
-
597
- ## MCP 설정과 프로젝트 연결의 차이 (매우 중요!)
598
-
599
- ### MCP 설정 (전역, 한 번만)
600
- - **목적**: MCP 서버를 AI 도구(Cursor, Claude Code 등)에 등록
601
- - **설정 파일 위치**:
602
- - Cursor: \`~/.cursor/mcp.json\` (Windows: \`%USERPROFILE%\\.cursor\\mcp.json\`)
603
- - Claude Code: \`~/.claude.json\`
604
- - 기타 VSCode 계열: 각각의 설정 파일
605
- - **설정 내용**: \`docuking\` 서버를 \`mcpServers\` 객체에 추가
606
- - **재시작 필요**: MCP 설정 파일을 처음 만들었을 때만 필요 (Cursor/Claude Code 재시작)
607
- - **중요**: 이미 다른 MCP 서버가 설정되어 있으면, 기존 설정을 덮어쓰지 말고 \`docuking\` 항목만 추가해야 함
608
-
609
- ### 프로젝트 연결 (각 폴더마다)
610
- - **목적**: 특정 로컬 폴더를 DocuKing 서버의 프로젝트 ID와 연결
611
- - **실행 방법**: \`docuking_init(projectId, localPath)\` 도구 호출
612
- - **결과**: 해당 폴더에 \`yy_All_Docu/\` 폴더 생성 및 프로젝트 매핑 저장
613
- - **재시작 불필요**: MCP가 이미 작동 중이면 바로 실행 가능
614
- - **다중 프로젝트**: 한 컴퓨터에서 여러 폴더를 각각 다른 DocuKing 프로젝트와 연결 가능
615
-
616
- **핵심 원칙:**
617
- 1. MCP 설정은 한 번만 (모든 폴더 공통)
618
- 2. 프로젝트 연결은 폴더마다 (폴더별로 다른 프로젝트 ID)
619
- 3. 이미 MCP가 작동 중이면 재시작 없이 바로 프로젝트 연결 가능
620
-
621
- ## .gitignore 설정 (중요!)
622
-
623
- DocuKing 문서 폴더는 git에서 제외해야 합니다. 코드는 git으로, 문서는 DocuKing으로 분리 관리합니다.
624
-
625
- \`\`\`gitignore
626
- # DocuKing 문서 폴더 (문서는 DocuKing으로 관리)
627
- yy_All_Docu/
628
- zz_ai_1_Talk/
629
- zz_ai_2_Todo/
630
- zz_ai_3_Plan/
631
- \`\`\`
632
-
633
- **왜 gitignore에 등록해야 하나요?**
634
- - 문서와 코드의 버전 관리를 분리
635
- - git 저장소 크기 최적화 (대용량 문서 제외)
636
- - DocuKing이 문서 버전 관리를 전담
637
-
638
- ## MCP 도구 목록
639
-
640
- ### 1. docuking_init
641
- 프로젝트를 DocuKing에 연결합니다.
642
-
643
- ### 2. docuking_push
644
- 로컬 문서를 서버에 업로드합니다. Git의 add + commit + push를 한 번에 수행.
645
- **message 파라미터 필수** (커밋 메시지)
646
-
647
- ### 3. docuking_pull
648
- 서버 문서를 로컬로 다운로드합니다.
649
- **킹캐스트**: Pull 후 xx_Policy/, xx_Infra_Config/ 폴더 변경이 감지되면 자동으로 .claude/rules/local/에 로컬화됩니다.
650
-
651
- ### 4. docuking_list
652
- 서버 파일 목록을 조회합니다.
653
-
654
- ### 5. docuking_status
655
- 로컬과 서버의 동기화 상태를 확인합니다. 사용자 권한(오너/참여자), 변경/추가/삭제된 파일 목록 표시.
656
-
657
- ### 6. docuking_log
658
- 커밋 히스토리를 조회합니다. (웹 탐색기에서 사용 가능)
659
-
660
- ### 7. docuking_diff
661
- 버전 간 차이를 비교합니다. (웹 탐색기에서 사용 가능)
662
-
663
- ### 8. docuking_rollback
664
- 특정 커밋으로 되돌립니다. (웹 탐색기에서 사용 가능)
665
-
666
- ### 9. docuking_talk
667
- 의미 있는 대화 내용을 \`zz_ai_1_Talk/\` 폴더에 기록합니다 (Push 대상, 킹톡).
668
- - AI가 중요한 논의/결정이라고 판단할
669
- - 사용자가 "이거 기록해줘"라고 요청할
670
-
671
- ### 10. docuking_plan
672
- 작업 계획을 \`zz_ai_3_Plan/\` 폴더에 생성/업데이트합니다 (Push 대상, 킹플랜).
673
- - 작업 시작 시 계획 생성
674
- - 진행하면서 단계별 결과 upsert
675
- - planId로 기존 계획 찾아서 업데이트
676
-
677
- ### 11. docuking_done
678
- 작업 계획을 완료 상태로 변경합니다.
679
- - planId로 계획 찾기
680
- - 완료 요약 및 산출물 기록
681
-
682
- ## Git과의 유사성
683
-
684
- | DocuKing | Git | 설명 |
685
- |----------|-----|------|
686
- | docuking_push | git add . && git commit -m "..." && git push | 스테이징 + 커밋 + 푸시 통합 |
687
- | docuking_pull | git pull | 서버 → 로컬 동기화 |
688
- | docuking_status | git status | 변경 사항 확인 |
689
- | docuking_log | git log | 커밋 히스토리 |
690
- | docuking_diff | git diff | 버전 비교 |
691
- | docuking_rollback | git revert | 되돌리기 |
692
-
693
- **핵심 차이점:**
694
- - Git은 3단계 (add → commit → push)
695
- - DocuKing은 1단계 (push만으로 완료, message는 필수)
696
- - 더 간단하지만 커밋 개념은 동일하게 유지
697
-
698
- ## 자연어 명령어 매핑
699
-
700
- | 사용자 말 | MCP 도구 호출 |
701
- |----------|--------------|
702
- | "프로젝트 [ID] 연결해줘" | docuking_init({ projectId, localPath }) |
703
- | "DocuKing에 올려줘" | docuking_push({ localPath, message: "..." }) |
704
- | "DocuKing에서 가져와" | docuking_pull({ localPath }) |
705
- | "DocuKing에 뭐 있어?" | docuking_list({ localPath }) |
706
-
707
- ## 협업 핵심 원칙: 남의 제사상을 건드리지 않는다
708
-
709
- DocuKing 협업의 핵심 원칙입니다. **각자 자기 영역만 수정할 수 있고, 남의 영역은 읽기만 가능합니다.**
710
-
711
- ### Push/Pull 정책 요약
712
-
713
- | 역할 | Push (올리기) | Pull (내리기) | 삭제 |
714
- |------|---------------|---------------|------|
715
- | 오너 | \`yy_All_Docu/\` + \`zz_ai_*/\` | 합집합 전체 | 자기 영역만 |
716
- | 협업자 | \`yy_Coworker_{본인}/\` (안에 zz_ai_* 포함) | 합집합 전체 | 자기 영역만 |
717
-
718
- **합집합이란?**
719
- - 서버에는 오너 파일 + 모든 협업자 파일이 합쳐져 있음
720
- - Pull하면 전체가 로컬로 내려옴
721
- - 경로만 알면 누구의 파일이든 읽고 활용 가능
722
-
723
- ## 킹캐스트 (KingCast) - 정책 자동 배포
724
-
725
- 오너가 \`xx_Policy/\` 폴더에 정책을 작성하고 Push하면,
726
- 협업자가 Pull할 때 자동으로 \`.claude/rules/local/\`에 서브파일 구조로 로컬화됩니다.
727
-
728
- ### 킹캐스트 동작 원리
729
- \`\`\`
730
- 오너가 정책 작성 Push 협업자 Pull → 킹캐스트 자동 실행 → AI 행동 변화
731
- \`\`\`
732
-
733
- ### 킹캐스트 대상 폴더
734
- - \`xx_Infra_Config/\` - 환경 설정 (.env 백업, 배포 정보 등) → 변경 감지만 (복사X)
735
- - \`xx_Policy/\` - AI 행동 지침 → .claude/rules/local/에 복사
736
-
737
- ### 정책 파일 작성 템플릿 (오너용)
738
- \`\`\`
739
- xx_Policy/
740
- ├── 00_project_overview.md # 프로젝트 개요
741
- ├── 01_folder_structure.md # 폴더 구조
742
- ├── 02_api_convention.md # API 규칙
743
- ├── 03_design_policy.md # 디자인 정책
744
- ├── 99_for_claude.md # AI 특화 지침
745
- \`\`\`
746
-
747
- ### Pull 생성되는 파일
748
- - \`.claude/rules/local/00_index.md\` - 정책 인덱스
749
- - \`.claude/rules/local/00_project_overview.md\` - 정책 사본 (변수 치환됨)
750
- - \`.claude/rules/local/_coworker_config.md\` - 협업자 설정 (협업자만)
751
-
752
- ### 킹캐스트 결과 처리
753
- Pull 결과에 "📢 킹캐스트" 포함 시:
754
- 1. \`.claude/rules/local/00_index.md\` 읽고 정책 목록 확인
755
- 2. 정책 파일 **읽어서** 내용 숙지, 규칙 따라 작업
756
- 3. **xx_Infra_Config 변경 시**: 원본 경로에서 직접 읽고 로컬 환경에 맞게 적용
757
- - 예: .env 변수 추가/수정, 배포 설정 확인
758
-
759
- 탐색기: https://docuking.ai
760
- `;
761
-
762
- return {
763
- contents: [{
764
- uri: "docuking://docs/manual",
765
- mimeType: "text/markdown",
766
- text: manual
767
- }]
768
- };
769
- }
770
-
771
- throw new Error("Unknown resource");
772
- });
773
-
774
- // 도구 실행
775
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
776
- const { name, arguments: args } = request.params;
777
-
778
- try {
779
- switch (name) {
780
- case 'docuking_init':
781
- return await handleInit(args);
782
- case 'docuking_push':
783
- return await handlePush(args);
784
- case 'docuking_pull':
785
- return await handlePull(args);
786
- case 'docuking_list':
787
- return await handleList(args);
788
- case 'docuking_status':
789
- return await handleStatus(args);
790
- case 'docuking_log':
791
- return await handleLog(args);
792
- case 'docuking_diff':
793
- return await handleDiff(args);
794
- case 'docuking_rollback':
795
- return await handleRollback(args);
796
- case 'docuking_talk':
797
- return await handleTalk(args);
798
- case 'docuking_plan':
799
- return await handlePlan(args);
800
- case 'docuking_done':
801
- return await handleDone(args);
802
- case 'docuking_todo':
803
- return await handleTodo(args);
804
- case 'docuking_urgent':
805
- return await handleUrgent(args);
806
- case 'docuking_validate':
807
- return await handleValidate(args);
808
- default:
809
- throw new Error(`Unknown tool: ${name}`);
810
- }
811
- } catch (error) {
812
- return {
813
- content: [
814
- {
815
- type: 'text',
816
- text: `오류: ${error.message}`,
817
- },
818
- ],
819
- };
820
- }
821
- });
822
-
823
- // 서버 시작
824
- async function main() {
825
- const transport = new StdioServerTransport();
826
- await server.connect(transport);
827
- console.error('[DocuKing MCP] 서버 시작됨');
828
- }
829
-
830
- main().catch(console.error);
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * DocuKing MCP Server v2.0
5
+ *
6
+ * AI 시대의 문서 협업 플랫폼 - AI가 문서를 Push/Pull 할 수 있게 해주는 MCP 서버
7
+ *
8
+ * 폴더 구조:
9
+ * - xx_Infra_Config/ : 시스템 설정 (.env 백업, 배포 정보 등) - Push 대상
10
+ * - xx_Policy/ : 정책 문서 (AI 행동 지침) - Push 대상, 킹캐스트 대상
11
+ * - yy_All_Docu/ : 문서 동기화 폴더 (Push/Pull 대상)
12
+ * - yy_All_Docu/_Private/ : 오너 비공개 폴더 (오너만 접근)
13
+ * - yy_Coworker_{폴더명}/ : 협업자 폴더 (yy_All_Docu와 별도, 동기화 대상)
14
+ * - zz_ai_1_Talk/ : AI 대화록 (킹톡, Push 대상)
15
+ * - zz_ai_2_Todo/ : AI 투두 (킹투두, Push 대상)
16
+ * - zz_ai_3_Plan/ : AI 플랜 (킹플랜, Push 대상)
17
+ *
18
+ * 접두사 규칙:
19
+ * - xx_ : 시스템용 폴더 (인프라, 정책) - Push 대상
20
+ * - yy_ : 사람용 폴더 (문서, 협업자) - Push 대상
21
+ * - zz_ai_ : AI용 폴더 (Talk, Todo, Plan) - Push 대상
22
+ * - _ : 비공개 폴더 (본인만 접근)
23
+ *
24
+ * 도구:
25
+ * - docuking_init: 레포 연결, yy_All_Docu/ 폴더 생성
26
+ * - docuking_push: 로컬 → 서버 (.env 자동 백업)
27
+ * - docuking_pull: 서버 → 로컬
28
+ */
29
+
30
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
31
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
32
+ import {
33
+ CallToolRequestSchema,
34
+ ListToolsRequestSchema,
35
+ ListResourcesRequestSchema,
36
+ ReadResourceRequestSchema,
37
+ } from '@modelcontextprotocol/sdk/types.js';
38
+
39
+ // 핸들러 import
40
+ import {
41
+ handleInit,
42
+ handlePush,
43
+ handlePull,
44
+ handleList,
45
+ handleStatus,
46
+ handleDelete,
47
+ } from './handlers/sync.js';
48
+
49
+ import {
50
+ handleLog,
51
+ handleDiff,
52
+ handleRollback,
53
+ } from './handlers/version.js';
54
+
55
+ import {
56
+ handleTodo,
57
+ handleTalk,
58
+ handlePlan,
59
+ handleDone,
60
+ handleUrgent,
61
+ } from './handlers/docs.js';
62
+
63
+ import { handleValidate } from './handlers/validate.js';
64
+
65
+ // MCP 서버 생성
66
+ const server = new Server(
67
+ {
68
+ name: 'docuking-mcp',
69
+ version: '1.0.0',
70
+ },
71
+ {
72
+ capabilities: {
73
+ tools: {},
74
+ resources: {},
75
+ },
76
+ }
77
+ );
78
+
79
+ // 도구 목록
80
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
81
+ return {
82
+ tools: [
83
+ {
84
+ name: 'docuking_init',
85
+ description: `프로젝트를 DocuKing에 연결합니다. .docuking/config.json에 설정 저장, yy_All_Docu/ 폴더 생성.
86
+
87
+ **필수 파라미터:**
88
+ - projectId: 프로젝트 UUID
89
+ - projectName: 프로젝트 이름 (표시용)
90
+ - apiKey: API (sk_xxx 형식)
91
+ - localPath: 로컬 프로젝트 경로
92
+
93
+ **오너 초기화 시:**
94
+ - xx_Infra_Config/, xx_Policy/, xx_Urgent/ 폴더 생성 (시스템 설정)
95
+ - yy_All_Docu/, yy_All_Docu/_Private/ 폴더 생성
96
+ - zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ 폴더 생성
97
+ - CLAUDE.md에 DocuKing 연결 안내 추가
98
+ - 초기화 완료 후 정책 문서 작성 가이드 제공
99
+
100
+ **협업자 초기화 시:**
101
+ - yy_Coworker_{폴더명}/ 폴더 생성 (안에 _Private/, zz_ai_*/ 포함)
102
+ - CLAUDE.md에 DocuKing 연결 안내 추가
103
+ - "Pull을 실행하세요" 안내 (오너 정책이 킹캐스트로 로컬화됨)
104
+
105
+ **정책 문서 템플릿 (오너용, xx_Policy/ 폴더에 작성):**
106
+
107
+ [필수]
108
+ - 00_project_overview.md - 프로젝트 개요, 기술 스택, 팀 구성, 주요 URL
109
+
110
+ [구조/규칙]
111
+ - 01_folder_structure.md - 폴더 구조 규칙, 파일 명명 규칙
112
+ - 02_naming_convention.md - 변수/함수/클래스 명명 규칙
113
+ - 03_api_convention.md - API 엔드포인트 규칙, 요청/응답 형식, 에러 코드
114
+
115
+ [데이터베이스]
116
+ - 05_database_schema.md - 테이블/컬럼 명명, 타입 규칙, 필수 컬럼(id, createdAt 등)
117
+ - 06_database_migration.md - 마이그레이션 절차, 브랜치별 스키마 관리, 충돌 해결법
118
+
119
+ [개발 정책]
120
+ - 10_coding_style.md - 코딩 스타일, 린터 설정, 포매터 규칙
121
+ - 11_git_workflow.md - 브랜치 전략, 커밋 메시지 규칙, PR 규칙
122
+ - 12_testing_policy.md - 테스트 작성 규칙, 커버리지 기준
123
+ - 13_error_handling.md - 에러 처리 패턴, 로깅 규칙
124
+
125
+ [디자인/UI]
126
+ - 20_design_system.md - 디자인 시스템, 컬러, 타이포그래피
127
+ - 21_component_guide.md - 컴포넌트 작성 규칙, 스타일링 방식
128
+
129
+ [인프라/보안]
130
+ - 30_deployment.md - 배포 절차, 환경별 설정
131
+ - 31_security_policy.md - 보안 규칙, 인증/인가, 민감정보 처리
132
+
133
+ [AI 전용]
134
+ - 99_for_claude.md - Claude Code 행동 지침, 금지/필수 사항
135
+
136
+ init 완료 후 오너에게 "정책 문서를 작성하시겠습니까?" 제안할 것.`,
137
+ inputSchema: {
138
+ type: 'object',
139
+ properties: {
140
+ projectId: {
141
+ type: 'string',
142
+ description: 'DocuKing 프로젝트 ID',
143
+ },
144
+ projectName: {
145
+ type: 'string',
146
+ description: 'DocuKing 프로젝트 이름 (표시용)',
147
+ },
148
+ apiKey: {
149
+ type: 'string',
150
+ description: 'API 키 (sk_xxx 형식)',
151
+ },
152
+ localPath: {
153
+ type: 'string',
154
+ description: '로컬 프로젝트 경로 (예: /Users/user/my-project)',
155
+ },
156
+ },
157
+ required: ['projectId', 'projectName', 'apiKey', 'localPath'],
158
+ },
159
+ },
160
+ {
161
+ name: 'docuking_push',
162
+ description: `문서를 DocuKing 서버에 동기화합니다. 내부적으로 Pull → Push 순서로 실행 (git pull && git push 패턴).
163
+
164
+ **AI 필독: 다음 상황에서 자발적으로 도구 사용을 제안하세요:**
165
+ - zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ 에 문서를 생성/수정한 후
166
+ - yy_All_Docu/ 문서를 생성/수정한
167
+ - docuking_plan, docuking_done, docuking_talk, docuking_todo 실행
168
+ - 사용자가 "올려", "푸시", "동기화" 등을 언급할 때
169
+
170
+ 제안 예시: "킹폴더에 문서가 생성되었습니다. DocuKing에 올릴까요?"`,
171
+ inputSchema: {
172
+ type: 'object',
173
+ properties: {
174
+ localPath: {
175
+ type: 'string',
176
+ description: '로컬 프로젝트 경로 (레포 매핑에서 projectId 찾음)',
177
+ },
178
+ filePath: {
179
+ type: 'string',
180
+ description: '푸시할 파일 경로 (Z_DocuKing/ 기준 상대경로). 생략 시 전체 동기화.',
181
+ },
182
+ message: {
183
+ type: 'string',
184
+ description: '커밋 메시지 (필수). Git 커밋 메시지처럼 명확하고 구체적으로 작성. 예: "README에 설치 가이드 추가"',
185
+ },
186
+ author: {
187
+ type: 'string',
188
+ description: '작성자 (선택). 생략 시 현재 사용자.',
189
+ },
190
+ },
191
+ required: ['localPath', 'message'],
192
+ },
193
+ },
194
+ {
195
+ name: 'docuking_pull',
196
+ description: `서버에서 문서를 다운로드합니다. "DocuKing에서 가져와" 요청 시 사용.
197
+
198
+ **킹캐스트 포함**: Pull 후 xx_Policy/, xx_Infra_Config/ 폴더 변경이 감지되면 자동으로 .claude/rules/local/에 로컬화됩니다. 오너가 정책을 수정하고 Push하면, 협업자가 Pull할 때 자동으로 정책이 전파됩니다.
199
+
200
+ **긴급 보고 알림**: Pull 후 xx_Urgent/ 폴더에 파일이 있으면 "긴급 보고 N건 있습니다" 알림을 표시합니다.`,
201
+ inputSchema: {
202
+ type: 'object',
203
+ properties: {
204
+ localPath: {
205
+ type: 'string',
206
+ description: '로컬 프로젝트 경로',
207
+ },
208
+ filePath: {
209
+ type: 'string',
210
+ description: '풀할 파일 경로 (생략 시 전체 동기화)',
211
+ },
212
+ },
213
+ required: ['localPath'],
214
+ },
215
+ },
216
+ {
217
+ name: 'docuking_list',
218
+ description: '서버에 저장된 파일 목록을 조회합니다.',
219
+ inputSchema: {
220
+ type: 'object',
221
+ properties: {
222
+ localPath: {
223
+ type: 'string',
224
+ description: '로컬 프로젝트 경로 (레포 매핑에서 projectId 찾음)',
225
+ },
226
+ },
227
+ required: ['localPath'],
228
+ },
229
+ },
230
+ {
231
+ name: 'docuking_status',
232
+ description: '로컬과 서버의 동기화 상태를 확인합니다. 사용자 권한(오너/참여자), 변경/추가/삭제된 파일 목록 표시.',
233
+ inputSchema: {
234
+ type: 'object',
235
+ properties: {
236
+ localPath: {
237
+ type: 'string',
238
+ description: '로컬 프로젝트 경로',
239
+ },
240
+ },
241
+ required: ['localPath'],
242
+ },
243
+ },
244
+ {
245
+ name: 'docuking_log',
246
+ description: '커밋 히스토리를 조회합니다. Git log와 동일.',
247
+ inputSchema: {
248
+ type: 'object',
249
+ properties: {
250
+ localPath: {
251
+ type: 'string',
252
+ description: '로컬 프로젝트 경로',
253
+ },
254
+ path: {
255
+ type: 'string',
256
+ description: '특정 파일/폴더의 히스토리만 조회 (선택)',
257
+ },
258
+ limit: {
259
+ type: 'number',
260
+ description: '최근 N개 커밋만 조회 (기본값: 20)',
261
+ },
262
+ },
263
+ required: ['localPath'],
264
+ },
265
+ },
266
+ {
267
+ name: 'docuking_diff',
268
+ description: '버전 간 차이를 비교합니다.',
269
+ inputSchema: {
270
+ type: 'object',
271
+ properties: {
272
+ localPath: {
273
+ type: 'string',
274
+ description: '로컬 프로젝트 경로',
275
+ },
276
+ path: {
277
+ type: 'string',
278
+ description: '파일 경로',
279
+ },
280
+ version: {
281
+ type: 'string',
282
+ description: '비교할 커밋 ID (선택, 생략 시 최신 vs 이전)',
283
+ },
284
+ },
285
+ required: ['localPath', 'path'],
286
+ },
287
+ },
288
+ {
289
+ name: 'docuking_rollback',
290
+ description: '특정 커밋으로 되돌립니다.',
291
+ inputSchema: {
292
+ type: 'object',
293
+ properties: {
294
+ localPath: {
295
+ type: 'string',
296
+ description: '로컬 프로젝트 경로',
297
+ },
298
+ commitId: {
299
+ type: 'string',
300
+ description: '되돌릴 커밋 ID',
301
+ },
302
+ path: {
303
+ type: 'string',
304
+ description: '특정 파일만 롤백 (선택, 생략 시 전체)',
305
+ },
306
+ },
307
+ required: ['localPath', 'commitId'],
308
+ },
309
+ },
310
+ {
311
+ name: 'docuking_talk',
312
+ description: '의미 있는 대화 내용을 zz_ai_1_Talk/ 폴더에 기록합니다 (Push 대상, 킹톡). AI가 중요한 논의/결정이라고 판단하거나, 사용자가 "이거 기록해줘"라고 요청할 때 사용.',
313
+ inputSchema: {
314
+ type: 'object',
315
+ properties: {
316
+ localPath: {
317
+ type: 'string',
318
+ description: '로컬 프로젝트 경로',
319
+ },
320
+ title: {
321
+ type: 'string',
322
+ description: '대화록 제목 (예: "인증 방식 결정", "API 설계 논의")',
323
+ },
324
+ content: {
325
+ type: 'string',
326
+ description: '대화 내용 요약 (마크다운 형식)',
327
+ },
328
+ tags: {
329
+ type: 'array',
330
+ items: { type: 'string' },
331
+ description: '태그 목록 (예: ["설계", "결정", "API"])',
332
+ },
333
+ },
334
+ required: ['localPath', 'title', 'content'],
335
+ },
336
+ },
337
+ {
338
+ name: 'docuking_plan',
339
+ description: '작업 계획 문서를 zz_ai_3_Plan/ 폴더에 생성/업데이트합니다 (Push 대상, 킹플랜). 작업 시작 시 계획을 작성하고, 진행하면서 결과를 upsert합니다.',
340
+ inputSchema: {
341
+ type: 'object',
342
+ properties: {
343
+ localPath: {
344
+ type: 'string',
345
+ description: '로컬 프로젝트 경로',
346
+ },
347
+ planId: {
348
+ type: 'string',
349
+ description: '계획 ID (기존 계획 업데이트 시 사용, 생략하면 새 계획 생성)',
350
+ },
351
+ title: {
352
+ type: 'string',
353
+ description: '작업 제목 (예: "MCP 활동 로깅 구현")',
354
+ },
355
+ goal: {
356
+ type: 'string',
357
+ description: '작업 목표',
358
+ },
359
+ steps: {
360
+ type: 'array',
361
+ items: {
362
+ type: 'object',
363
+ properties: {
364
+ name: { type: 'string', description: '단계 이름' },
365
+ status: { type: 'string', enum: ['pending', 'in_progress', 'done'], description: '상태' },
366
+ result: { type: 'string', description: '결과 (완료 시)' },
367
+ },
368
+ },
369
+ description: '작업 단계 목록',
370
+ },
371
+ notes: {
372
+ type: 'string',
373
+ description: '추가 노트/메모',
374
+ },
375
+ },
376
+ required: ['localPath', 'title'],
377
+ },
378
+ },
379
+ {
380
+ name: 'docuking_done',
381
+ description: '작업 계획을 완료 상태로 변경하고 최종 결과를 기록합니다.',
382
+ inputSchema: {
383
+ type: 'object',
384
+ properties: {
385
+ localPath: {
386
+ type: 'string',
387
+ description: '로컬 프로젝트 경로',
388
+ },
389
+ planId: {
390
+ type: 'string',
391
+ description: '완료할 계획 ID',
392
+ },
393
+ summary: {
394
+ type: 'string',
395
+ description: '작업 완료 요약',
396
+ },
397
+ artifacts: {
398
+ type: 'array',
399
+ items: { type: 'string' },
400
+ description: '산출물 목록 (파일 경로, URL 등)',
401
+ },
402
+ },
403
+ required: ['localPath', 'planId', 'summary'],
404
+ },
405
+ },
406
+ {
407
+ name: 'docuking_todo',
408
+ description: `킹투두(King Todo) - 프로젝트 공식 할일을 zz_ai_2_Todo/z_King_Todo.md에 관리합니다 (Push 대상).
409
+
410
+ **AI 내장 TodoWrite와 다름!** 킹투두는 웹에 동기화되고 팀과 공유됩니다.
411
+
412
+ **작성 형식:**
413
+ \`\`\`
414
+ 1. ✅ **[태그] 키워드** 12.30/12.30
415
+ 설명 (7칸 들여쓰기)
416
+
417
+ 2. ⚙️ **[태그] 키워드** 12.30
418
+ 설명
419
+ \`\`\`
420
+
421
+ **형식 규칙:**
422
+ - 완료 / ⚙️ 진행중
423
+ - **[태그] 키워드** 볼드 처리
424
+ - 날짜 1개 = 등록일(진행중), 2개 = 등록일/완료일(완료)
425
+ - 설명은 7칸 들여쓰기 ([ 기호 아래 정렬)
426
+
427
+ **사용자에게 "킹투두에 등록했습니다" 형식으로 보고하세요.**`,
428
+ inputSchema: {
429
+ type: 'object',
430
+ properties: {
431
+ localPath: {
432
+ type: 'string',
433
+ description: '로컬 프로젝트 경로',
434
+ },
435
+ action: {
436
+ type: 'string',
437
+ enum: ['add', 'done', 'list'],
438
+ description: 'add: 할일 추가, done: 완료 표시, list: 목록 조회',
439
+ },
440
+ todo: {
441
+ type: 'string',
442
+ description: '할일 내용 (add 시 필수). 형식: "[태그] 키워드 - 설명" 예: "[보안] API 인증 강화 - JWT 토큰 검증"',
443
+ },
444
+ todoId: {
445
+ type: 'number',
446
+ description: '할일 번호 (done 시 필수)',
447
+ },
448
+ },
449
+ required: ['localPath', 'action'],
450
+ },
451
+ },
452
+ {
453
+ name: 'docuking_urgent',
454
+ description: `긴급 보고를 xx_Urgent/ 폴더에 작성합니다 (킹어전트).
455
+
456
+ **AI 필독: 다음 상황에서 자동으로 이 도구를 사용하세요:**
457
+ - 정책(xx_Policy/)에 정의되지 않은 예외 상황 발견 시
458
+ - 코드 작업 정책과 충돌하는 상황 발생
459
+ - 정책 명확화가 필요한 애매한 상황 발생
460
+ - 버그나 이슈 발견 (오너에게 보고 필요)
461
+
462
+ **⚠️ 보고 작성 지침 (매우 중요):**
463
+ 오너 AI가 보고를 읽고 **추가 질문 없이 바로 이해하고 조치**할 수 있어야 합니다.
464
+ - situation: 구체적인 상황 설명 (어떤 파일에서, 어떤 작업 중, 무엇이 문제인지)
465
+ - policyGap: 어떤 정책이 없거나 불명확한지 명확히 기술
466
+ - suggestion: 구체적인 정책 추가/수정 제안 (예시 포함)
467
+
468
+ **나쁜 예:** "API 응답 형식이 불명확합니다"
469
+ **좋은 예:** "GET /api/users 엔드포인트 개발 중, 에러 응답 형식이 xx_Policy/03_api_convention.md에 정의되어 있지 않습니다.
470
+ 현재 {error: string} 형식을 사용했으나, 다른 API들은 {code: number, message: string} 형식입니다.
471
+ 제안: 03_api_convention.md에 '에러 응답 형식: {code: number, message: string, details?: any}' 추가"
472
+
473
+ **xx_Urgent/ 폴더 특징:**
474
+ - 유일하게 협업자도 쓰기 가능한 xx_ 폴더
475
+ - 오너만 삭제 가능 (처리 완료 표시)
476
+ - Push하면 오너가 Pull 자동 알림
477
+
478
+ **피드백 루프:**
479
+ 1. 협업자 AI: 예외 상황 발견docuking_urgent 호출
480
+ 2. 협업자: Push
481
+ 3. 오너: Pull → "긴급 보고 N건 있습니다" 알림
482
+ 4. 오너: 검토 후 xx_Policy/ 업데이트 → Push
483
+ 5. 킹캐스트: 모든 협업자에게 정책 전파
484
+ 6. 오너: xx_Urgent/ 해당 파일 삭제 → Push`,
485
+ inputSchema: {
486
+ type: 'object',
487
+ properties: {
488
+ localPath: {
489
+ type: 'string',
490
+ description: '로컬 프로젝트 경로',
491
+ },
492
+ title: {
493
+ type: 'string',
494
+ description: '보고 제목 (예: "API 응답 형식 정책 불명확", "DB 스키마 충돌 발생")',
495
+ },
496
+ situation: {
497
+ type: 'string',
498
+ description: '발생 상황 설명 (어떤 작업 중 어떤 문제가 발생했는지)',
499
+ },
500
+ policyGap: {
501
+ type: 'string',
502
+ description: '정책 공백 (어떤 정책이 없거나 불명확한지)',
503
+ },
504
+ suggestion: {
505
+ type: 'string',
506
+ description: '제안 사항 (이렇게 정책을 추가/수정하면 어떨지)',
507
+ },
508
+ priority: {
509
+ type: 'string',
510
+ enum: ['high', 'medium', 'low'],
511
+ description: '우선순위 (high: 작업 중단 필요, medium: 임시 처리 후 진행, low: 참고용)',
512
+ },
513
+ },
514
+ required: ['localPath', 'title', 'situation'],
515
+ },
516
+ },
517
+ {
518
+ name: 'docuking_delete',
519
+ description: `서버에서 파일/폴더를 직접 삭제합니다.
520
+
521
+ **사용 시점:**
522
+ - 로컬에서 삭제한 파일이 Push 후에도 서버에 남아있을
523
+ - 서버에만 존재하는 불필요한 파일을 정리할 때
524
+ - "서버에서 삭제해줘", "킹폴더에서 지워줘" 요청
525
+
526
+ **권한:**
527
+ - 오너: xx_*/, yy_All_Docu/, zz_ai_*/ 삭제 가능
528
+ - 협업자: yy_Coworker_{본인}/ 내부만 삭제 가능
529
+
530
+ **주의:** 삭제는 soft-delete로 처리되며, 3일 후 완전 삭제됩니다.`,
531
+ inputSchema: {
532
+ type: 'object',
533
+ properties: {
534
+ localPath: {
535
+ type: 'string',
536
+ description: '로컬 프로젝트 경로 (설정 파일에서 projectId 찾음)',
537
+ },
538
+ path: {
539
+ type: 'string',
540
+ description: '삭제할 파일/폴더 경로 (서버 기준). 예: "yy_All_Docu/old_file.md"',
541
+ },
542
+ },
543
+ required: ['localPath', 'path'],
544
+ },
545
+ },
546
+ {
547
+ name: 'docuking_validate',
548
+ description: `코드가 정책을 준수하는지 검증합니다 (킹밸리데이트).
549
+
550
+ **사용 시점:**
551
+ - "정책 검증해줘", "킹밸리데이트", "validate" 요청 시
552
+ - Pull 후 킹캐스트에서 정책 변경 감지 시 (자동 제안)
553
+ - PR/커밋 코드 검증 시
554
+
555
+ **검증 대상:**
556
+ - .claude/rules/local/ 의 정책 파일 기준 (킹캐스트로 로컬화된 정책)
557
+ - xx_Policy/ 정책 파일도 참조
558
+ - 폴더 구조, 명명 규칙, API 규칙, DB 스키마 등
559
+
560
+ **출력:**
561
+ - 정책별 위반 목록
562
+ - 파일:라인 위치
563
+ - 수정 제안
564
+
565
+ **예시:**
566
+ \`\`\`
567
+ [위반] 01_folder_structure.md
568
+ - src/utils/helper.js:1 - utils 폴더에 직접 파일 금지 (하위 폴더로 분류 필요)
569
+ - src/components/button.tsx:1 - 컴포넌트 파일명은 PascalCase 필수
570
+
571
+ [위반] 05_database_schema.md
572
+ - backend/src/entities/user.entity.ts:15 - createdAt 컬럼 누락
573
+ \`\`\``,
574
+ inputSchema: {
575
+ type: 'object',
576
+ properties: {
577
+ localPath: {
578
+ type: 'string',
579
+ description: '로컬 프로젝트 경로',
580
+ },
581
+ policy: {
582
+ type: 'string',
583
+ description: '특정 정책만 검증 (예: 05_database_schema.md). 생략 전체 검증.',
584
+ },
585
+ targetPath: {
586
+ type: 'string',
587
+ description: '특정 파일/폴더만 검증 (예: src/components). 생략 시 전체.',
588
+ },
589
+ autoFix: {
590
+ type: 'boolean',
591
+ description: '자동 수정 시도 여부 (기본값: false). 안전한 수정만 자동, 위험한 수정은 제안만.',
592
+ },
593
+ },
594
+ required: ['localPath'],
595
+ },
596
+ },
597
+ ],
598
+ };
599
+ });
600
+
601
+ // Resources 목록
602
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
603
+ return {
604
+ resources: [
605
+ {
606
+ uri: "docuking://docs/manual",
607
+ name: "DocuKing 사용 설명서",
608
+ description: "AI가 DocuKing을 이해하고 사용하기 위한 기초 지식",
609
+ mimeType: "text/markdown"
610
+ }
611
+ ]
612
+ };
613
+ });
614
+
615
+ // Resource 읽기
616
+ server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
617
+ if (request.params.uri === "docuking://docs/manual") {
618
+ const manual = `# DocuKing - AI 시대의 문서 협업 플랫폼 (AI용 매뉴얼)
619
+
620
+ DocuKing은 문서 버전 관리 시스템입니다. Git이 코드를 관리하듯, DocuKing은 문서를 관리합니다.
621
+
622
+ ## 핵심 개념
623
+
624
+ - **로컬**: 사용자의 yy_All_Docu/ 폴더 (동기화 대상)
625
+ - **웹탐색기**: DocuKing 서버의 파일 저장소 (킹폴더)
626
+ - **캔버스**: 선택된 파일을 시각화하는 작업 공간
627
+ - **AI 작업 폴더**: zz_ai_1_Talk/, zz_ai_2_Todo/, zz_ai_3_Plan/ (Push 대상)
628
+
629
+ 작동 방식: 로컬 yy_All_Docu/ → Push → 킹폴더 → 캔버스에서 시각화
630
+
631
+ ## MCP 설정과 프로젝트 연결의 차이 (매우 중요!)
632
+
633
+ ### MCP 설정 (전역, 한 번만)
634
+ - **목적**: MCP 서버를 AI 도구(Cursor, Claude Code 등)에 등록
635
+ - **설정 파일 위치**:
636
+ - Cursor: \`~/.cursor/mcp.json\` (Windows: \`%USERPROFILE%\\.cursor\\mcp.json\`)
637
+ - Claude Code: \`~/.claude.json\`
638
+ - 기타 VSCode 계열: 각각의 설정 파일
639
+ - **설정 내용**: \`docuking\` 서버를 \`mcpServers\` 객체에 추가
640
+ - **재시작 필요**: MCP 설정 파일을 처음 만들었을 때만 필요 (Cursor/Claude Code 재시작)
641
+ - **중요**: 이미 다른 MCP 서버가 설정되어 있으면, 기존 설정을 덮어쓰지 말고 \`docuking\` 항목만 추가해야 함
642
+
643
+ ### 프로젝트 연결 (각 폴더마다)
644
+ - **목적**: 특정 로컬 폴더를 DocuKing 서버의 프로젝트 ID와 연결
645
+ - **실행 방법**: \`docuking_init(projectId, localPath)\` 도구 호출
646
+ - **결과**: 해당 폴더에 \`yy_All_Docu/\` 폴더 생성 및 프로젝트 매핑 저장
647
+ - **재시작 불필요**: MCP가 이미 작동 중이면 바로 실행 가능
648
+ - **다중 프로젝트**: 한 컴퓨터에서 여러 폴더를 각각 다른 DocuKing 프로젝트와 연결 가능
649
+
650
+ **핵심 원칙:**
651
+ 1. MCP 설정은 한 번만 (모든 폴더 공통)
652
+ 2. 프로젝트 연결은 각 폴더마다 (폴더별로 다른 프로젝트 ID)
653
+ 3. 이미 MCP가 작동 중이면 재시작 없이 바로 프로젝트 연결 가능
654
+
655
+ ## .gitignore 설정 (중요!)
656
+
657
+ DocuKing 문서 폴더는 git에서 제외해야 합니다. 코드는 git으로, 문서는 DocuKing으로 분리 관리합니다.
658
+
659
+ \`\`\`gitignore
660
+ # DocuKing 문서 폴더 (문서는 DocuKing으로 관리)
661
+ yy_All_Docu/
662
+ zz_ai_1_Talk/
663
+ zz_ai_2_Todo/
664
+ zz_ai_3_Plan/
665
+ \`\`\`
666
+
667
+ **왜 gitignore에 등록해야 하나요?**
668
+ - 문서와 코드의 버전 관리를 분리
669
+ - git 저장소 크기 최적화 (대용량 문서 제외)
670
+ - DocuKing이 문서 버전 관리를 전담
671
+
672
+ ## MCP 도구 목록
673
+
674
+ ### 1. docuking_init
675
+ 프로젝트를 DocuKing에 연결합니다.
676
+
677
+ ### 2. docuking_push
678
+ 로컬 문서를 서버에 업로드합니다. Git의 add + commit + push를 한 번에 수행.
679
+ **message 파라미터 필수** (커밋 메시지)
680
+
681
+ ### 3. docuking_pull
682
+ 서버 문서를 로컬로 다운로드합니다.
683
+ **킹캐스트**: Pull 후 xx_Policy/, xx_Infra_Config/ 폴더 변경이 감지되면 자동으로 .claude/rules/local/에 로컬화됩니다.
684
+
685
+ ### 4. docuking_list
686
+ 서버 파일 목록을 조회합니다.
687
+
688
+ ### 5. docuking_status
689
+ 로컬과 서버의 동기화 상태를 확인합니다. 사용자 권한(오너/참여자), 변경/추가/삭제된 파일 목록 표시.
690
+
691
+ ### 6. docuking_log
692
+ 커밋 히스토리를 조회합니다. (웹 탐색기에서 사용 가능)
693
+
694
+ ### 7. docuking_diff
695
+ 버전 차이를 비교합니다. ( 탐색기에서 사용 가능)
696
+
697
+ ### 8. docuking_rollback
698
+ 특정 커밋으로 되돌립니다. (웹 탐색기에서 사용 가능)
699
+
700
+ ### 9. docuking_talk
701
+ 의미 있는 대화 내용을 \`zz_ai_1_Talk/\` 폴더에 기록합니다 (Push 대상, 킹톡).
702
+ - AI가 중요한 논의/결정이라고 판단할
703
+ - 사용자가 "이거 기록해줘"라고 요청할
704
+
705
+ ### 10. docuking_plan
706
+ 작업 계획을 \`zz_ai_3_Plan/\` 폴더에 생성/업데이트합니다 (Push 대상, 킹플랜).
707
+ - 작업 시작 계획 생성
708
+ - 진행하면서 단계별 결과 upsert
709
+ - planId로 기존 계획 찾아서 업데이트
710
+
711
+ ### 11. docuking_done
712
+ 작업 계획을 완료 상태로 변경합니다.
713
+ - planId로 계획 찾기
714
+ - 완료 요약 및 산출물 기록
715
+
716
+ ## Git과의 유사성
717
+
718
+ | DocuKing | Git | 설명 |
719
+ |----------|-----|------|
720
+ | docuking_push | git add . && git commit -m "..." && git push | 스테이징 + 커밋 + 푸시 통합 |
721
+ | docuking_pull | git pull | 서버 → 로컬 동기화 |
722
+ | docuking_status | git status | 변경 사항 확인 |
723
+ | docuking_log | git log | 커밋 히스토리 |
724
+ | docuking_diff | git diff | 버전 비교 |
725
+ | docuking_rollback | git revert | 되돌리기 |
726
+
727
+ **핵심 차이점:**
728
+ - Git은 3단계 (add → commit → push)
729
+ - DocuKing은 1단계 (push만으로 완료, 단 message는 필수)
730
+ - 간단하지만 커밋 개념은 동일하게 유지
731
+
732
+ ## 자연어 명령어 매핑
733
+
734
+ | 사용자 | MCP 도구 호출 |
735
+ |----------|--------------|
736
+ | "프로젝트 [ID] 연결해줘" | docuking_init({ projectId, localPath }) |
737
+ | "DocuKing에 올려줘" | docuking_push({ localPath, message: "..." }) |
738
+ | "DocuKing에서 가져와" | docuking_pull({ localPath }) |
739
+ | "DocuKing에 뭐 있어?" | docuking_list({ localPath }) |
740
+
741
+ ## 협업 핵심 원칙: 남의 제사상을 건드리지 않는다
742
+
743
+ DocuKing 협업의 핵심 원칙입니다. **각자 자기 영역만 수정할 수 있고, 남의 영역은 읽기만 가능합니다.**
744
+
745
+ ### Push/Pull 정책 요약
746
+
747
+ | 역할 | Push (올리기) | Pull (내리기) | 삭제 |
748
+ |------|---------------|---------------|------|
749
+ | 오너 | \`yy_All_Docu/\` + \`zz_ai_*/\` | 합집합 전체 | 자기 영역만 |
750
+ | 협업자 | \`yy_Coworker_{본인}/\` (안에 zz_ai_* 포함) | 합집합 전체 | 자기 영역만 |
751
+
752
+ **합집합이란?**
753
+ - 서버에는 오너 파일 + 모든 협업자 파일이 합쳐져 있음
754
+ - Pull하면 전체가 로컬로 내려옴
755
+ - 경로만 알면 누구의 파일이든 읽고 활용 가능
756
+
757
+ ## 킹캐스트 (KingCast) - 정책 자동 배포
758
+
759
+ 오너가 \`xx_Policy/\` 폴더에 정책을 작성하고 Push하면,
760
+ 협업자가 Pull할 때 자동으로 \`.claude/rules/local/\`에 서브파일 구조로 로컬화됩니다.
761
+
762
+ ### 킹캐스트 동작 원리
763
+ \`\`\`
764
+ 오너가 정책 작성 → Push → 협업자 Pull → 킹캐스트 자동 실행 → AI 행동 변화
765
+ \`\`\`
766
+
767
+ ### 킹캐스트 대상 폴더
768
+ - \`xx_Infra_Config/\` - 환경 설정 (.env 백업, 배포 정보 등) → 변경 감지만 (복사X)
769
+ - \`xx_Policy/\` - AI 행동 지침 → .claude/rules/local/에 복사
770
+
771
+ ### 정책 파일 작성 템플릿 (오너용)
772
+ \`\`\`
773
+ xx_Policy/
774
+ ├── 00_project_overview.md # 프로젝트 개요
775
+ ├── 01_folder_structure.md # 폴더 구조
776
+ ├── 02_api_convention.md # API 규칙
777
+ ├── 03_design_policy.md # 디자인 정책
778
+ ├── 99_for_claude.md # AI 특화 지침
779
+ \`\`\`
780
+
781
+ ### Pull 후 생성되는 파일
782
+ - \`.claude/rules/local/00_index.md\` - 정책 인덱스
783
+ - \`.claude/rules/local/00_project_overview.md\` - 정책 사본 (변수 치환됨)
784
+ - \`.claude/rules/local/_coworker_config.md\` - 협업자 설정 (협업자만)
785
+
786
+ ### 킹캐스트 결과 처리
787
+ Pull 결과에 "📢 킹캐스트" 포함 시:
788
+ 1. \`.claude/rules/local/00_index.md\` 읽고 정책 목록 확인
789
+ 2. 정책 파일 **읽어서** 내용 숙지, 규칙 따라 작업
790
+ 3. **xx_Infra_Config 변경 시**: 원본 경로에서 직접 읽고 로컬 환경에 맞게 적용
791
+ - 예: .env 변수 추가/수정, 배포 설정 확인
792
+
793
+ 탐색기: https://docuking.ai
794
+ `;
795
+
796
+ return {
797
+ contents: [{
798
+ uri: "docuking://docs/manual",
799
+ mimeType: "text/markdown",
800
+ text: manual
801
+ }]
802
+ };
803
+ }
804
+
805
+ throw new Error("Unknown resource");
806
+ });
807
+
808
+ // 도구 실행
809
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
810
+ const { name, arguments: args } = request.params;
811
+
812
+ try {
813
+ switch (name) {
814
+ case 'docuking_init':
815
+ return await handleInit(args);
816
+ case 'docuking_push':
817
+ return await handlePush(args);
818
+ case 'docuking_pull':
819
+ return await handlePull(args);
820
+ case 'docuking_list':
821
+ return await handleList(args);
822
+ case 'docuking_status':
823
+ return await handleStatus(args);
824
+ case 'docuking_log':
825
+ return await handleLog(args);
826
+ case 'docuking_diff':
827
+ return await handleDiff(args);
828
+ case 'docuking_rollback':
829
+ return await handleRollback(args);
830
+ case 'docuking_talk':
831
+ return await handleTalk(args);
832
+ case 'docuking_plan':
833
+ return await handlePlan(args);
834
+ case 'docuking_done':
835
+ return await handleDone(args);
836
+ case 'docuking_todo':
837
+ return await handleTodo(args);
838
+ case 'docuking_urgent':
839
+ return await handleUrgent(args);
840
+ case 'docuking_delete':
841
+ return await handleDelete(args);
842
+ case 'docuking_validate':
843
+ return await handleValidate(args);
844
+ default:
845
+ throw new Error(`Unknown tool: ${name}`);
846
+ }
847
+ } catch (error) {
848
+ return {
849
+ content: [
850
+ {
851
+ type: 'text',
852
+ text: `오류: ${error.message}`,
853
+ },
854
+ ],
855
+ };
856
+ }
857
+ });
858
+
859
+ // 서버 시작
860
+ async function main() {
861
+ const transport = new StdioServerTransport();
862
+ await server.connect(transport);
863
+ console.error('[DocuKing MCP] 서버 시작됨');
864
+ }
865
+
866
+ main().catch(console.error);