@projitive/mcp 1.0.0-beta.5 → 1.0.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
@@ -1,36 +1,122 @@
1
1
  # @projitive/mcp
2
2
 
3
+ Language: English | [简体中文](README_CN.md)
4
+
3
5
  **Current Spec Version: projitive-spec v1.0.0 | MCP Version: 1.0.0**
4
6
 
5
- Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现项目、发现任务、定位证据,并按治理流程推进。
7
+ Projitive MCP server (semantic interface edition) helps agents discover projects, select tasks, locate evidence, and execute under governance workflows.
8
+
9
+ ## Agent Delivery Loop
10
+
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.
6
42
 
7
- ## 规范版本
43
+ ## Agent Workflow (Shortest Path)
8
44
 
9
- - 当前遵循规范版本:`projitive-spec v1.0.0`
10
- - 说明:Projitive 是通用治理规范,MCP 只是该规范的一种工具实现。
11
- - 对齐规则:MCP 的主版本必须与规范主版本一致(当前均为 `v1.x`)
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
+ ```
12
73
 
13
- ## 设计边界
74
+ ## Spec Version
14
75
 
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`。
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)
96
+
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
+ #### `projectNext`
27
113
 
28
- - **作用**:直接拉取最近可推进的项目(按可执行任务数和最近更新时间排序)。
29
- - **输入**:`rootPath?`、`maxDepth?`、`limit?`
30
- - **输出示例(Markdown)**:
114
+ - **Purpose**: directly list recently actionable projects (ranked by actionable task count and recency).
115
+ - **Input**: `rootPath?`, `maxDepth?`, `limit?`
116
+ - **Output Example (Markdown)**:
31
117
 
32
118
  ```markdown
33
- # project.next
119
+ # projectNext
34
120
 
35
121
  ## Summary
36
122
  - rootPath: /workspace
@@ -45,18 +131,21 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
45
131
  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
132
 
47
133
  ## 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.
134
+ - Pick top 1 project and call `projectContext` with its governanceDir.
135
+ - Then call `taskList` and `taskContext` to continue execution.
136
+
137
+ ## Next Call
138
+ - projectContext(projectPath="/workspace/proj-a")
50
139
  ```
51
140
 
52
- #### `project.scan`
141
+ #### `projectScan`
53
142
 
54
- - **作用**:扫描目录并发现可治理项目。
55
- - **输入**:`rootPath?`、`maxDepth?`
56
- - **输出示例(Markdown)**:
143
+ - **Purpose**: scan directories and discover governable projects.
144
+ - **Input**: `rootPath?`, `maxDepth?`
145
+ - **Output Example (Markdown)**:
57
146
 
58
147
  ```markdown
59
- # project.scan
148
+ # projectScan
60
149
 
61
150
  ## Summary
62
151
  - rootPath: /workspace
@@ -69,18 +158,21 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
69
158
  2. /workspace/proj-b
70
159
 
71
160
  ## 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.
161
+ - Use one discovered project path and call `projectLocate` to lock governance root.
162
+ - Then call `projectContext` to inspect current governance state.
163
+
164
+ ## Next Call
165
+ - projectLocate(inputPath="/workspace/proj-a")
74
166
  ```
75
167
 
76
- #### `project.locate`
168
+ #### `projectLocate`
77
169
 
78
- - **作用**:当 Agent 已经在某个项目目录内时,向上定位最近 `.projitive`,确定当前项目治理根目录。
79
- - **输入**:`inputPath`
80
- - **输出示例(Markdown)**:
170
+ - **Purpose**: when an agent is already inside a project path, resolve the nearest `.projitive` upward.
171
+ - **Input**: `inputPath`
172
+ - **Output Example (Markdown)**:
81
173
 
82
174
  ```markdown
83
- # project.locate
175
+ # projectLocate
84
176
 
85
177
  ## Summary
86
178
  - resolvedFrom: /workspace/proj-a/packages/mcp
@@ -88,17 +180,20 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
88
180
  - markerPath: /workspace/proj-a/.projitive
89
181
 
90
182
  ## Agent Guidance
91
- - Next: call `project.overview` with this governanceDir to get task and roadmap summaries.
183
+ - Call `projectContext` with this governanceDir to get task and roadmap summaries.
184
+
185
+ ## Next Call
186
+ - projectContext(projectPath="/workspace/proj-a")
92
187
  ```
93
188
 
94
- #### `project.overview`
189
+ #### `projectContext`
95
190
 
96
- - **作用**:自动汇总治理状态,而不是只返回文件列表。
97
- - **输入**:`projectPath`
98
- - **输出示例(Markdown)**:
191
+ - **Purpose**: summarize governance state instead of only returning file lists.
192
+ - **Input**: `projectPath`
193
+ - **Output Example (Markdown)**:
99
194
 
