@projitive/mcp 1.0.0-beta.5 → 1.0.1

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
@@ -1,36 +1,150 @@
1
1
  # @projitive/mcp
2
2
 
3
- **Current Spec Version: projitive-spec v1.0.0 | MCP Version: 1.0.0**
3
+ Language: English | [简体中文](README_CN.md)
4
4
 
5
- Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现项目、发现任务、定位证据,并按治理流程推进。
5
+ **Current Spec Version: projitive-spec v1.0.0 | MCP Version: 1.0.1**
6
6
 
7
- ## 规范版本
7
+ Projitive MCP server (semantic interface edition) helps agents discover projects, select tasks, locate evidence, and execute under governance workflows.
8
8
 
9
- - 当前遵循规范版本:`projitive-spec v1.0.0`
10
- - 说明:Projitive 是通用治理规范,MCP 只是该规范的一种工具实现。
11
- - 对齐规则:MCP 的主版本必须与规范主版本一致(当前均为 `v1.x`)
9
+ ## Agent Delivery Loop
12
10
 
13
- ## 设计边界
11
+ ```mermaid
12
+ flowchart LR
13
+ A[taskNext / projectNext] --> B[taskContext / projectContext]
14
+ B --> C[Update tasks/designs/reports]
15
+ C --> D[taskContext verify]
16
+ D --> E{More actionable work?}
17
+ E -->|Yes| A
18
+ E -->|No| F[Done / wait for new tasks]
19
+ ```
20
+
21
+ ## Why Developers Choose This MCP
22
+
23
+ - Predictable API family: `List/Context` as core, `Next/Scan/Locate` for acceleration.
24
+ - Governance-safe automation: state changes are guided by evidence-first workflow.
25
+ - Agent-ready outputs: markdown contracts optimized for tool-chaining, not raw JSON blobs.
26
+ - Production publishing pipeline: release-triggered CI with lint/test/publish gates.
27
+
28
+ ## How It Helps Agents Manage and Advance Projects
29
+
30
+ This MCP is designed to make agent execution operational, not just informative. It gives agents a closed-loop workflow:
31
+
32
+ 1. **Find what to do next**
33
+ - `taskNext` or `projectNext` ranks actionable targets.
34
+ 2. **Build the right context**
35
+ - `taskContext` / `projectContext` / `roadmapContext` provide evidence, references, and next-call hints.
36
+ 3. **Execute with governance constraints**
37
+ - Agent updates markdown artifacts (`tasks.md`, `designs/`, `reports/`) with immutable IDs and evidence rules.
38
+ 4. **Re-verify and continue**
39
+ - Re-run `taskContext` (or `roadmapContext`) to confirm consistency, then move to the next task.
40
+
41
+ In short: it converts agent work from ad-hoc edits into a **discover → decide → execute → verify** delivery loop.
42
+
43
+ ## Agent Workflow (Shortest Path)
44
+
45
+ ```text
46
+ taskNext
47
+ -> taskContext
48
+ -> update artifacts (tasks/designs/reports)
49
+ -> taskContext (verify)
50
+ -> taskNext (next cycle)
51
+ ```
52
+
53
+ When the agent starts inside a project:
54
+
55
+ ```text
56
+ projectLocate -> projectContext -> taskList -> taskContext
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ```bash
62
+ cd packages/mcp
63
+ npm ci
64
+ npm run build
65
+ npm run test
66
+ ```
67
+
68
+ Then configure your MCP client to run:
69
+
70
+ ```bash
71
+ node /absolute/path/to/packages/mcp/output/index.js
72
+ ```
73
+
74
+ ## Spec Version
75
+
76
+ - Current aligned spec version: `projitive-spec v1.0.0`
77
+ - Note: Projitive is a general governance specification; MCP is one implementation of this spec.
78
+ - Alignment rule: MCP major version must match the spec major version (currently both `v1.x`).
79
+
80
+ ## Design Boundaries
81
+
82
+ - MCP handles discovery, locating, summarization, and execution guidance.
83
+ - Agents/AI handle reading and updating markdown content.
84
+ - MCP does not provide direct artifact-write APIs such as `task.update_*`, `roadmap.update_*`, or `sync_*`.
85
+ - All tool outputs are agent-oriented Markdown (not raw JSON objects).
86
+ - Standard output sections: `Summary` / `Evidence` / `Agent Guidance` / `Next Call`.
87
+ - Standard error sections: `Error` / `Next Step` / `Retry Example`.
88
+
89
+ ## MCP Capability Model
90
+
91
+ - Tools: execute discovery/locating/summarization actions (primary channel).
92
+ - Resources: expose readable governance artifacts for low-cost context loading.
93
+ - Prompts: provide parameterized workflow templates to reduce execution drift.
94
+
95
+ ### Resources (Implemented)
14
96
 
15
- - MCP 负责:发现、定位、汇总、推进指导。
16
- - AI 负责:读取与更新 Markdown 正文内容。
17
- - MCP 不提供:`task.update_*`、`roadmap.update_*`、`sync_*` 这类直接写入治理工件的方法。
18
- - 所有工具返回内容:面向 Agent Markdown(不是 JSON 对象)。
19
- - 输出结构统一为:`Summary` / `Evidence` / `Agent Guidance`。
20
- - 错误结构统一为:`Error` / `Next Step`。
97
+ - `projitive://governance/workspace`: reads `.projitive/README.md`
98
+ - `projitive://governance/tasks`: reads `.projitive/tasks.md`
99
+ - `projitive://governance/roadmap`: reads `.projitive/roadmap.md`
100
+ - `projitive://mcp/method-catalog`: method naming and role catalog (`List/Context/Next/Scan/Locate`)
101
+
102
+ ### Prompts (Implemented)
103
+
104
+ - `executeTaskWorkflow`: standard execution chain (`taskNext -> taskContext -> artifacts update -> verify`)
105
+ - `updateTaskStatusWithEvidence`: status transition + evidence alignment template
106
+ - `triageProjectGovernance`: project-level governance triage template
21
107
 
