@makerkit/prd-mcp 0.0.0-stage → 0.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.
@@ -0,0 +1,11 @@
1
+ $ tsdown && node ../../scripts/prepare-dist.mjs
2
+ ℹ tsdown v0.23.0 powered by rolldown v1.2.13
3
+ ℹ config file: /Users/giancarlo/Code/makerkit/packages/prd-mcp/tsdown.config.mts
4
+ ℹ entry: src/bin.ts
5
+ ℹ tsconfig: tsconfig.json
6
+ ℹ Build start
7
+ ℹ Cleaning 4 files
8
+ ℹ Granting execute permission to dist/bin.mjs
9
+ ℹ dist/bin.mjs 1.50 kB │ gzip: 0.74 kB
10
+ ℹ 1 files, total: 1.50 kB
11
+ ✔ Build complete in 12ms
@@ -0,0 +1,11 @@
1
+ $ vitest run
2
+
3
+  RUN  v5.0.4 /Users/giancarlo/Code/makerkit/packages/prd-mcp
4
+
5
+ ✓ src/bin.test.ts (3 tests) 328ms
6
+
7
+  Test Files  1 passed (1)
8
+  Tests  3 passed (3)
9
+  Start at  23:31:32
10
+  Duration  480ms (tests 78%, import 19%, transform 3%)
11
+
@@ -0,0 +1 @@
1
+ $ tsc --noEmit -p tsconfig.json
package/README.md CHANGED
@@ -1,3 +1,34 @@
1
- # Temporary Holding Version
1
+ # @makerkit/prd-mcp
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ An MCP server for the structured PRDs in `.prds/` (format and rules: [`@makerkit/prd`](../prd)). It lets coding agents read and update PRDs and stories, follow the story workflow, and leave hand-off logs for the next story.
4
+
5
+ ## Use with an agent
6
+
7
+ Claude Code:
8
+
9
+ ```bash
10
+ claude mcp add prd -- npx -y @makerkit/prd-mcp
11
+ ```
12
+
13
+ Any MCP client (stdio):
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "prd": { "command": "npx", "args": ["-y", "@makerkit/prd-mcp"] }
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Options
24
+
25
+ ```
26
+ makerkit-prd-mcp [--root <dir>] [--check <script>]...
27
+ ```
28
+
29
+ - `--root`: project directory (default: current directory). PRDs live in `<root>/.prds`.
30
+ - `--check`: a `package.json` script that must pass before a story can be marked completed. Repeat for several. Default: `typecheck` and `lint` (scripts the project does not have are skipped).
31
+
32
+ ## License
33
+
34
+ MIT
package/dist/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023-present Makerkit
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/dist/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # @makerkit/prd-mcp
2
+
3
+ An MCP server for the structured PRDs in `.prds/` (format and rules: [`@makerkit/prd`](../prd)). It lets coding agents read and update PRDs and stories, follow the story workflow, and leave hand-off logs for the next story.
4
+
5
+ ## Use with an agent
6
+
7
+ Claude Code:
8
+
9
+ ```bash
10
+ claude mcp add prd -- npx -y @makerkit/prd-mcp
11
+ ```
12
+
13
+ Any MCP client (stdio):
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "prd": { "command": "npx", "args": ["-y", "@makerkit/prd-mcp"] }
19
+ }
20
+ }
21
+ ```
22
+
23
+ ## Options
24
+
25
+ ```
26
+ makerkit-prd-mcp [--root <dir>] [--check <script>]...
27
+ ```
28
+
29
+ - `--root`: project directory (default: current directory). PRDs live in `<root>/.prds`.
30
+ - `--check`: a `package.json` script that must pass before a story can be marked completed. Repeat for several. Default: `typecheck` and `lint` (scripts the project does not have are skipped).
31
+
32
+ ## License
33
+
34
+ MIT
package/dist/bin.mjs ADDED
@@ -0,0 +1,44 @@
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 { createPrdService } from "@makerkit/prd";
5
+ import { registerPRDTools } from "@makerkit/prd/mcp";
6
+ import { createNodePrdDeps, createScriptVerifier } from "@makerkit/prd/node";
7
+ import { readFileSync } from "node:fs";
8
+ import { resolve } from "node:path";
9
+ import { parseArgs } from "node:util";
10
+ //#region src/bin.ts
11
+ const HELP = `Usage: makerkit-prd-mcp [--root <dir>] [--check <script>]...
12
+
13
+ Serves the PRDs in <dir>/.prds over MCP (stdio).
14
+
15
+ --root Project directory. Defaults to the current directory.
16
+ --check package.json script that must pass before a story is completed.
17
+ Repeat for several. Defaults to typecheck and lint.
18
+ `;
19
+ const { values } = parseArgs({ options: {
20
+ root: { type: "string" },
21
+ check: {
22
+ type: "string",
23
+ multiple: true
24
+ },
25
+ help: {
26
+ type: "boolean",
27
+ short: "h"
28
+ }
29
+ } });
30
+ if (values.help) {
31
+ process.stdout.write(HELP);
32
+ process.exit(0);
33
+ }
34
+ const root = resolve(values.root ?? process.cwd());
35
+ const deps = createNodePrdDeps(root, { verifyCompletion: createScriptVerifier(root, values.check) });
36
+ const { version } = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8"));
37
+ const server = new McpServer({
38
+ name: "makerkit-prd",
39
+ version
40
+ });
41
+ registerPRDTools(server, createPrdService(deps));
42
+ await server.connect(new StdioServerTransport());
43
+ //#endregion
44
+ export {};
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@makerkit/prd-mcp",
3
+ "version": "0.0.0",
4
+ "description": "MCP server for structured PRDs in .prds/. Lets Claude Code, Codex, OpenCode and other agents read and update PRDs and stories.",
5
+ "keywords": [
6
+ "ai-agents",
7
+ "claude-code",
8
+ "codex",
9
+ "mcp",
10
+ "opencode",
11
+ "prd"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/makerkit/makerkit",
17
+ "directory": "packages/prd-mcp"
18
+ },
19
+ "bin": {
20
+ "makerkit-prd-mcp": "./bin.mjs"
21
+ },
22
+ "type": "module",
23
+ "dependencies": {
24
+ "@makerkit/prd": "^0.0.0",
25
+ "@modelcontextprotocol/sdk": "^1.32.0"
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@makerkit/prd-mcp",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.0",
4
+ "description": "MCP server for structured PRDs in .prds/. Lets Claude Code, Codex, OpenCode and other agents read and update PRDs and stories.",
5
+ "keywords": [
6
+ "ai-agents",
7
+ "claude-code",
8
+ "codex",
9
+ "mcp",
10
+ "opencode",
11
+ "prd"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "https://github.com/makerkit/makerkit",
17
+ "directory": "packages/prd-mcp"
18
+ },
19
+ "bin": {
20
+ "makerkit-prd-mcp": "./bin.mjs"
21
+ },
22
+ "type": "module",
23
+ "publishConfig": {
24
+ "access": "public",
25
+ "directory": "dist"
26
+ },
27
+ "scripts": {
28
+ "build": "tsdown && node ../../scripts/prepare-dist.mjs",
29
+ "typecheck": "tsc --noEmit -p tsconfig.json",
30
+ "test": "vitest run"
31
+ },
32
+ "dependencies": {
33
+ "@makerkit/prd": "workspace:^",
34
+ "@modelcontextprotocol/sdk": "^1.32.0"
35
+ },
36
+ "devDependencies": {
37
+ "@types/node": "catalog:",
38
+ "tsdown": "catalog:",
39
+ "typescript": "catalog:",
40
+ "vite": "catalog:",
41
+ "vitest": "catalog:",
42
+ "zod": "catalog:"
43
+ }
44
+ }
@@ -0,0 +1,99 @@
1
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
3
+ import { afterEach, describe, expect, it } from 'vitest';
4
+
5
+ import { mkdtemp, readFile, rm } from 'node:fs/promises';
6
+ import { tmpdir } from 'node:os';
7
+ import { join } from 'node:path';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ // Runs the built command, so this checks what npm users will execute.
11
+ const BIN = fileURLToPath(new URL('../dist/bin.mjs', import.meta.url));
12
+
13
+ const cleanups: Array<() => Promise<void>> = [];
14
+
15
+ afterEach(async () => {
16
+ await Promise.all(cleanups.splice(0).map((cleanup) => cleanup()));
17
+ });
18
+
19
+ async function connect() {
20
+ const root = await mkdtemp(join(tmpdir(), 'makerkit-prd-mcp-'));
21
+ const client = new Client({ name: 'test', version: '1.0.0' });
22
+
23
+ await client.connect(
24
+ new StdioClientTransport({
25
+ command: process.execPath,
26
+ args: [BIN, '--root', root],
27
+ }),
28
+ );
29
+
30
+ cleanups.push(async () => {
31
+ await client.close();
32
+ await rm(root, { recursive: true, force: true });
33
+ });
34
+
35
+ return { client, root };
36
+ }
37
+
38
+ describe('makerkit-prd-mcp', () => {
39
+ it('serves the PRD tools and prompts', async () => {
40
+ const { client } = await connect();
41
+
42
+ const { tools } = await client.listTools();
43
+ const { prompts } = await client.listPrompts();
44
+
45
+ expect(tools).toHaveLength(31);
46
+ expect(tools.map((tool) => tool.name)).toEqual(
47
+ expect.arrayContaining([
48
+ 'add_attachment',
49
+ 'create_prd',
50
+ 'get_next_story',
51
+ 'update_prd_section',
52
+ ]),
53
+ );
54
+ expect(prompts.map((prompt) => prompt.name).sort()).toEqual([
55
+ 'implement_story',
56
+ 'review_story',
57
+ 'shape_prd',
58
+ ]);
59
+ });
60
+
61
+ it('writes PRDs into <root>/.prds', async () => {
62
+ const { client, root } = await connect();
63
+
64
+ const result = await client.callTool({
65
+ name: 'create_prd',
66
+ arguments: {
67
+ title: 'Simple CRM',
68
+ overview: 'Contacts and deals',
69
+ problemStatement: 'Spreadsheets lose context',
70
+ marketOpportunity: 'Internal tool',
71
+ targetUsers: ['Founder'],
72
+ solutionDescription: 'Contacts, deals and a pipeline',
73
+ keyFeatures: ['Contacts'],
74
+ successMetrics: ['Every deal has a next step'],
75
+ },
76
+ });
77
+
78
+ expect(result.isError).toBeFalsy();
79
+
80
+ const { filename } = result.structuredContent as { filename: string };
81
+ const prd = JSON.parse(
82
+ await readFile(join(root, '.prds', filename), 'utf8'),
83
+ );
84
+
85
+ expect(prd.introduction.title).toBe('Simple CRM');
86
+ });
87
+
88
+ it('returns tool errors instead of crashing', async () => {
89
+ const { client } = await connect();
90
+
91
+ const result = await client.callTool({
92
+ name: 'get_prd',
93
+ arguments: { filename: 'missing.json' },
94
+ });
95
+
96
+ expect(result.isError).toBe(true);
97
+ expect(JSON.stringify(result.content)).toContain('not found');
98
+ });
99
+ });
package/src/bin.ts ADDED
@@ -0,0 +1,49 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
+
5
+ import { createPrdService } from '@makerkit/prd';
6
+ import { registerPRDTools } from '@makerkit/prd/mcp';
7
+ import { createNodePrdDeps, createScriptVerifier } from '@makerkit/prd/node';
8
+
9
+ import { readFileSync } from 'node:fs';
10
+ import { resolve } from 'node:path';
11
+ import { parseArgs } from 'node:util';
12
+
13
+ const HELP = `Usage: makerkit-prd-mcp [--root <dir>] [--check <script>]...
14
+
15
+ Serves the PRDs in <dir>/.prds over MCP (stdio).
16
+
17
+ --root Project directory. Defaults to the current directory.
18
+ --check package.json script that must pass before a story is completed.
19
+ Repeat for several. Defaults to typecheck and lint.
20
+ `;
21
+
22
+ const { values } = parseArgs({
23
+ options: {
24
+ root: { type: 'string' },
25
+ check: { type: 'string', multiple: true },
26
+ help: { type: 'boolean', short: 'h' },
27
+ },
28
+ });
29
+
30
+ if (values.help) {
31
+ process.stdout.write(HELP);
32
+ process.exit(0);
33
+ }
34
+
35
+ const root = resolve(values.root ?? process.cwd());
36
+
37
+ const deps = createNodePrdDeps(root, {
38
+ verifyCompletion: createScriptVerifier(root, values.check),
39
+ });
40
+
41
+ const { version } = JSON.parse(
42
+ readFileSync(new URL('./package.json', import.meta.url), 'utf8'),
43
+ ) as { version: string };
44
+
45
+ const server = new McpServer({ name: 'makerkit-prd', version });
46
+
47
+ registerPRDTools(server, createPrdService(deps));
48
+
49
+ await server.connect(new StdioServerTransport());
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "strict": true,
5
+ "target": "es2022",
6
+ "lib": ["es2022"],
7
+ "types": ["node", "vitest/globals"]
8
+ },
9
+ "include": ["src/**/*.ts", "*.mts"]
10
+ }
@@ -0,0 +1,11 @@
1
+ import { defineConfig } from 'tsdown';
2
+
3
+ export default defineConfig({
4
+ entry: { bin: 'src/bin.ts' },
5
+ outDir: 'dist',
6
+ platform: 'node',
7
+ format: 'esm',
8
+ dts: false,
9
+ clean: true,
10
+ outExtensions: () => ({ js: '.mjs' }),
11
+ });
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ include: ['src/**/*.test.ts'],
6
+ testTimeout: 20_000,
7
+ },
8
+ });