@puppetry.com/sdk 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/README.md +372 -0
- package/dist/chunk-IP47SEN7.mjs +1638 -0
- package/dist/chunk-QK5VPBL7.mjs +1500 -0
- package/dist/index.d.mts +1105 -0
- package/dist/index.d.ts +1105 -0
- package/dist/index.js +3163 -0
- package/dist/index.mjs +28 -0
- package/dist/mcp-ChYQVbVe.d.mts +947 -0
- package/dist/mcp-ChYQVbVe.d.ts +947 -0
- package/dist/mcp-stdio.d.mts +1 -0
- package/dist/mcp-stdio.d.ts +1 -0
- package/dist/mcp-stdio.js +3174 -0
- package/dist/mcp-stdio.mjs +65 -0
- package/dist/mcp.d.mts +1 -0
- package/dist/mcp.d.ts +1 -0
- package/dist/mcp.js +1451 -0
- package/dist/mcp.mjs +6 -0
- package/package.json +61 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
Puppetry
|
|
4
|
+
} from "./chunk-IP47SEN7.mjs";
|
|
5
|
+
import {
|
|
6
|
+
handlePuppetryMcpRequest
|
|
7
|
+
} from "./chunk-QK5VPBL7.mjs";
|
|
8
|
+
|
|
9
|
+
// src/mcp-stdio.ts
|
|
10
|
+
import { Buffer } from "buffer";
|
|
11
|
+
import process from "process";
|
|
12
|
+
var apiKey = process.env.PUPPETRY_API_KEY;
|
|
13
|
+
if (!apiKey) {
|
|
14
|
+
process.stderr.write("PUPPETRY_API_KEY is required to run puppetry-mcp.\n");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
var client = new Puppetry({
|
|
18
|
+
apiKey,
|
|
19
|
+
baseUrl: process.env.PUPPETRY_BASE_URL
|
|
20
|
+
});
|
|
21
|
+
var input = Buffer.alloc(0);
|
|
22
|
+
var queue = Promise.resolve();
|
|
23
|
+
process.stdin.on("data", (chunk) => {
|
|
24
|
+
input = Buffer.concat([input, chunk]);
|
|
25
|
+
queue = queue.then(processMessages).catch((err) => {
|
|
26
|
+
process.stderr.write(
|
|
27
|
+
`Failed to process Puppetry MCP request: ${err instanceof Error ? err.message : String(err)}
|
|
28
|
+
`
|
|
29
|
+
);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
process.stdin.resume();
|
|
33
|
+
async function processMessages() {
|
|
34
|
+
while (true) {
|
|
35
|
+
const frame = readFrame();
|
|
36
|
+
if (!frame) return;
|
|
37
|
+
const request = JSON.parse(frame);
|
|
38
|
+
const response = await handlePuppetryMcpRequest(client, request);
|
|
39
|
+
if (response) writeFrame(response);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function readFrame() {
|
|
43
|
+
const headerEnd = input.indexOf("\r\n\r\n");
|
|
44
|
+
if (headerEnd === -1) return null;
|
|
45
|
+
const header = input.subarray(0, headerEnd).toString("utf8");
|
|
46
|
+
const match = /^Content-Length:\s*(\d+)$/im.exec(header);
|
|
47
|
+
if (!match) {
|
|
48
|
+
throw new Error("Missing Content-Length header");
|
|
49
|
+
}
|
|
50
|
+
const bodyStart = headerEnd + 4;
|
|
51
|
+
const bodyLength = Number(match[1]);
|
|
52
|
+
const totalLength = bodyStart + bodyLength;
|
|
53
|
+
if (input.length < totalLength) return null;
|
|
54
|
+
const body = input.subarray(bodyStart, totalLength).toString("utf8");
|
|
55
|
+
input = input.subarray(totalLength);
|
|
56
|
+
return body;
|
|
57
|
+
}
|
|
58
|
+
function writeFrame(message) {
|
|
59
|
+
const body = JSON.stringify(message);
|
|
60
|
+
process.stdout.write(
|
|
61
|
+
`Content-Length: ${Buffer.byteLength(body, "utf8")}\r
|
|
62
|
+
\r
|
|
63
|
+
${body}`
|
|
64
|
+
);
|
|
65
|
+
}
|
package/dist/mcp.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { J as JsonRpcErrorResponse, k as JsonRpcId, l as JsonRpcRequest, m as JsonRpcResponse, n as JsonRpcSuccessResponse, s as PuppetryMcpServerInfo, F as handlePuppetryMcpRequest } from './mcp-ChYQVbVe.mjs';
|
package/dist/mcp.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { J as JsonRpcErrorResponse, k as JsonRpcId, l as JsonRpcRequest, m as JsonRpcResponse, n as JsonRpcSuccessResponse, s as PuppetryMcpServerInfo, F as handlePuppetryMcpRequest } from './mcp-ChYQVbVe.js';
|