22
108
  ## Tools Methods
23
109
 
24
- ### 发现层
110
+ ### Discovery Layer
25
111
 
26
- #### `project.next`
112
+ #### `projectInit`
27
113
 
28
- - **作用**:直接拉取最近可推进的项目(按可执行任务数和最近更新时间排序)。
29
- - **输入**:`rootPath?`、`maxDepth?`、`limit?`
30
- - **输出示例(Markdown)**:
114
+ - **Purpose**: manually initialize governance directory structure for a project (default `.projitive`).
115
+ - **Input**: `rootPath?`, `governanceDir?`, `force?`
116
+ - **Output Example (Markdown)**:
31
117
 
32
118
  ```markdown
33
- # project.next
119
+ # projectInit
120
+
121
+ ## Summary
122
+ - rootPath: /workspace/proj-a
123
+ - governanceDir: /workspace/proj-a/.projitive
124
+ - markerPath: /workspace/proj-a/.projitive/.projitive
125
+ - force: false
126
+
127
+ ## Evidence
128
+ - createdFiles: 4
129
+ - updatedFiles: 0
130
+ - skippedFiles: 0
131
+
132
+ ## Agent Guidance
133
+ - If files were skipped and you want to overwrite templates, rerun with force=true.
134
+ - Continue with projectContext and taskList for execution.
135
+
136
+ ## Next Call
137
+ - projectContext(projectPath="/workspace/proj-a/.projitive")
138
+ ```
139
+
140
+ #### `projectNext`
141
+
142
+ - **Purpose**: directly list recently actionable projects (ranked by actionable task count and recency).
143
+ - **Input**: `rootPath?`, `maxDepth?`, `limit?`
144
+ - **Output Example (Markdown)**:
145
+
146
+ ```markdown
147
+ # projectNext
34
148
 
35
149
  ## Summary
36
150
  - rootPath: /workspace
@@ -45,18 +159,21 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
45
159
  2. /workspace/proj-b | actionable=3 | in_progress=1 | todo=2 | blocked=0 | done=7 | latest=2026-02-16T09:00:00.000Z | tasksPath=/workspace/proj-b/tasks.md
46
160
 
47
161
  ## Agent Guidance
48
- - Pick top 1 project and call `project.overview` with its governanceDir.
49
- - Then call `task.list` and `task.get` to continue execution.
162
+ - Pick top 1 project and call `projectContext` with its governanceDir.
163
+ - Then call `taskList` and `taskContext` to continue execution.
164
+
165
+ ## Next Call
166
+ - projectContext(projectPath="/workspace/proj-a")
50
167
  ```
