tokenizor-mcp 0.1.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/bin/tokenizor-mcp.js +34 -0
- package/package.json +31 -0
- package/scripts/install.js +91 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execFileSync } = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
9
|
+
const binPath = path.join(__dirname, "tokenizor-mcp" + ext);
|
|
10
|
+
|
|
11
|
+
if (!fs.existsSync(binPath)) {
|
|
12
|
+
console.error("tokenizor-mcp binary not found. Running install...");
|
|
13
|
+
try {
|
|
14
|
+
execFileSync(process.execPath, [path.join(__dirname, "..", "scripts", "install.js")], {
|
|
15
|
+
stdio: "inherit",
|
|
16
|
+
});
|
|
17
|
+
} catch {
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
if (args.length === 0) args.push("run");
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const result = require("child_process").spawnSync(binPath, args, {
|
|
27
|
+
stdio: "inherit",
|
|
28
|
+
env: process.env,
|
|
29
|
+
});
|
|
30
|
+
process.exit(result.status ?? 1);
|
|
31
|
+
} catch (err) {
|
|
32
|
+
console.error(err.message);
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tokenizor-mcp",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "Tokenizor MCP — trusted local code indexing, retrieval, recovery, and repair for AI coding workflows",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/special-place-administrator/tokenizor_agentic_mcp"
|
|
9
|
+
},
|
|
10
|
+
"bin": {
|
|
11
|
+
"tokenizor-mcp": "bin/tokenizor-mcp.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"postinstall": "node scripts/install.js"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/",
|
|
18
|
+
"scripts/"
|
|
19
|
+
],
|
|
20
|
+
"keywords": [
|
|
21
|
+
"mcp",
|
|
22
|
+
"code-indexing",
|
|
23
|
+
"code-retrieval",
|
|
24
|
+
"ai-coding",
|
|
25
|
+
"tree-sitter",
|
|
26
|
+
"spacetimedb"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
const fs = require("fs");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const http = require("http");
|
|
9
|
+
|
|
10
|
+
const REPO = "special-place-administrator/tokenizor_agentic_mcp";
|
|
11
|
+
const BIN_DIR = path.join(__dirname, "..", "bin");
|
|
12
|
+
|
|
13
|
+
function getPlatformArtifact() {
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
const arch = process.arch;
|
|
16
|
+
|
|
17
|
+
if (platform === "win32" && arch === "x64") return "tokenizor-mcp-windows-x64.exe";
|
|
18
|
+
if (platform === "darwin" && arch === "arm64") return "tokenizor-mcp-macos-arm64";
|
|
19
|
+
if (platform === "darwin" && arch === "x64") return "tokenizor-mcp-macos-x64";
|
|
20
|
+
if (platform === "linux" && arch === "x64") return "tokenizor-mcp-linux-x64";
|
|
21
|
+
|
|
22
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
23
|
+
console.error("Build from source: https://github.com/" + REPO);
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function getVersion() {
|
|
28
|
+
const pkg = require("../package.json");
|
|
29
|
+
return pkg.version;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getBinaryPath() {
|
|
33
|
+
const artifact = getPlatformArtifact();
|
|
34
|
+
const ext = process.platform === "win32" ? ".exe" : "";
|
|
35
|
+
return path.join(BIN_DIR, "tokenizor-mcp" + ext);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function download(url) {
|
|
39
|
+
return new Promise((resolve, reject) => {
|
|
40
|
+
const client = url.startsWith("https") ? https : http;
|
|
41
|
+
client.get(url, { headers: { "User-Agent": "tokenizor-mcp" } }, (res) => {
|
|
42
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
43
|
+
return download(res.headers.location).then(resolve).catch(reject);
|
|
44
|
+
}
|
|
45
|
+
if (res.statusCode !== 200) {
|
|
46
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
|
|
47
|
+
}
|
|
48
|
+
const chunks = [];
|
|
49
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
50
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
51
|
+
res.on("error", reject);
|
|
52
|
+
}).on("error", reject);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function main() {
|
|
57
|
+
const binPath = getBinaryPath();
|
|
58
|
+
|
|
59
|
+
// Skip if binary already exists
|
|
60
|
+
if (fs.existsSync(binPath)) {
|
|
61
|
+
console.log("tokenizor-mcp binary already installed.");
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const version = getVersion();
|
|
66
|
+
const artifact = getPlatformArtifact();
|
|
67
|
+
const url = `https://github.com/${REPO}/releases/download/v${version}/${artifact}`;
|
|
68
|
+
|
|
69
|
+
console.log(`Downloading tokenizor-mcp v${version} for ${process.platform}-${process.arch}...`);
|
|
70
|
+
console.log(` ${url}`);
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const data = await download(url);
|
|
74
|
+
|
|
75
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
76
|
+
fs.writeFileSync(binPath, data);
|
|
77
|
+
fs.chmodSync(binPath, 0o755);
|
|
78
|
+
|
|
79
|
+
console.log(`Installed: ${binPath}`);
|
|
80
|
+
} catch (err) {
|
|
81
|
+
console.error(`Failed to download binary: ${err.message}`);
|
|
82
|
+
console.error("");
|
|
83
|
+
console.error("You can build from source instead:");
|
|
84
|
+
console.error(" git clone https://github.com/" + REPO);
|
|
85
|
+
console.error(" cd tokenizor_agentic_mcp");
|
|
86
|
+
console.error(" cargo build --release");
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
main();
|