100
195
  ```markdown
101
- # project.overview
196
+ # projectContext
102
197
 
103
198
  ## Summary
104
199
  - governanceDir: /workspace/proj-a
@@ -122,20 +217,23 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
122
217
  - ✅ hooks/
123
218
 
124
219
  ## 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.
220
+ - Start from `taskList` to choose a target task.
221
+ - Then call `taskContext` with a task ID to retrieve evidence locations and reading order.
222
+
223
+ ## Next Call
224
+ - taskList(projectPath="/workspace/proj-a")
127
225
  ```
128
226
 
129
- ### 任务层
227
+ ### Task Layer
130
228
 
131
- #### `task.next`
229
+ #### `taskNext`
132
230
 
133
- - **作用**:一步完成“发现项目 + 选择最可推进任务 + 返回证据定位与阅读顺序”,用于 Agent 直接开工。
134
- - **输入**:`rootPath?`、`maxDepth?`、`topCandidates?`
135
- - **输出示例(Markdown)**:
231
+ - **Purpose**: one-step workflow for project discovery + best task selection + evidence/read-order output.
232
+ - **Input**: `rootPath?`, `maxDepth?`, `topCandidates?`
233
+ - **Output Example (Markdown)**:
136
234
 
137
235
  ```markdown
138
- # task.next
236
+ # taskNext
139
237
 
140
238
  ## Summary
141
239
  - rootPath: /workspace
@@ -156,6 +254,10 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
156
254
  1. TASK-0003 | IN_PROGRESS | Build MCP tools | project=/workspace/proj-a | projectScore=6
157
255
  2. TASK-0007 | TODO | Add docs examples | project=/workspace/proj-b | projectScore=5
158
256
 
257
+ ### Selection Reason
258
+ - Rank rule: projectScore DESC -> taskPriority DESC -> taskUpdatedAt DESC.
259
+ - Selected candidate scores: projectScore=6, taskPriority=2, taskUpdatedAtMs=1739793600000.
260
+
159
261
  ### Suggested Read Order
160
262
  1. /workspace/proj-a/tasks.md
161
263
  2. /workspace/proj-a/designs/mcp-design.md
@@ -163,19 +265,22 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
163
265
 
164
266
  ## Agent Guidance
165
267
  - 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.
268
+ - Re-run `taskContext` for the selectedTaskId after edits to verify evidence consistency.
269
+
270
+ ## Next Call
271
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
167
272
  ```
168
273
 
169
- - **推荐路径**:优先调用 `task.next`,避免 `project.next -> project.overview -> task.list -> task.get` 的多跳链路。
274
+ - **Recommended Path**: prefer `taskNext` to avoid multi-hop flow (`projectNext -> projectContext -> taskList -> taskContext`).
170
275
 
171
- #### `task.list`
276
+ #### `taskList`
172
277
 
173
- - **作用**:返回当前项目任务清单,支持按状态过滤与排序。
174
- - **输入**:`projectPath`、`status?`、`limit?`
175
- - **输出示例(Markdown)**:
278
+ - **Purpose**: list tasks in current project, with optional status filtering and limiting.
279
+ - **Input**: `projectPath`, `status?`, `limit?`
280
+ - **Output Example (Markdown)**:
176
281
 
177
282
  ```markdown
178
- # task.list
283
+ # taskList
179
284
 
180
285
  ## Summary
181
286
  - governanceDir: /workspace/proj-a
@@ -189,25 +294,28 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
189
294
  - TASK-0007 | IN_PROGRESS | Add docs examples | owner=bob | updatedAt=2026-02-17T13:30:00.000Z
190
295
 
191
296
  ## Agent Guidance
192
- - Next: pick one task ID and call `task.get`.
297
+ - Pick one task ID and call `taskContext`.
298
+
299
+ ## Next Call
300
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
193
301
  ```
194
302
 
195
- #### `task.get`
303
+ #### `taskContext`
196
304
 
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)**:
305
+ - **Purpose**: return task detail + related evidence locations in one call (replacing `trace.references`).
306
+ - **Input**: `projectPath`, `taskId`
307
+ - **HOOK Injection**:
308
+ - If `hooks/task_get_head.md` exists, its content is prepended to result.
309
+ - If `hooks/task_get_footer.md` exists, its content is appended to result.
310
+ - Used for project-level custom guidance without changing core `taskContext` shape.
311
+ - **Output Example (Markdown)**:
204
312
 
