@tightknitai/tightknit 0.1.0-alpha.1 → 0.1.0-alpha.3
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 +2 -2
- package/bin/tightknit-mcp.js +17 -9
- package/bin/tightknit.js +32 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ Add to your Claude Code MCP config (`.claude/settings.json` or `~/.claude.json`)
|
|
|
95
95
|
"mcpServers": {
|
|
96
96
|
"tightknit": {
|
|
97
97
|
"command": "npx",
|
|
98
|
-
"args": ["
|
|
98
|
+
"args": ["@tightknitai/tightknit@alpha", "mcp"],
|
|
99
99
|
"env": {
|
|
100
100
|
"TIGHTKNIT_API_KEY": "sk_your_key_here"
|
|
101
101
|
}
|
|
@@ -111,7 +111,7 @@ Or if installed locally in the monorepo:
|
|
|
111
111
|
"mcpServers": {
|
|
112
112
|
"tightknit": {
|
|
113
113
|
"command": "npx",
|
|
114
|
-
"args": ["tsx", "packages/tightknit-cli/
|
|
114
|
+
"args": ["tsx", "packages/tightknit-cli/bin/tightknit.ts", "mcp"],
|
|
115
115
|
"cwd": "/path/to/colombo",
|
|
116
116
|
"env": {
|
|
117
117
|
"TIGHTKNIT_API_KEY": "sk_your_key_here"
|
package/bin/tightknit-mcp.js
CHANGED
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { realpathSync, existsSync } from "node:fs";
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
7
|
+
const __filename = realpathSync(fileURLToPath(import.meta.url));
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
|
|
10
|
+
function findTsx() {
|
|
11
|
+
let dir = __dirname;
|
|
12
|
+
while (dir !== dirname(dir)) {
|
|
13
|
+
const candidate = join(dir, "node_modules", ".bin", "tsx");
|
|
14
|
+
if (existsSync(candidate)) return candidate;
|
|
15
|
+
dir = dirname(dir);
|
|
16
|
+
}
|
|
17
|
+
return "tsx";
|
|
18
|
+
}
|
|
9
19
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
});
|
|
20
|
+
const tsx = findTsx();
|
|
21
|
+
const script = join(__dirname, "..", "src", "mcp", "server.ts");
|
|
13
22
|
|
|
14
|
-
child
|
|
15
|
-
|
|
16
|
-
});
|
|
23
|
+
const child = spawn(tsx, [script], { stdio: "inherit" });
|
|
24
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
package/bin/tightknit.js
CHANGED
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
+
import { spawn, execFileSync } from "node:child_process";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
|
+
import { realpathSync, existsSync } from "node:fs";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
// Resolve symlinks to get the actual package directory
|
|
8
|
+
const __filename = realpathSync(fileURLToPath(import.meta.url));
|
|
9
|
+
const __dirname = dirname(__filename);
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/** Find tsx binary by walking up node_modules */
|
|
12
|
+
function findTsx() {
|
|
13
|
+
let dir = __dirname;
|
|
14
|
+
while (dir !== dirname(dir)) {
|
|
15
|
+
const candidate = join(dir, "node_modules", ".bin", "tsx");
|
|
16
|
+
if (existsSync(candidate)) return candidate;
|
|
17
|
+
dir = dirname(dir);
|
|
18
|
+
}
|
|
19
|
+
// Fallback: assume tsx is on PATH
|
|
20
|
+
return "tsx";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const tsx = findTsx();
|
|
24
|
+
|
|
25
|
+
// If first arg is "mcp", run the MCP server (needs spawn for bidirectional stdio)
|
|
26
|
+
if (process.argv[2] === "mcp") {
|
|
27
|
+
const script = join(__dirname, "..", "src", "mcp", "server.ts");
|
|
28
|
+
const child = spawn(tsx, [script], { stdio: "inherit" });
|
|
29
|
+
child.on("exit", (code) => process.exit(code ?? 0));
|
|
30
|
+
} else {
|
|
31
|
+
// Run the CLI
|
|
32
|
+
const script = join(__dirname, "tightknit.ts");
|
|
33
|
+
try {
|
|
34
|
+
execFileSync(tsx, [script, ...process.argv.slice(2)], { stdio: "inherit" });
|
|
35
|
+
} catch (err) {
|
|
36
|
+
process.exit(err.status ?? 1);
|
|
37
|
+
}
|
|
14
38
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tightknitai/tightknit",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
4
|
"description": "CLI and MCP server for the Tightknit API",
|
|
5
|
-
"license": "
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=18.0.0"
|