51
168
 
52
- #### `project.scan`
169
+ #### `projectScan`
53
170
 
54
- - **作用**:扫描目录并发现可治理项目。
55
- - **输入**:`rootPath?`、`maxDepth?`
56
- - **输出示例(Markdown)**:
171
+ - **Purpose**: scan directories and discover governable projects.
172
+ - **Input**: `rootPath?`, `maxDepth?`
173
+ - **Output Example (Markdown)**:
57
174
 
58
175
  ```markdown
59
- # project.scan
176
+ # projectScan
60
177
 
61
178
  ## Summary
62
179
  - rootPath: /workspace
@@ -69,18 +186,21 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
69
186
  2. /workspace/proj-b
70
187
 
71
188
  ## Agent Guidance
72
- - Next: call `project.locate` with one target path to lock the active governance root.
73
- - Then: call `project.overview` to view artifact and task status.
189
+ - Use one discovered project path and call `projectLocate` to lock governance root.
190
+ - Then call `projectContext` to inspect current governance state.
191
+
192
+ ## Next Call
193
+ - projectLocate(inputPath="/workspace/proj-a")
74
194
  ```
75
195
 
76
- #### `project.locate`
196
+ #### `projectLocate`
77
197
 
78
- - **作用**:当 Agent 已经在某个项目目录内时,向上定位最近 `.projitive`,确定当前项目治理根目录。
79
- - **输入**:`inputPath`
80
- - **输出示例(Markdown)**:
198
+ - **Purpose**: when an agent is already inside a project path, resolve the nearest `.projitive` upward.
199
+ - **Input**: `inputPath`
200
+ - **Output Example (Markdown)**:
81
201
 
82
202
  ```markdown
83
- # project.locate
203
+ # projectLocate
84
204
 
85
205
  ## Summary
86
206
  - resolvedFrom: /workspace/proj-a/packages/mcp
@@ -88,17 +208,20 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
88
208
  - markerPath: /workspace/proj-a/.projitive
89
209
 
90
210
  ## Agent Guidance
91
- - Next: call `project.overview` with this governanceDir to get task and roadmap summaries.
211
+ - Call `projectContext` with this governanceDir to get task and roadmap summaries.
212
+
213
+ ## Next Call
214
+ - projectContext(projectPath="/workspace/proj-a")
92
215
  ```
93
216
 
94
- #### `project.overview`
217
+ #### `projectContext`
95
218
 
96
- - **作用**:自动汇总治理状态,而不是只返回文件列表。
97
- - **输入**:`projectPath`
98
- - **输出示例(Markdown)**:
219
+ - **Purpose**: summarize governance state instead of only returning file lists.
220
+ - **Input**: `projectPath`
221
+ - **Output Example (Markdown)**:
99
222
 
100
223
  ```markdown
101
- # project.overview
224
+ # projectContext
102
225
 
103
226
  ## Summary
104
227
  - governanceDir: /workspace/proj-a
@@ -122,20 +245,23 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
122
245
  - ✅ hooks/
123
246
 
124
247
  ## Agent Guidance
125
- - Next: call `task.list` to choose a target task.
126
- - Then: call `task.get` with a task ID to retrieve evidence locations and reading order.
248
+ - Start from `taskList` to choose a target task.
249
+ - Then call `taskContext` with a task ID to retrieve evidence locations and reading order.
250
+
251
+ ## Next Call
252
+ - taskList(projectPath="/workspace/proj-a")
127
253
  ```
128
254
 
129
- ### 任务层
255
+ ### Task Layer
130
256
 
131
- #### `task.next`
257
+ #### `taskNext`
132
258
 
133
- - **作用**:一步完成“发现项目 + 选择最可推进任务 + 返回证据定位与阅读顺序”,用于 Agent 直接开工。
134
- - **输入**:`rootPath?`、`maxDepth?`、`topCandidates?`
135
- - **输出示例(Markdown)**:
259
+ - **Purpose**: one-step workflow for project discovery + best task selection + evidence/read-order output.
260
+ - **Input**: `rootPath?`, `maxDepth?`, `topCandidates?`
261
+ - **Output Example (Markdown)**:
136
262
 
