testchimp-mcp-client 0.0.1 → 0.0.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/README.md +18 -2
- package/dist/index.js +53 -20
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,11 +13,24 @@ MCP (Model Context Protocol) server for [TestChimp](https://testchimp.io). Expos
|
|
|
13
13
|
|
|
14
14
|
- **`get_requirement_coverage`** — POST `/api/mcp/list_requirement_coverage` (scenario / requirement coverage scoped by platform-rooted `scope.folderPath` under **`tests/...`** or **`plans/...`**).
|
|
15
15
|
- **`get_execution_history`** — POST `/api/mcp/list_execution_history`.
|
|
16
|
-
- **`
|
|
16
|
+
- **`create_user_story`** — POST `/api/mcp/create_user_story` (`platformFilePath` under `plans/stories/...`, `title`).
|
|
17
|
+
- **`create_test_scenario`** — POST `/api/mcp/create_test_scenario` (`platformFilePath` under `plans/scenarios/...`, `title`, `userStoryOrdinalId`).
|
|
18
|
+
- **`update_user_story`** — POST `/api/mcp/update_user_story` (full markdown `content` with `id: US-...` in frontmatter).
|
|
19
|
+
- **`update_test_scenario`** — POST `/api/mcp/update_test_scenario` (full markdown `content` with `id: TS-...` and `story: US-...` in frontmatter).
|
|
17
20
|
|
|
18
21
|
## Cursor
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
**Install only at project level.** TestChimp API keys are **scoped to a TestChimp project**; the MCP server must use the key for **the repo you have open**. Do **not** add this server to **IDE-wide** MCP config (`~/.cursor/mcp.json` or global Cursor MCP settings): you risk using the wrong key when switching workspaces, and agents may target the wrong backend project.
|
|
24
|
+
|
|
25
|
+
**For humans and AI agents:** create or edit **`<project-root>/.cursor/mcp.json`** in the repository you are working in (the folder Cursor has open as the workspace root). That path is **`.cursor/mcp.json` relative to the project root**, not under your home directory.
|
|
26
|
+
|
|
27
|
+
The MCP server reads **`TESTCHIMP_API_KEY`** and **`TESTCHIMP_BACKEND_URL`** from **`process.env`** — it does not read `mcp.json` directly. Cursor starts the server as a **child process**; variables must be present in **that** process’s environment.
|
|
28
|
+
|
|
29
|
+
**Why `mcp.json` uses an `env` block:** If you open Cursor from the Dock, Spotlight, or similar, it usually does **not** load your shell profile (`.zshrc`, etc.), so values you only `export` in a terminal may **not** reach the MCP server. The `env` object next to `command` / `args` is the reliable way Cursor injects variables into the MCP process. (Cursor’s `mcp.json` does **not** expand `$VAR` / `${VAR}` from your shell; use literal values in `env`, or a wrapper that loads a `.env` file before starting the server.)
|
|
30
|
+
|
|
31
|
+
### Project `mcp.json` example
|
|
32
|
+
|
|
33
|
+
`<project-root>/.cursor/mcp.json`:
|
|
21
34
|
|
|
22
35
|
```json
|
|
23
36
|
{
|
|
@@ -34,6 +47,9 @@ Add to MCP config (e.g. `~/.cursor/mcp.json`):
|
|
|
34
47
|
}
|
|
35
48
|
```
|
|
36
49
|
|
|
50
|
+
- **Do not commit secrets:** Add `.cursor/mcp.json` to **`.gitignore`** if it contains real keys, or keep only a committed `.cursor/mcp.json.example` with placeholders and document that each developer maintains a local ignored file.
|
|
51
|
+
- **After changing env or config:** Restart the MCP server or reload MCP / restart Cursor so the new environment is picked up.
|
|
52
|
+
|
|
37
53
|
For a published npm package name, adjust `args` to your scope (e.g. `@testchimp/mcp-client`) after publish.
|
|
38
54
|
|
|
39
55
|
## Scope path format
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ function getBackendUrl() {
|
|
|
16
16
|
function requireApiKey() {
|
|
17
17
|
const k = process.env.TESTCHIMP_API_KEY?.trim();
|
|
18
18
|
if (!k) {
|
|
19
|
-
throw new Error("TESTCHIMP_API_KEY is required. Set it in
|
|
19
|
+
throw new Error("TESTCHIMP_API_KEY is required. Set it in <project>/.cursor/mcp.json env (project-level MCP config), not IDE-wide config.");
|
|
20
20
|
}
|
|
21
21
|
return k;
|
|
22
22
|
}
|
|
@@ -59,11 +59,20 @@ const listExecutionInput = z.object({
|
|
|
59
59
|
scope: scopeSchema,
|
|
60
60
|
branchName: z.string().optional(),
|
|
61
61
|
});
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
62
|
+
/** Platform path to the new markdown file, e.g. plans/stories/auth/login-flow.md */
|
|
63
|
+
const createUserStoryInput = z.object({
|
|
64
|
+
platformFilePath: z.string().min(1),
|
|
65
|
+
title: z.string().min(1),
|
|
66
|
+
});
|
|
67
|
+
const createTestScenarioInput = z.object({
|
|
68
|
+
platformFilePath: z.string().min(1),
|
|
69
|
+
title: z.string().min(1),
|
|
70
|
+
/** Parent story ordinal (the number n in US-n). */
|
|
71
|
+
userStoryOrdinalId: z.coerce.number().int().positive(),
|
|
72
|
+
});
|
|
73
|
+
const updatePlanMarkdownInput = z.object({
|
|
74
|
+
/** Full markdown including YAML frontmatter and body (as written under the repo plans root). */
|
|
75
|
+
content: z.string().min(1),
|
|
67
76
|
});
|
|
68
77
|
function textResult(json) {
|
|
69
78
|
return {
|
|
@@ -133,21 +142,45 @@ async function main() {
|
|
|
133
142
|
const json = await postMcp("/api/mcp/list_execution_history", body);
|
|
134
143
|
return textResult(json);
|
|
135
144
|
});
|
|
136
|
-
server.registerTool("
|
|
137
|
-
description: "
|
|
138
|
-
|
|
145
|
+
server.registerTool("create_user_story", {
|
|
146
|
+
description: "Create a user story on the TestChimp project and its plan file stub. " +
|
|
147
|
+
"Always call this before writing a new story markdown file; use the returned ordinalId as US-<ordinalId> in frontmatter. " +
|
|
148
|
+
"platformFilePath must be under plans/stories/ and end with .md.",
|
|
149
|
+
inputSchema: createUserStoryInput,
|
|
139
150
|
}, async (args) => {
|
|
140
|
-
const
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
+
const json = await postMcp("/api/mcp/create_user_story", {
|
|
152
|
+
platformFilePath: args.platformFilePath,
|
|
153
|
+
title: args.title,
|
|
154
|
+
});
|
|
155
|
+
return textResult(json);
|
|
156
|
+
});
|
|
157
|
+
server.registerTool("create_test_scenario", {
|
|
158
|
+
description: "Create a test scenario linked to a user story. Call after the parent story exists. " +
|
|
159
|
+
"platformFilePath must be under plans/scenarios/ and end with .md. " +
|
|
160
|
+
"userStoryOrdinalId is the numeric part of the parent US-<n> id.",
|
|
161
|
+
inputSchema: createTestScenarioInput,
|
|
162
|
+
}, async (args) => {
|
|
163
|
+
const json = await postMcp("/api/mcp/create_test_scenario", {
|
|
164
|
+
platformFilePath: args.platformFilePath,
|
|
165
|
+
title: args.title,
|
|
166
|
+
userStoryOrdinalId: args.userStoryOrdinalId,
|
|
167
|
+
});
|
|
168
|
+
return textResult(json);
|
|
169
|
+
});
|
|
170
|
+
server.registerTool("update_user_story", {
|
|
171
|
+
description: "Sync a user story markdown file to the platform after local edits. " +
|
|
172
|
+
"Parses frontmatter (id: US-..., title, priority, status) and updates the linked support file and entity.",
|
|
173
|
+
inputSchema: updatePlanMarkdownInput,
|
|
174
|
+
}, async (args) => {
|
|
175
|
+
const json = await postMcp("/api/mcp/update_user_story", { content: args.content });
|
|
176
|
+
return textResult(json);
|
|
177
|
+
});
|
|
178
|
+
server.registerTool("update_test_scenario", {
|
|
179
|
+
description: "Sync a test scenario markdown file to the platform after local edits. " +
|
|
180
|
+
"Parses frontmatter (id: TS-..., story: US-..., title, priority, status) and updates linking if story changes.",
|
|
181
|
+
inputSchema: updatePlanMarkdownInput,
|
|
182
|
+
}, async (args) => {
|
|
183
|
+
const json = await postMcp("/api/mcp/update_test_scenario", { content: args.content });
|
|
151
184
|
return textResult(json);
|
|
152
185
|
});
|
|
153
186
|
const transport = new StdioServerTransport();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testchimp-mcp-client",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "MCP server for TestChimp —
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "MCP server for TestChimp — coverage, execution history, and plan authoring",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|