par5-mcp 0.1.1 → 0.2.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +18 -0
- package/dist/index.js +33 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.0](https://github.com/jrandolf/par5-mcp/compare/v0.1.2...v0.2.0) (2025-12-30)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* only return text
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* only return text ([0b73afd](https://github.com/jrandolf/par5-mcp/commit/0b73afdadcb71c583ea87958ef89e920d7517d8e))
|
|
13
|
+
|
|
14
|
+
## [0.1.2](https://github.com/jrandolf/par5-mcp/compare/v0.1.1...v0.1.2) (2025-12-30)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* add process cleanup on shutdown to manage active child processes ([68cbbbe](https://github.com/jrandolf/par5-mcp/commit/68cbbbec5188d9caba55bf17f8aa6a022e70cc17))
|
|
20
|
+
|
|
3
21
|
## [0.1.1](https://github.com/jrandolf/par5-mcp/compare/v0.1.0...v0.1.1) (2025-12-30)
|
|
4
22
|
|
|
5
23
|
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,29 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
8
8
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
9
|
import generatePassphrase from "eff-diceware-passphrase";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
+
// Track all active child processes for cleanup on shutdown
|
|
12
|
+
const activeProcesses = new Set();
|
|
13
|
+
// Cleanup function to kill all active child processes
|
|
14
|
+
function cleanupProcesses() {
|
|
15
|
+
for (const child of activeProcesses) {
|
|
16
|
+
if (!child.killed) {
|
|
17
|
+
child.kill("SIGTERM");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
activeProcesses.clear();
|
|
21
|
+
}
|
|
22
|
+
// Register shutdown handlers
|
|
23
|
+
process.on("SIGTERM", () => {
|
|
24
|
+
cleanupProcesses();
|
|
25
|
+
process.exit(0);
|
|
26
|
+
});
|
|
27
|
+
process.on("SIGINT", () => {
|
|
28
|
+
cleanupProcesses();
|
|
29
|
+
process.exit(0);
|
|
30
|
+
});
|
|
31
|
+
process.on("exit", () => {
|
|
32
|
+
cleanupProcesses();
|
|
33
|
+
});
|
|
11
34
|
// Helper to create a safe filename from an item string
|
|
12
35
|
function toSafeFilename(item) {
|
|
13
36
|
// Get basename if it's a path
|
|
@@ -29,6 +52,8 @@ function runCommandToFiles(command, stdoutFile, stderrFile, options = {}) {
|
|
|
29
52
|
const child = spawn("sh", ["-c", command], {
|
|
30
53
|
stdio: ["ignore", "pipe", "pipe"],
|
|
31
54
|
});
|
|
55
|
+
// Track the child process for cleanup on shutdown
|
|
56
|
+
activeProcesses.add(child);
|
|
32
57
|
let timeoutId;
|
|
33
58
|
if (options.timeout) {
|
|
34
59
|
timeoutId = setTimeout(() => {
|
|
@@ -38,6 +63,7 @@ function runCommandToFiles(command, stdoutFile, stderrFile, options = {}) {
|
|
|
38
63
|
child.stdout.pipe(stdoutStream);
|
|
39
64
|
child.stderr.pipe(stderrStream);
|
|
40
65
|
child.on("close", async () => {
|
|
66
|
+
activeProcesses.delete(child);
|
|
41
67
|
if (timeoutId)
|
|
42
68
|
clearTimeout(timeoutId);
|
|
43
69
|
stdoutStream.end();
|
|
@@ -47,6 +73,7 @@ function runCommandToFiles(command, stdoutFile, stderrFile, options = {}) {
|
|
|
47
73
|
resolve();
|
|
48
74
|
});
|
|
49
75
|
child.on("error", async (err) => {
|
|
76
|
+
activeProcesses.delete(child);
|
|
50
77
|
if (timeoutId)
|
|
51
78
|
clearTimeout(timeoutId);
|
|
52
79
|
stderrStream.write(`\nERROR: ${err.message}\n`);
|
|
@@ -149,6 +176,8 @@ WORKFLOW:
|
|
|
149
176
|
const child = spawn("sh", ["-c", command], {
|
|
150
177
|
stdio: ["ignore", "pipe", "pipe"],
|
|
151
178
|
});
|
|
179
|
+
// Track the child process for cleanup on shutdown
|
|
180
|
+
activeProcesses.add(child);
|
|
152
181
|
let stdout = "";
|
|
153
182
|
let stderr = "";
|
|
154
183
|
child.stdout.on("data", (data) => {
|
|
@@ -158,6 +187,7 @@ WORKFLOW:
|
|
|
158
187
|
stderr += data.toString();
|
|
159
188
|
});
|
|
160
189
|
child.on("close", (code) => {
|
|
190
|
+
activeProcesses.delete(child);
|
|
161
191
|
if (code !== 0 && stderr) {
|
|
162
192
|
resolve({
|
|
163
193
|
content: [
|
|
@@ -198,6 +228,7 @@ WORKFLOW:
|
|
|
198
228
|
});
|
|
199
229
|
});
|
|
200
230
|
child.on("error", (err) => {
|
|
231
|
+
activeProcesses.delete(child);
|
|
201
232
|
resolve({
|
|
202
233
|
content: [
|
|
203
234
|
{
|
|
@@ -518,12 +549,12 @@ VARIABLE SUBSTITUTION:
|
|
|
518
549
|
case "claude": {
|
|
519
550
|
// Claude Code CLI with --dangerously-skip-permissions and streaming output
|
|
520
551
|
const claudeArgs = process.env.PAR5_CLAUDE_ARGS || "";
|
|
521
|
-
return `claude --dangerously-skip-permissions --output-format
|
|
552
|
+
return `claude --dangerously-skip-permissions --output-format text --verbose ${agentArgs} ${claudeArgs} -p '${escapedPrompt}'`;
|
|
522
553
|
}
|
|
523
554
|
case "gemini": {
|
|
524
555
|
// Gemini CLI with yolo mode and streaming JSON output
|
|
525
556
|
const geminiArgs = process.env.PAR5_GEMINI_ARGS || "";
|
|
526
|
-
return `gemini --yolo --output-format
|
|
557
|
+
return `gemini --yolo --output-format text ${agentArgs} ${geminiArgs} '${escapedPrompt}'`;
|
|
527
558
|
}
|
|
528
559
|
case "codex": {
|
|
529
560
|
// Codex CLI exec subcommand with full-auto flag and JSON streaming output
|