205
313
  ```markdown
206
- [hooks/task_get_head.md 内容(如果存在)]
314
+ [hooks/task_get_head.md content (if present)]
207
315
 
208
316
  ---
209
317
 
210
- # task.get
318
+ # taskContext
211
319
 
212
320
  ## Summary
213
321
  - governanceDir: /workspace/proj-a
@@ -238,22 +346,27 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
238
346
  ## Agent Guidance
239
347
  - Read the files in Suggested Read Order.
240
348
  - Verify whether current status and evidence are consistent.
349
+ - This task is IN_PROGRESS: prioritize finishing with report/design evidence updates.
350
+ - Verify references stay consistent before marking DONE.
351
+
352
+ ## Next Call
353
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0003")
241
354
 
242
355
  ---
243
356
 
244
- [hooks/task_get_footer.md 内容(如果存在)]
357
+ [hooks/task_get_footer.md content (if present)]
245
358
  ```
246
359
 
247
- ### 路线层
360
+ ### Roadmap Layer
248
361
 
249
- #### `roadmap.list`
362
+ #### `roadmapList`
250
363
 
251
- - **作用**:列出路线图项目及其关联任务概览。
252
- - **输入**:`projectPath`
253
- - **输出示例(Markdown)**:
364
+ - **Purpose**: list roadmap items and linked task summary.
365
+ - **Input**: `projectPath`
366
+ - **Output Example (Markdown)**:
254
367
 
255
368
  ```markdown
256
- # roadmap.list
369
+ # roadmapList
257
370
 
258
371
  ## Summary
259
372
  - governanceDir: /workspace/proj-a
@@ -265,17 +378,20 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
265
378
  - ROADMAP-0002 | linkedTasks=3
266
379
 
267
380
  ## Agent Guidance
268
- - Next: call `roadmap.get` with a roadmap ID to inspect references and related tasks.
381
+ - Pick one roadmap ID and call `roadmapContext`.
382
+
383
+ ## Next Call
384
+ - roadmapContext(projectPath="/workspace/proj-a", roadmapId="ROADMAP-0001")
269
385
  ```
270
386
 
271
- #### `roadmap.get`
387
+ #### `roadmapContext`
272
388
 
273
- - **作用**:获取单个路线图详情与证据定位信息。
274
- - **输入**:`projectPath`、`roadmapId`
275
- - **输出示例(Markdown)**:
389
+ - **Purpose**: get single roadmap detail and reference locations.
390
+ - **Input**: `projectPath`, `roadmapId`
391
+ - **Output Example (Markdown)**:
276
392
 
277
393
  ```markdown
278
- # roadmap.get
394
+ # roadmapContext
279
395
 
280
396
  ## Summary
281
397
  - governanceDir: /workspace/proj-a
@@ -295,12 +411,15 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
295
411
  ## Agent Guidance
296
412
  - Read roadmap references first, then related tasks.
297
413
  - Keep ROADMAP/TASK IDs unchanged while updating markdown files.
414
+
415
+ ## Next Call
416
+ - roadmapContext(projectPath="/workspace/proj-a", roadmapId="ROADMAP-0001")
298
417
  ```
299
418
 
300
- ## 统一错误输出示例
419
+ ## Unified Error Output Example
301
420
 
302
421
  ```markdown
303
- # task.get
422
+ # taskContext
304
423
 
305
424
  ## Error
306
425
  - cause: Invalid task ID format: TASK-12
@@ -308,11 +427,14 @@ Projitive MCP server(语义化接口设计版),用于帮助 Agent 发现
308
427
  ## Next Step
309
428
  - expected format: TASK-0001
310
429
  - retry with a valid task ID
430
+
431
+ ## Retry Example
432
+ - taskContext(projectPath="/workspace/proj-a", taskId="TASK-0001")
311
433
  ```
312
434
 
313
- ## Agent 推荐调用流程
435
+ ## Recommended Agent Call Flow
314
436
 
315
- 1. `task.next`:一步发现并选择最可推进任务,直接开工(默认路径)。
316
- 2. `task.get`:在需要更完整上下文时,按 taskId 拉取详细证据。
317
- 3. `project.next`:仅在需要“先选项目、再选任务”的项目级调度场景使用(可选)。
318
- 4. Agent 已在项目内时,用 `project.locate` 快速定位当前项目治理根目录。
437
+ 1. `taskNext`: one-step discovery and top task selection (default path).
438
+ 2. `taskContext`: fetch detailed evidence for a specific task ID when needed.
439
+ 3. `projectNext`: optional project-level scheduling flow when you need project-first dispatch.
440
+ 4. When already in a project path, use `projectLocate` to quickly resolve governance root.