prd-writer-mcp 0.1.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/LICENSE +21 -0
- package/README.md +208 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.js +23 -0
- package/dist/guides/01.md +27 -0
- package/dist/guides/02.md +21 -0
- package/dist/guides/03.md +16 -0
- package/dist/guides/04.md +31 -0
- package/dist/guides/05.md +36 -0
- package/dist/guides/06.md +45 -0
- package/dist/guides/07.md +56 -0
- package/dist/guides/08.md +29 -0
- package/dist/guides/09.md +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +103 -0
- package/dist/templates/chapters/01-overview.xml +41 -0
- package/dist/templates/chapters/02-mvp-goals.xml +14 -0
- package/dist/templates/chapters/03-demo-scenario.xml +12 -0
- package/dist/templates/chapters/04-architecture.xml +33 -0
- package/dist/templates/chapters/05-design-spec.xml +22 -0
- package/dist/templates/chapters/06-requirements.xml +60 -0
- package/dist/templates/chapters/07-feature-spec.xml +84 -0
- package/dist/templates/chapters/08-mvp-metrics.xml +29 -0
- package/dist/templates/chapters/09-out-of-scope.xml +25 -0
- package/dist/templates/overview.md +100 -0
- package/dist/tools/documents/controller.d.ts +11 -0
- package/dist/tools/documents/controller.js +24 -0
- package/dist/tools/documents/service.d.ts +18 -0
- package/dist/tools/documents/service.js +195 -0
- package/dist/tools/templates/controller.d.ts +13 -0
- package/dist/tools/templates/controller.js +28 -0
- package/dist/tools/templates/service.d.ts +12 -0
- package/dist/tools/templates/service.js +91 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 haandol
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# PRD Writer MCP Server
|
|
2
|
+
|
|
3
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that helps you write PRD (Product Requirements Document) interactively with AI. Guides you through 9 structured sections with templates, conversation guides, and document management.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 9-section PRD template with structured XML templates and conversation guides
|
|
8
|
+
- Interactive Q&A workflow — AI asks focused questions, never auto-generates
|
|
9
|
+
- Document management — create, save, load, and export as clean Markdown
|
|
10
|
+
- Section dependency tracking — ensures referenced sections are reviewed first
|
|
11
|
+
- Works with Claude Desktop, Cursor, Kiro, and any MCP-compatible client
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
### Running with npx
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y prd-writer-mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Manual Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g prd-writer-mcp
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Configuration
|
|
28
|
+
|
|
29
|
+
### Claude Desktop
|
|
30
|
+
|
|
31
|
+
Add to your `claude_desktop_config.json`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{
|
|
35
|
+
"mcpServers": {
|
|
36
|
+
"prd-writer": {
|
|
37
|
+
"command": "npx",
|
|
38
|
+
"args": ["-y", "prd-writer-mcp"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Cursor
|
|
45
|
+
|
|
46
|
+
1. Open Cursor Settings
|
|
47
|
+
2. Go to Features > MCP Servers
|
|
48
|
+
3. Click "+ Add new global MCP server"
|
|
49
|
+
4. Enter the following:
|
|
50
|
+
|
|
51
|
+
```json
|
|
52
|
+
{
|
|
53
|
+
"mcpServers": {
|
|
54
|
+
"prd-writer": {
|
|
55
|
+
"command": "npx",
|
|
56
|
+
"args": ["-y", "prd-writer-mcp"]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Kiro
|
|
63
|
+
|
|
64
|
+
1. Open the command palette (`Cmd + Shift + P` on Mac, `Ctrl + Shift + P` on Windows/Linux)
|
|
65
|
+
2. Search for "MCP" and select **Kiro: Open user MCP config (JSON)** (or workspace-level)
|
|
66
|
+
3. Add the following:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"mcpServers": {
|
|
71
|
+
"prd-writer": {
|
|
72
|
+
"command": "npx",
|
|
73
|
+
"args": ["-y", "prd-writer-mcp"]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Configuration file locations:
|
|
80
|
+
|
|
81
|
+
- User level: `~/.kiro/settings/mcp.json`
|
|
82
|
+
- Workspace level: `.kiro/settings/mcp.json`
|
|
83
|
+
|
|
84
|
+
## Environment Variables
|
|
85
|
+
|
|
86
|
+
| Variable | Description | Default |
|
|
87
|
+
| ---------------- | ------------------------------------------------------------ | ------------------------- |
|
|
88
|
+
| `PRD_OUTPUT_DIR` | Directory for document files (`.prd.xml`, exported markdown) | Current working directory |
|
|
89
|
+
|
|
90
|
+
Example with Claude Desktop:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"prd-writer": {
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "prd-writer-mcp"],
|
|
98
|
+
"env": {
|
|
99
|
+
"PRD_OUTPUT_DIR": "~/Documents/prd"
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Running from Source
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
git clone https://github.com/haandol/prd-writer.git
|
|
110
|
+
cd prd-writer
|
|
111
|
+
pnpm install
|
|
112
|
+
pnpm build
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Then configure your MCP client:
|
|
116
|
+
|
|
117
|
+
```json
|
|
118
|
+
{
|
|
119
|
+
"mcpServers": {
|
|
120
|
+
"prd-writer": {
|
|
121
|
+
"command": "node",
|
|
122
|
+
"args": ["/path/to/prd-writer/dist/index.js"]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Available Tools
|
|
129
|
+
|
|
130
|
+
### Template Tools
|
|
131
|
+
|
|
132
|
+
| Tool | Description |
|
|
133
|
+
| ----------------------- | ----------------------------------------------------- |
|
|
134
|
+
| `get_prd_overview` | Get the PRD template overview with conversation guide |
|
|
135
|
+
| `list_prd_sections` | List all available template sections |
|
|
136
|
+
| `get_prd_section` | Get a specific template section by number (1-9) |
|
|
137
|
+
| `get_prd_full_template` | Get the complete template with all sections |
|
|
138
|
+
| `get_prd_section_guide` | Get conversation guide for writing a section |
|
|
139
|
+
|
|
140
|
+
### Document Management Tools
|
|
141
|
+
|
|
142
|
+
| Tool | Description |
|
|
143
|
+
| ------------------------- | ------------------------------------------- |
|
|
144
|
+
| `init_prd_document` | Create a new PRD document (`.prd.xml`) |
|
|
145
|
+
| `load_prd_document` | Load an existing document to resume editing |
|
|
146
|
+
| `save_prd_section` | Save content to a specific subsection |
|
|
147
|
+
| `read_prd_section` | Read current content of a section |
|
|
148
|
+
| `get_prd_document_status` | Get status of all sections |
|
|
149
|
+
| `export_prd_markdown` | Export as clean Markdown |
|
|
150
|
+
|
|
151
|
+
## Workflow
|
|
152
|
+
|
|
153
|
+
The server guides AI through a structured workflow:
|
|
154
|
+
|
|
155
|
+
1. **Initialize** — `init_prd_document()` or `load_prd_document()`
|
|
156
|
+
2. **Overview** — `get_prd_overview()` to get the conversation guide
|
|
157
|
+
3. **For each section (1-9):**
|
|
158
|
+
- `get_prd_section_guide(N)` — get questions and criteria
|
|
159
|
+
- `get_prd_section(N)` — get the template structure
|
|
160
|
+
- Ask focused questions (1-2 at a time)
|
|
161
|
+
- `save_prd_section(N, ...)` — save after user confirmation
|
|
162
|
+
4. **Export** — `export_prd_markdown()` for the final document
|
|
163
|
+
|
|
164
|
+
## PRD Sections
|
|
165
|
+
|
|
166
|
+
| # | Section | Dependencies |
|
|
167
|
+
| --- | --------------------------- | ------------ |
|
|
168
|
+
| 1 | Overview | — |
|
|
169
|
+
| 2 | MVP Goals and Key Metrics | — |
|
|
170
|
+
| 3 | Demo Scenario | Section 2 |
|
|
171
|
+
| 4 | High-Level Architecture | — |
|
|
172
|
+
| 5 | Design Specification | Section 6 |
|
|
173
|
+
| 6 | Requirements Summary | — |
|
|
174
|
+
| 7 | Feature-Level Specification | Section 6 |
|
|
175
|
+
| 8 | MVP Metrics | Section 2, 6 |
|
|
176
|
+
| 9 | Out of Scope | — |
|
|
177
|
+
|
|
178
|
+
## Document Format
|
|
179
|
+
|
|
180
|
+
Documents are stored in XML for reliable section parsing:
|
|
181
|
+
|
|
182
|
+
```xml
|
|
183
|
+
<prd-document project="My Project">
|
|
184
|
+
|
|
185
|
+
<section id="1" title="Overview">
|
|
186
|
+
<subsection id="1.1" title="Purpose">
|
|
187
|
+
Content here...
|
|
188
|
+
</subsection>
|
|
189
|
+
</section>
|
|
190
|
+
|
|
191
|
+
...
|
|
192
|
+
</prd-document>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Export to clean Markdown via `export_prd_markdown()`.
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
pnpm install
|
|
201
|
+
pnpm dev # Run with tsx (watch mode)
|
|
202
|
+
pnpm build # Build for production
|
|
203
|
+
pnpm start # Run built version
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
Apache-2.0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
4
|
+
export const TEMPLATES_DIR = path.join(__dirname, "templates");
|
|
5
|
+
export const CHAPTERS_DIR = path.join(TEMPLATES_DIR, "chapters");
|
|
6
|
+
export const GUIDES_DIR = path.join(__dirname, "guides");
|
|
7
|
+
export const SECTION_TITLES = {
|
|
8
|
+
1: "Overview",
|
|
9
|
+
2: "MVP Goals and Key Metrics",
|
|
10
|
+
3: "Demo Scenario",
|
|
11
|
+
4: "High-Level Architecture",
|
|
12
|
+
5: "Design Specification",
|
|
13
|
+
6: "Requirements Summary",
|
|
14
|
+
7: "Feature-Level Specification",
|
|
15
|
+
8: "MVP Metrics",
|
|
16
|
+
9: "Out of Scope",
|
|
17
|
+
};
|
|
18
|
+
export const SECTION_REFERENCES = {
|
|
19
|
+
3: [2],
|
|
20
|
+
5: [6],
|
|
21
|
+
7: [6],
|
|
22
|
+
8: [2, 6],
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<section_guide number="1" title="Overview">
|
|
2
|
+
<purpose>Define product vision, target users, core problem, solution strategy, success criteria, and differentiators</purpose>
|
|
3
|
+
|
|
4
|
+
<questions>
|
|
5
|
+
1. What is the main purpose of the project?
|
|
6
|
+
2. What is the official project name?
|
|
7
|
+
3. Who are the target users?
|
|
8
|
+
4. What is the core problem to solve?
|
|
9
|
+
5. What is the solution strategy and key differentiator?
|
|
10
|
+
</questions>
|
|
11
|
+
|
|
12
|
+
<example>
|
|
13
|
+
### 1.1 Purpose
|
|
14
|
+
- Enable users to automatically generate technical/functional specification documents by conversing with AI
|
|
15
|
+
- Help developers, product managers, and planners write MVP technical specs more efficiently
|
|
16
|
+
|
|
17
|
+
### 1.2 Document Title
|
|
18
|
+
|
|
19
|
+
- PRD(Agentic Lean Prototyping Spec) Writer
|
|
20
|
+
|
|
21
|
+
### 1.3 Author
|
|
22
|
+
|
|
23
|
+
- haandol <ldg55d@gmail.com>
|
|
24
|
+
</example>
|
|
25
|
+
|
|
26
|
+
<completion>Print the full section after all items are written, then get user confirmation</completion>
|
|
27
|
+
</section_guide>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<section_guide number="2" title="MVP Goals and Key Metrics">
|
|
2
|
+
<purpose>Define 2-5 measurable goals to validate the MVP hypothesis</purpose>
|
|
3
|
+
|
|
4
|
+
<questions>
|
|
5
|
+
1. What is the core hypothesis you want to validate with the MVP?
|
|
6
|
+
2. Define 2-5 measurable goals to validate this hypothesis
|
|
7
|
+
3. What are the baseline (current) and target values for each goal?
|
|
8
|
+
</questions>
|
|
9
|
+
|
|
10
|
+
<example>
|
|
11
|
+
### 2.1 Purpose
|
|
12
|
+
- Can AI quickly generate technical specification documents based on a given template, reflecting user input?
|
|
13
|
+
|
|
14
|
+
### 2.2 Key Performance Indicators (KPIs)
|
|
15
|
+
|
|
16
|
+
- Average time for a user to complete a document via AI: **under 30 minutes**
|
|
17
|
+
- Conversation context retention rate: **90% or higher**
|
|
18
|
+
</example>
|
|
19
|
+
|
|
20
|
+
<completion>Confirm after writing goals with quantitative metrics</completion>
|
|
21
|
+
</section_guide>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<section_guide number="3" title="Demo Scenario" references="2">
|
|
2
|
+
<purpose>Write a demo scenario that validates the core hypothesis</purpose>
|
|
3
|
+
|
|
4
|
+
<required_review>
|
|
5
|
+
MUST review Section 2 (MVP Goals) before writing this section.
|
|
6
|
+
Call read_prd_section(2) and summarize key goals before proceeding.
|
|
7
|
+
</required_review>
|
|
8
|
+
|
|
9
|
+
<questions>
|
|
10
|
+
1. How can you demonstrate the goals from Section 2?
|
|
11
|
+
2. What are the starting and ending points of the demo?
|
|
12
|
+
3. What is the key user journey?
|
|
13
|
+
</questions>
|
|
14
|
+
|
|
15
|
+
<completion required="true">Confirm after writing the scenario aligned with Section 2</completion>
|
|
16
|
+
</section_guide>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<section_guide number="4" title="High-Level Architecture">
|
|
2
|
+
<purpose>Describe the system architecture using C4 model Context and Container diagrams</purpose>
|
|
3
|
+
|
|
4
|
+
<questions>
|
|
5
|
+
1. What are the main components of the system?
|
|
6
|
+
2. Are there any external system/service integrations?
|
|
7
|
+
3. What is the rationale for the technology stack choices?
|
|
8
|
+
</questions>
|
|
9
|
+
|
|
10
|
+
<example>
|
|
11
|
+
### 4.1 System Diagram
|
|
12
|
+
```mermaid
|
|
13
|
+
flowchart LR
|
|
14
|
+
User -- "Chat with AI" --> Chainlit(Python App)
|
|
15
|
+
Chainlit -- "LLM Query" --> Bedrock(Claude Sonnet 4.6)
|
|
16
|
+
Chainlit -- "Web Search" --> Tavily(Tavily API)
|
|
17
|
+
Chainlit -- "Save File" --> FileSystem(Local)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 4.2 Technology Stack
|
|
21
|
+
|
|
22
|
+
| Component | Technology |
|
|
23
|
+
| ------------------ | ------------------------- |
|
|
24
|
+
| Frontend & Backend | Python (Chainlit) |
|
|
25
|
+
| LLM API | Amazon Bedrock, Langchain |
|
|
26
|
+
| Web Search API | Tavily API |
|
|
27
|
+
|
|
28
|
+
</example>
|
|
29
|
+
|
|
30
|
+
<completion>Include Context/Container diagram descriptions</completion>
|
|
31
|
+
</section_guide>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<section_guide number="5" title="Design Specification" references="6">
|
|
2
|
+
<purpose>Detail the UX, page flow, key screens, and user journey</purpose>
|
|
3
|
+
|
|
4
|
+
<required_review>
|
|
5
|
+
MUST review Section 6 (Requirements Summary) before writing this section.
|
|
6
|
+
Call read_prd_section(6) and list Feature IDs (F1, F2...) to use in Key Pages.
|
|
7
|
+
</required_review>
|
|
8
|
+
|
|
9
|
+
<questions>
|
|
10
|
+
1. How many key screens (pages) are there?
|
|
11
|
+
2. What is the core functionality of each screen? (Use Feature IDs from Section 6)
|
|
12
|
+
3. What is the navigation flow between screens?
|
|
13
|
+
</questions>
|
|
14
|
+
|
|
15
|
+
<example>
|
|
16
|
+
### 5.1 Key Screens
|
|
17
|
+
- **Chat Interface**: Main screen where users converse with AI to write documents (F1, F2)
|
|
18
|
+
|
|
19
|
+
### 5.2 User Flow
|
|
20
|
+
|
|
21
|
+
```mermaid
|
|
22
|
+
sequenceDiagram
|
|
23
|
+
participant User
|
|
24
|
+
participant AI (Chainlit)
|
|
25
|
+
participant Claude (LLM)
|
|
26
|
+
|
|
27
|
+
User->>AI (Chainlit): "Start new document"
|
|
28
|
+
AI (Chainlit)->>Claude (LLM): Request template-based question generation
|
|
29
|
+
Claude (LLM)-->>AI (Chainlit): Question response
|
|
30
|
+
AI (Chainlit)-->>User: Display question
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
</example>
|
|
34
|
+
|
|
35
|
+
<completion>Define key screens and flow (including Feature ID mapping)</completion>
|
|
36
|
+
</section_guide>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<section_guide number="6" title="Requirements Summary">
|
|
2
|
+
<purpose>Enumerate functional/non-functional requirements and assign priorities</purpose>
|
|
3
|
+
|
|
4
|
+
<questions>
|
|
5
|
+
1. List the core functional requirements
|
|
6
|
+
2. What is the priority of each requirement? (Must-Have / Should-Have / Nice-to-Have)
|
|
7
|
+
3. What are the non-functional requirements? (up to 3)
|
|
8
|
+
</questions>
|
|
9
|
+
|
|
10
|
+
<workflow>
|
|
11
|
+
After completing 6.1 and 6.2:
|
|
12
|
+
1. Analyze the features defined in 6.1 and automatically infer dependency relationships between them
|
|
13
|
+
2. Generate a Mermaid dependency diagram (graph TD) for Section 6.3
|
|
14
|
+
3. Present the generated diagram to the user and ask for confirmation or corrections
|
|
15
|
+
4. Do NOT ask the user to describe dependencies from scratch — propose your analysis first
|
|
16
|
+
</workflow>
|
|
17
|
+
|
|
18
|
+
<example>
|
|
19
|
+
### 6.1 Functional Requirements
|
|
20
|
+
- **F1: Template-based AI Document Writing** - AI generates documents based on a predefined PRD template, reflecting user input
|
|
21
|
+
- **F2: Conversational Input Support** - Users can fill in the document step by step through conversation with AI
|
|
22
|
+
- **F3: Document Download** - Download the completed document in Markdown format
|
|
23
|
+
|
|
24
|
+
### 6.2 Non-Functional Requirements
|
|
25
|
+
|
|
26
|
+
- **NF1: Performance** - Support 1,000 concurrent users, document generation within 30 seconds
|
|
27
|
+
- **NF2: Security** - OAuth authentication via AWS Cognito
|
|
28
|
+
|
|
29
|
+
### 6.3 Feature Dependency Diagram
|
|
30
|
+
|
|
31
|
+
```mermaid
|
|
32
|
+
graph TD
|
|
33
|
+
F1[F1: Template-based AI Document Writing]
|
|
34
|
+
F2[F2: Conversational Input Support]
|
|
35
|
+
F3[F3: Document Download]
|
|
36
|
+
|
|
37
|
+
F2 -->|depends on| F1
|
|
38
|
+
F3 -->|depends on| F1
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
</example>
|
|
42
|
+
|
|
43
|
+
<important>Assign a unique ID to each functional requirement (F1, F2, ...)</important>
|
|
44
|
+
<completion required="true">Confirm after all requirements have been assigned IDs</completion>
|
|
45
|
+
</section_guide>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<section_guide number="7" title="Feature-Level Specification" references="6">
|
|
2
|
+
<purpose>Write detailed user stories for each requirement from Section 6</purpose>
|
|
3
|
+
|
|
4
|
+
<required_review>
|
|
5
|
+
MUST review Section 6 (Requirements Summary) before writing this section.
|
|
6
|
+
Call read_prd_section(6) and confirm all Feature IDs (F1, F2...) to map 1:1.
|
|
7
|
+
</required_review>
|
|
8
|
+
|
|
9
|
+
<workflow>
|
|
10
|
+
CRITICAL: Each Feature (7.x) must be written and saved individually.
|
|
11
|
+
|
|
12
|
+
1. Confirm the Feature list from Section 6 (F1, F2, F3...)
|
|
13
|
+
2. Proceed sequentially for each Feature:
|
|
14
|
+
a. Discuss the Feature using the questions below
|
|
15
|
+
b. Complete the 7.x subsection
|
|
16
|
+
c. Get user confirmation
|
|
17
|
+
d. Call save_prd_section(7, content, subsection=x) to save
|
|
18
|
+
e. Move to the next Feature
|
|
19
|
+
3. Review the entire Section 7 after all Features are complete
|
|
20
|
+
</workflow>
|
|
21
|
+
|
|
22
|
+
<questions repeat="each_feature">
|
|
23
|
+
1. User Story: "As a [role], I want to [action] so that [benefit]"
|
|
24
|
+
2. What is the user flow?
|
|
25
|
+
3. What are the technical implementation details?
|
|
26
|
+
4. What are the edge cases and error handling strategies?
|
|
27
|
+
5. What are the acceptance criteria?
|
|
28
|
+
</questions>
|
|
29
|
+
|
|
30
|
+
<example>
|
|
31
|
+
### 7.1 Feature A (F1: Template-based AI Document Writing)
|
|
32
|
+
|
|
33
|
+
#### 7.1.1 User Story
|
|
34
|
+
|
|
35
|
+
- When a user starts a conversation, AI guides document writing based on the PRD template
|
|
36
|
+
- Users complete the document step by step following AI guidance
|
|
37
|
+
|
|
38
|
+
#### 7.1.2 UI Flow
|
|
39
|
+
|
|
40
|
+
1. Welcome message and getting-started guide on app launch
|
|
41
|
+
2. AI presents questions for the first chapter when user wants to create a new document
|
|
42
|
+
3. After all chapters are complete, guide for final document save
|
|
43
|
+
|
|
44
|
+
#### 7.1.3 Technical Description
|
|
45
|
+
|
|
46
|
+
- **System Prompt**: Provide template integrated into LLM
|
|
47
|
+
- **LLM Integration**: Use Amazon Bedrock's Claude Sonnet 4.6 model
|
|
48
|
+
</example>
|
|
49
|
+
|
|
50
|
+
<important>
|
|
51
|
+
- Must map 1:1 with requirement IDs from Section 6
|
|
52
|
+
- Each 7.x subsection must be individually confirmed and saved
|
|
53
|
+
- Do not write multiple Features at once
|
|
54
|
+
</important>
|
|
55
|
+
<completion>Save after each Feature is completed; ensure 7.1, 7.2... correspond to all F1, F2...</completion>
|
|
56
|
+
</section_guide>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<section_guide number="8" title="MVP Metrics" references="2,6">
|
|
2
|
+
<purpose>Define data collection/analysis methods and success thresholds</purpose>
|
|
3
|
+
|
|
4
|
+
<required_review>
|
|
5
|
+
MUST review referenced sections before writing:
|
|
6
|
+
|
|
7
|
+
- Section 2 (MVP Goals): Call read_prd_section(2) for KPIs to measure
|
|
8
|
+
- Section 6.2 (Non-Functional Requirements): Call read_prd_section(6) for NFRs to validate
|
|
9
|
+
</required_review>
|
|
10
|
+
|
|
11
|
+
<questions>
|
|
12
|
+
1. How will you measure each goal from Section 2?
|
|
13
|
+
2. What are the data collection methods?
|
|
14
|
+
3. What are the criteria for determining success or failure?
|
|
15
|
+
</questions>
|
|
16
|
+
|
|
17
|
+
<example>
|
|
18
|
+
### 8.1 Data to Collect
|
|
19
|
+
- **Average document writing time**: Time from when a user starts writing to completion
|
|
20
|
+
- **User command usage frequency**: Number of times commands like `/search` are used
|
|
21
|
+
|
|
22
|
+
### 8.2 Data Collection Methods
|
|
23
|
+
|
|
24
|
+
- Record key events in application logs
|
|
25
|
+
- Monitor user interactions via Chainlit's built-in event handlers
|
|
26
|
+
</example>
|
|
27
|
+
|
|
28
|
+
<completion>Define measurement methods and thresholds for each KPI</completion>
|
|
29
|
+
</section_guide>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<section_guide number="9" title="Out of Scope">
|
|
2
|
+
<purpose>Roadmap for features and technical debt to address in future iterations</purpose>
|
|
3
|
+
|
|
4
|
+
<questions>
|
|
5
|
+
1. What features are excluded from the MVP?
|
|
6
|
+
2. What are the future improvement plans?
|
|
7
|
+
3. What is the known technical debt?
|
|
8
|
+
</questions>
|
|
9
|
+
|
|
10
|
+
<example>
|
|
11
|
+
- **S3 File Storage**: Currently supports local file system only; S3 storage integration planned for the future
|
|
12
|
+
- **Document Template Selection**: Expand to allow selection from multiple templates
|
|
13
|
+
- **ECS Deployment**: Currently runs locally; scalable deployment via AWS ECS planned
|
|
14
|
+
</example>
|
|
15
|
+
|
|
16
|
+
<completion>Organize excluded items and future roadmap</completion>
|
|
17
|
+
</section_guide>
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { TemplateService } from "./tools/templates/service.js";
|
|
6
|
+
import { TemplateController } from "./tools/templates/controller.js";
|
|
7
|
+
import { DocumentService } from "./tools/documents/service.js";
|
|
8
|
+
import { DocumentController } from "./tools/documents/controller.js";
|
|
9
|
+
const server = new McpServer({ name: "prd-writer", version: "0.1.0" }, {
|
|
10
|
+
instructions: `You are an intelligent product owner helping users create PRD documents.
|
|
11
|
+
|
|
12
|
+
<WORKFLOW>
|
|
13
|
+
1. init_prd_document() or load_prd_document()
|
|
14
|
+
2. get_prd_overview() - MUST call first to get conversation guide
|
|
15
|
+
3. For each section 1-9:
|
|
16
|
+
a. get_prd_section_guide(N)
|
|
17
|
+
b. get_prd_section(N)
|
|
18
|
+
c. Follow conversation guide from overview
|
|
19
|
+
d. save_prd_section(N, content) after user confirmation
|
|
20
|
+
5. export_prd_markdown() for final output
|
|
21
|
+
</WORKFLOW>
|
|
22
|
+
|
|
23
|
+
<RULES>
|
|
24
|
+
- MUST call get_prd_overview() first to get detailed conversation guide
|
|
25
|
+
- NEVER generate multiple sections at once
|
|
26
|
+
- NEVER proceed without user confirmation
|
|
27
|
+
</RULES>`,
|
|
28
|
+
});
|
|
29
|
+
const tc = new TemplateController(new TemplateService());
|
|
30
|
+
const dc = new DocumentController(new DocumentService());
|
|
31
|
+
// Template tools
|
|
32
|
+
server.tool("get_prd_overview", "Get the PRD template overview with all section descriptions. IMPORTANT: After calling this, you MUST call get_prd_section_guide(1) to start the interactive Q&A process.", {}, () => ({
|
|
33
|
+
content: [{ type: "text", text: tc.getPrdOverview() }],
|
|
34
|
+
}));
|
|
35
|
+
server.tool("list_prd_sections", "List all available PRD template sections.", {}, () => ({
|
|
36
|
+
content: [{ type: "text", text: JSON.stringify(tc.listPrdSections()) }],
|
|
37
|
+
}));
|
|
38
|
+
server.tool("get_prd_section", "Get a specific PRD template section by number.", {
|
|
39
|
+
section: z.number().min(1).max(9).describe("Section number (1-9)"),
|
|
40
|
+
include_examples: z.boolean().default(false).describe("Include example content"),
|
|
41
|
+
}, ({ section, include_examples }) => ({
|
|
42
|
+
content: [{ type: "text", text: tc.getPrdSection(section, include_examples) }],
|
|
43
|
+
}));
|
|
44
|
+
server.tool("get_prd_full_template", "Get the complete PRD template with all sections combined.", { include_examples: z.boolean().default(false).describe("Include example content") }, ({ include_examples }) => ({
|
|
45
|
+
content: [{ type: "text", text: tc.getPrdFullTemplate(include_examples) }],
|
|
46
|
+
}));
|
|
47
|
+
server.tool("get_prd_section_guide", "Get conversation guide for writing a specific PRD section. Use this before starting each section.", { section: z.number().min(1).max(9).describe("Section number (1-9)") }, ({ section }) => ({
|
|
48
|
+
content: [{ type: "text", text: tc.getPrdSectionGuide(section) }],
|
|
49
|
+
}));
|
|
50
|
+
// Document tools
|
|
51
|
+
server.tool("init_prd_document", "Initialize a new PRD document file.", {
|
|
52
|
+
project_name: z.string().describe("Name of the project"),
|
|
53
|
+
output_path: z
|
|
54
|
+
.string()
|
|
55
|
+
.describe("File path for the document (e.g., ~/Documents/my-project.prd.xml)"),
|
|
56
|
+
}, ({ project_name, output_path }) => ({
|
|
57
|
+
content: [{ type: "text", text: dc.initPrdDocument(project_name, output_path) }],
|
|
58
|
+
}));
|
|
59
|
+
server.tool("load_prd_document", `Load an existing PRD document to resume editing.
|
|
60
|
+
⚠️ CRITICAL: After loading, you MUST follow the conversation guide:
|
|
61
|
+
1. Call get_prd_section_guide(N) for the section you want to work on
|
|
62
|
+
2. Ask 1-2 focused questions at a time - DO NOT auto-generate content
|
|
63
|
+
3. Wait for user response before proceeding
|
|
64
|
+
4. Get explicit confirmation before saving each section`, { doc_path: z.string().describe("Path to the .prd.xml file") }, ({ doc_path }) => ({
|
|
65
|
+
content: [{ type: "text", text: dc.loadPrdDocument(doc_path) }],
|
|
66
|
+
}));
|
|
67
|
+
server.tool("save_prd_section", `Save content to a subsection in the PRD document.
|
|
68
|
+
⚠️ BEFORE CALLING THIS TOOL:
|
|
69
|
+
1. 작성 완료된 내용을 사용자에게 먼저 출력하세요
|
|
70
|
+
2. "수정할 내용이 있으신가요?" 라고 확인을 요청하세요
|
|
71
|
+
3. 사용자가 확인한 후에만 이 도구를 호출하세요`, {
|
|
72
|
+
section: z.number().min(1).max(9).describe("Section number (1-9)"),
|
|
73
|
+
subsection_id: z.string().describe('Subsection ID (e.g., "1" for X.1, "1.2" for X.1.2)'),
|
|
74
|
+
title: z.string().describe("Title of the subsection"),
|
|
75
|
+
content: z.string().describe("Content for the subsection (markdown)"),
|
|
76
|
+
}, ({ section, subsection_id, title, content }) => ({
|
|
77
|
+
content: [{ type: "text", text: dc.savePrdSection(section, subsection_id, title, content) }],
|
|
78
|
+
}));
|
|
79
|
+
server.tool("read_prd_section", "Read the current content of a section or subsection.", {
|
|
80
|
+
section: z.number().min(1).max(9).describe("Section number (1-9)"),
|
|
81
|
+
subsection_id: z
|
|
82
|
+
.string()
|
|
83
|
+
.optional()
|
|
84
|
+
.describe('Subsection ID (e.g., "1" for X.1). If omitted, returns entire section.'),
|
|
85
|
+
}, ({ section, subsection_id }) => ({
|
|
86
|
+
content: [{ type: "text", text: dc.readPrdSection(section, subsection_id) }],
|
|
87
|
+
}));
|
|
88
|
+
server.tool("get_prd_document_status", "Get the status of all sections in the current document.", {}, () => ({
|
|
89
|
+
content: [{ type: "text", text: dc.getPrdDocumentStatus() }],
|
|
90
|
+
}));
|
|
91
|
+
server.tool("export_prd_markdown", "Export the PRD document as clean markdown.", {
|
|
92
|
+
output_path: z
|
|
93
|
+
.string()
|
|
94
|
+
.optional()
|
|
95
|
+
.describe("Optional output file path. If not provided, returns the content."),
|
|
96
|
+
}, ({ output_path }) => ({
|
|
97
|
+
content: [{ type: "text", text: dc.exportPrdMarkdown(output_path) }],
|
|
98
|
+
}));
|
|
99
|
+
async function main() {
|
|
100
|
+
const transport = new StdioServerTransport();
|
|
101
|
+
await server.connect(transport);
|
|
102
|
+
}
|
|
103
|
+
main().catch(console.error);
|