137
263
  ```markdown
138
- # task.next
264
+ # taskNext
139
265
 
140
266
  ## Summary
141
267
  - rootPath: /workspace
@@ -156,6 +282,10 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
156
282
  1. TASK-0003 | IN_PROGRESS | Build MCP tools | project=/workspace/proj-a | projectScore=6
157
283
  2. TASK-0007 | TODO | Add docs examples | project=/workspace/proj-b | projectScore=5
158
284
 
285
+ ### Selection Reason
286
+ - Rank rule: projectScore DESC -> taskPriority DESC -> taskUpdatedAt DESC.
287
+ - Selected candidate scores: projectScore=6, taskPriority=2, taskUpdatedAtMs=1739793600000.
288
+
159
289
  ### Suggested Read Order
160
290
  1. /workspace/proj-a/tasks.md
161
291
  2. /workspace/proj-a/designs/mcp-design.md
@@ -163,19 +293,22 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
163
293
 
164
294
  ## Agent Guidance
165
295
  - Start immediately with Suggested Read Order and execute the selected task.
166
- - Re-run `task.get` for the selectedTaskId after edits to verify evidence consistency.
296
+ - Re-run `taskContext` for the selectedTaskId after edits to verify evidence consistency.
297
+
298
+ ## Next Call
299
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
167
300
  ```
168
301
 
169
- - **推荐路径**:优先调用 `task.next`,避免 `project.next -> project.overview -> task.list -> task.get` 的多跳链路。
302
+ - **Recommended Path**: prefer `taskNext` to avoid multi-hop flow (`projectNext -> projectContext -> taskList -> taskContext`).
170
303
 
171
- #### `task.list`
304
+ #### `taskList`
172
305
 
173
- - **作用**:返回当前项目任务清单,支持按状态过滤与排序。
174
- - **输入**:`projectPath`、`status?`、`limit?`
175
- - **输出示例(Markdown)**:
306
+ - **Purpose**: list tasks in current project, with optional status filtering and limiting.
307
+ - **Input**: `projectPath`, `status?`, `limit?`
308
+ - **Output Example (Markdown)**:
176
309
 
177
310
  ```markdown
178
- # task.list
311
+ # taskList
179
312
 
180
313
  ## Summary
181
314
  - governanceDir: /workspace/proj-a
@@ -189,25 +322,28 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
189
322
  - TASK-0007 | IN_PROGRESS | Add docs examples | owner=bob | updatedAt=2026-02-17T13:30:00.000Z
190
323
 
191
324
  ## Agent Guidance
192
- - Next: pick one task ID and call `task.get`.
325
+ - Pick one task ID and call `taskContext`.
326
+
327
+ ## Next Call
328
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
193
329
  ```
194
330
 
195
- #### `task.get`
331
+ #### `taskContext`
196
332
 
197
- - **作用**:基于任务 ID 一次性返回任务详情 + 关联证据位置(替代 `trace.references`)。
198
- - **输入**:`projectPath`、`taskId`
199
- - **HOOKS 注入**:
200
- - 若存在 `hooks/task_get_head.md`,其内容会自动追加到返回结果最前面。
201
- - 若存在 `hooks/task_get_footer.md`,其内容会自动追加到返回结果最后面。
202
- - 用于给 Agent 注入项目级自定义提示,不改变 task.get 核心结构。
203
- - **输出示例(Markdown)**:
333
+ - **Purpose**: return task detail + related evidence locations in one call (replacing `trace.references`).
334
+ - **Input**: `projectPath`, `taskId`
335
+ - **HOOK Injection**:
336
+ - If `hooks/task_get_head.md` exists, its content is prepended to result.
337
+ - If `hooks/task_get_footer.md` exists, its content is appended to result.
338
+ - Used for project-level custom guidance without changing core `taskContext` shape.
339
+ - **Output Example (Markdown)**:
204
340
 
