kojee-mcp 0.2.2 → 0.5.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 +151 -7
- package/dist/chunk-BJMASMKX.js +41 -0
- package/dist/chunk-E26AHU6J.js +27 -0
- package/dist/chunk-GBOTBYEP.js +34 -0
- package/dist/{chunk-QKAUM3TR.js → chunk-LCFCCWMM.js} +359 -74
- package/dist/chunk-LSUB6QMP.js +75 -0
- package/dist/chunk-QB22PD6T.js +358 -0
- package/dist/chunk-VLZADEFC.js +247 -0
- package/dist/chunk-W6YRLSD4.js +143 -0
- package/dist/cli.js +209 -17
- package/dist/doctor-GILTOH2R.js +222 -0
- package/dist/event-log-R6VW6GAF.js +17 -0
- package/dist/event-queue-5YVJFR3E.js +43 -0
- package/dist/hook-server-QF5JVUHV.js +99 -0
- package/dist/index.d.ts +0 -13
- package/dist/index.js +4 -1
- package/dist/install-D2HIPOMT.js +183 -0
- package/dist/paired-config-RB4SABOS.js +10 -0
- package/dist/resubscribe-SLZNA76S.js +59 -0
- package/dist/session-discovery-QE5TTAPS.js +26 -0
- package/dist/stop-hook-VLQS6QPR.js +118 -0
- package/dist/tail-stream-UZ42UIWO.js +161 -0
- package/dist/user-prompt-submit-hook-C42DPDBO.js +54 -0
- package/package.json +11 -13
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
readHookStdin
|
|
3
|
+
} from "./chunk-LSUB6QMP.js";
|
|
4
|
+
import {
|
|
5
|
+
deriveDiscoveryKey,
|
|
6
|
+
findClaudeAncestorPid
|
|
7
|
+
} from "./chunk-BJMASMKX.js";
|
|
8
|
+
import {
|
|
9
|
+
readSessionDiscoveryByKey
|
|
10
|
+
} from "./chunk-W6YRLSD4.js";
|
|
11
|
+
|
|
12
|
+
// src/hooks/user-prompt-submit-hook.ts
|
|
13
|
+
async function runUserPromptSubmitHook() {
|
|
14
|
+
await readHookStdin();
|
|
15
|
+
const ccPid = await findClaudeAncestorPid();
|
|
16
|
+
const key = deriveDiscoveryKey(process.env["CLAUDE_PROJECT_DIR"], ccPid);
|
|
17
|
+
const discovery = readSessionDiscoveryByKey(key);
|
|
18
|
+
if (!discovery) {
|
|
19
|
+
process.stdout.write("{}");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let body;
|
|
23
|
+
try {
|
|
24
|
+
const res = await fetch(`http://127.0.0.1:${discovery.port}/poll?type=user-prompt-submit&timeout_ms=0`);
|
|
25
|
+
if (!res.ok) {
|
|
26
|
+
process.stdout.write("{}");
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
body = await res.json();
|
|
30
|
+
} catch {
|
|
31
|
+
process.stdout.write("{}");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (body.count === 0) {
|
|
35
|
+
process.stdout.write("{}");
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
process.stdout.write(JSON.stringify({ additionalContext: formatEvents(body.events) }));
|
|
39
|
+
}
|
|
40
|
+
function formatEvents(events) {
|
|
41
|
+
const header = `[${events.length} unread Tandem ${events.length === 1 ? "event" : "events"}]
|
|
42
|
+
|
|
43
|
+
`;
|
|
44
|
+
const bodies = events.map((evt) => {
|
|
45
|
+
const attrs = Object.entries(evt.meta).map(([k, v]) => `${k}="${v}"`).join(" ");
|
|
46
|
+
return `<channel source="kojee-mcp" ${attrs}>
|
|
47
|
+
${evt.content}
|
|
48
|
+
</channel>`;
|
|
49
|
+
});
|
|
50
|
+
return header + bodies.join("\n\n");
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
runUserPromptSubmitHook
|
|
54
|
+
};
|
package/package.json
CHANGED
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kojee-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Local MCP proxy for Kojee — handles DPoP auth, tool discovery, and governance transparently",
|
|
3
|
+
"version": "0.5.0",
|
|
5
4
|
"type": "module",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
6
|
"bin": {
|
|
8
7
|
"kojee-mcp": "dist/cli.js"
|
|
9
8
|
},
|
|
9
|
+
"_buildNote": "src/version.ts resolves package.json via '../package.json' from import.meta.url; this assumes dist output stays flat one level under the package root (tsup default outDir=dist, no nesting). If the build adds outDir nesting or a deeper entry, update version.ts's relative path.",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsup src/cli.ts src/index.ts --format esm --dts --clean",
|
|
12
12
|
"dev": "tsup src/cli.ts --format esm --watch",
|
|
13
|
-
"typecheck": "tsc --noEmit"
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"dev:stub": "tsx dev-tools/stub-broker.ts"
|
|
14
17
|
},
|
|
15
18
|
"files": [
|
|
16
19
|
"dist"
|
|
17
20
|
],
|
|
18
|
-
"keywords": [
|
|
19
|
-
"mcp",
|
|
20
|
-
"kojee",
|
|
21
|
-
"ai-governance",
|
|
22
|
-
"agent-tools",
|
|
23
|
-
"dpop"
|
|
24
|
-
],
|
|
25
|
-
"license": "MIT",
|
|
26
21
|
"dependencies": {
|
|
27
22
|
"@modelcontextprotocol/sdk": "latest",
|
|
28
|
-
"jose": "^5.0.0",
|
|
29
23
|
"commander": "^12.0.0",
|
|
24
|
+
"jose": "^5.0.0",
|
|
25
|
+
"ps-list": "^8.1.1",
|
|
26
|
+
"ulidx": "^2.3.0",
|
|
30
27
|
"zod": "^3.22.0"
|
|
31
28
|
},
|
|
32
29
|
"devDependencies": {
|
|
33
|
-
"typescript": "^5.4.0",
|
|
34
30
|
"@types/node": "^20.0.0",
|
|
35
31
|
"tsup": "^8.0.0",
|
|
32
|
+
"tsx": "^4.7.0",
|
|
33
|
+
"typescript": "^5.4.0",
|
|
36
34
|
"vitest": "^1.0.0"
|
|
37
35
|
}
|
|
38
36
|
}
|