@hvgllc/hvgerp-mcp 3.0.1 → 3.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/hvgerp-mcp.mjs +38 -0
- package/package.json +1 -1
package/hvgerp-mcp.mjs
CHANGED
|
@@ -49631,6 +49631,43 @@ function loadMrtrConfig() {
|
|
|
49631
49631
|
return { signingKey };
|
|
49632
49632
|
}
|
|
49633
49633
|
|
|
49634
|
+
// src/claude-code-stdio-compat.ts
|
|
49635
|
+
var LIST_RESULT_ARRAY_KEYS = ["tools", "resources", "prompts"];
|
|
49636
|
+
function stampMissingResultType(line) {
|
|
49637
|
+
const hasTrailingNewline = line.endsWith("\n");
|
|
49638
|
+
const trimmed = hasTrailingNewline ? line.slice(0, -1) : line;
|
|
49639
|
+
let message2;
|
|
49640
|
+
try {
|
|
49641
|
+
message2 = JSON.parse(trimmed);
|
|
49642
|
+
} catch {
|
|
49643
|
+
return line;
|
|
49644
|
+
}
|
|
49645
|
+
if (!message2 || typeof message2 !== "object" || !("result" in message2)) {
|
|
49646
|
+
return line;
|
|
49647
|
+
}
|
|
49648
|
+
const result = message2.result;
|
|
49649
|
+
if (!result || typeof result !== "object" || Array.isArray(result) || "resultType" in result) {
|
|
49650
|
+
return line;
|
|
49651
|
+
}
|
|
49652
|
+
const record2 = result;
|
|
49653
|
+
const isListResult = LIST_RESULT_ARRAY_KEYS.some(
|
|
49654
|
+
(key) => Array.isArray(record2[key])
|
|
49655
|
+
);
|
|
49656
|
+
if (!isListResult) return line;
|
|
49657
|
+
record2.resultType = "complete";
|
|
49658
|
+
return JSON.stringify(message2) + (hasTrailingNewline ? "\n" : "");
|
|
49659
|
+
}
|
|
49660
|
+
function installClaudeCodeStdioCompat() {
|
|
49661
|
+
const stdout = process.stdout;
|
|
49662
|
+
if (stdout.__claudeCodeStdioCompatInstalled) return;
|
|
49663
|
+
const originalWrite = stdout.write.bind(stdout);
|
|
49664
|
+
stdout.write = (chunk, ...rest) => {
|
|
49665
|
+
const patched = typeof chunk === "string" ? stampMissingResultType(chunk) : chunk;
|
|
49666
|
+
return originalWrite(patched, ...rest);
|
|
49667
|
+
};
|
|
49668
|
+
stdout.__claudeCodeStdioCompatInstalled = true;
|
|
49669
|
+
}
|
|
49670
|
+
|
|
49634
49671
|
// server.ts
|
|
49635
49672
|
var DEFAULT_HTTP_PORT = 3012;
|
|
49636
49673
|
async function main() {
|
|
@@ -49755,6 +49792,7 @@ async function main() {
|
|
|
49755
49792
|
}
|
|
49756
49793
|
});
|
|
49757
49794
|
} else {
|
|
49795
|
+
installClaudeCodeStdioCompat();
|
|
49758
49796
|
await server.start();
|
|
49759
49797
|
console.error("[hvgerp-mcp] stdio mode ready");
|
|
49760
49798
|
}
|