205
341
  ```markdown
206
- [hooks/task_get_head.md 内容(如果存在)]
342
+ [hooks/task_get_head.md content (if present)]
207
343
 
208
344
  ---
209
345
 
210
- # task.get
346
+ # taskContext
211
347
 
212
348
  ## Summary
213
349
  - governanceDir: /workspace/proj-a
@@ -238,22 +374,27 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
238
374
  ## Agent Guidance
239
375
  - Read the files in Suggested Read Order.
240
376
  - Verify whether current status and evidence are consistent.
377
+ - This task is IN_PROGRESS: prioritize finishing with report/design evidence updates.
378
+ - Verify references stay consistent before marking DONE.
379
+
380
+ ## Next Call
381
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
241
382
 
242
383
  ---
243
384
 
244
- [hooks/task_get_footer.md 内容(如果存在)]
385
+ [hooks/task_get_footer.md content (if present)]
245
386
  ```
246
387
 
247
- ### 路线层
388
+ ### Roadmap Layer
248
389
 
249
- #### `roadmap.list`
390
+ #### `roadmapList`
250
391
 
251
- - **作用**:列出路线图项目及其关联任务概览。
252
- - **输入**:`projectPath`
253
- - **输出示例(Markdown)**:
392
+ - **Purpose**: list roadmap items and linked task summary.
393
+ - **Input**: `projectPath`
394
+ - **Output Example (Markdown)**:
254
395
 
255
396
  ```markdown
256
- # roadmap.list
397
+ # roadmapList
257
398
 
258
399
  ## Summary
259
400
  - governanceDir: /workspace/proj-a
@@ -265,17 +406,20 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
265
406
  - ROADMAP-0002 | linkedTasks=3
266
407
 
267
408
  ## Agent Guidance
268
- - Next: call `roadmap.get` with a roadmap ID to inspect references and related tasks.
409
+ - Pick one roadmap ID and call `roadmapContext`.
410
+
411
+ ## Next Call
412
+ - roadmapContext(projectPath="/workspace/proj-a", roadmapId="ROADMAP-0001")
269
413
  ```
270
414
 
271
- #### `roadmap.get`
415
+ #### `roadmapContext`
272
416
 
273
- - **作用**:获取单个路线图详情与证据定位信息。
274
- - **输入**:`projectPath`、`roadmapId`
275
- - **输出示例(Markdown)**:
417
+ - **Purpose**: get single roadmap detail and reference locations.
418
+ - **Input**: `projectPath`, `roadmapId`
419
+ - **Output Example (Markdown)**:
276
420
 
277
421
  ```markdown
278
- # roadmap.get
422
+ # roadmapContext
279
423
 
280
424
  ## Summary
281
425
  - governanceDir: /workspace/proj-a
@@ -295,12 +439,15 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
295
439
  ## Agent Guidance
296
440
  - Read roadmap references first, then related tasks.
297
441
  - Keep ROADMAP/TASK IDs unchanged while updating markdown files.
442
+
443
+ ## Next Call
444
+ - roadmapContext(projectPath="/workspace/proj-a", roadmapId="ROADMAP-0001")
298
445
  ```
299
446
 
300
- ## 统一错误输出示例
447
+ ## Unified Error Output Example
301
448
 
302
449
  ```markdown
303
- # task.get
450
+ # taskContext
304
451
 
305
452
  ## Error
306
453
  - cause: Invalid task ID format: TASK-12
@@ -308,11 +455,14 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
308
455
  ## Next Step
309
456
  - expected format: TASK-0001
310
457
  - retry with a valid task ID
458
+
459
+ ## Retry Example
460
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0001")
311
461
  ```
312
462
 
313
- ## Agent 推荐调用流程
463
+ ## Recommended Agent Call Flow
314
464
 
315
- 1. `task.next`:一步发现并选择最可推进任务,直接开工(默认路径)。
316
- 2. `task.get`:在需要更完整上下文时,按 taskId 拉取详细证据。
317
- 3. `project.next`:仅在需要“先选项目、再选任务”的项目级调度场景使用(可选)。
318
- 4. Agent 已在项目内时,用 `project.locate` 快速定位当前项目治理根目录。
465
+ 1. `taskNext`: one-step discovery and top task selection (default path).
466
+ 2. `taskContext`: fetch detailed evidence for a specific task ID when needed.
467
+ 3. `projectNext`: optional project-level scheduling flow when you need project-first dispatch.
468
+ 4. When already in a project path, use `projectLocate` to quickly resolve governance root.