@bayway/janusmcp 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 +15 -0
- package/bin/janusmcp.js +23 -0
- package/install.js +75 -0
- package/package.json +39 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# janusmcp
|
|
2
|
+
|
|
3
|
+
Local multi-account MCP broker — one endpoint, every account. Add credentials once,
|
|
4
|
+
switch identity without reconnecting, from any LLM.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npx @bayway/janusmcp serve # run it
|
|
8
|
+
npm i -g @bayway/janusmcp # or install globally
|
|
9
|
+
janusmcp version
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
On install this package downloads the prebuilt native binary matching your platform
|
|
13
|
+
from the [GitHub release](https://github.com/bayway/janusmcp/releases).
|
|
14
|
+
|
|
15
|
+
Full docs: https://github.com/bayway/janusmcp
|
package/bin/janusmcp.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Launcher: forwards args to the downloaded native binary, passing stdio through
|
|
3
|
+
// untouched (required for the MCP stdio transport).
|
|
4
|
+
'use strict';
|
|
5
|
+
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const fs = require('fs');
|
|
8
|
+
const { spawnSync } = require('child_process');
|
|
9
|
+
|
|
10
|
+
const isWin = process.platform === 'win32';
|
|
11
|
+
const bin = path.join(__dirname, isWin ? 'multimcp.exe' : 'multimcp');
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(bin)) {
|
|
14
|
+
console.error('[multimcp] native binary missing — reinstall the package (npm i -g multimcp).');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const res = spawnSync(bin, process.argv.slice(2), { stdio: 'inherit' });
|
|
19
|
+
if (res.error) {
|
|
20
|
+
console.error('[multimcp] ' + res.error.message);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
process.exit(res.status === null ? 1 : res.status);
|
package/install.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Postinstall: download the prebuilt `janusmcp` binary that matches this package
|
|
2
|
+
// version from the GitHub release, and place it next to the launcher.
|
|
3
|
+
//
|
|
4
|
+
// Asset naming must match .goreleaser.yaml archives:
|
|
5
|
+
// janusmcp_<os>_<arch>.tar.gz (zip on windows)
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const os = require('os');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const https = require('https');
|
|
12
|
+
const { execFileSync } = require('child_process');
|
|
13
|
+
|
|
14
|
+
const REPO = 'bayway/janusmcp';
|
|
15
|
+
const version = require('./package.json').version;
|
|
16
|
+
|
|
17
|
+
const OS_MAP = { darwin: 'darwin', linux: 'linux', win32: 'windows' };
|
|
18
|
+
const ARCH_MAP = { x64: 'amd64', arm64: 'arm64' };
|
|
19
|
+
|
|
20
|
+
function fail(msg) {
|
|
21
|
+
console.error('[janusmcp] ' + msg);
|
|
22
|
+
console.error('[janusmcp] You can also install from https://github.com/' + REPO + '/releases');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const goos = OS_MAP[process.platform];
|
|
27
|
+
const goarch = ARCH_MAP[process.arch];
|
|
28
|
+
if (!goos || !goarch) fail(`unsupported platform ${process.platform}/${process.arch}`);
|
|
29
|
+
|
|
30
|
+
const isWin = goos === 'windows';
|
|
31
|
+
const ext = isWin ? 'zip' : 'tar.gz';
|
|
32
|
+
const asset = `janusmcp_${goos}_${goarch}.${ext}`;
|
|
33
|
+
const url = `https://github.com/${REPO}/releases/download/v${version}/${asset}`;
|
|
34
|
+
|
|
35
|
+
const binDir = path.join(__dirname, 'bin');
|
|
36
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
37
|
+
const tmp = path.join(os.tmpdir(), `janusmcp-${version}-${Date.now()}.${ext}`);
|
|
38
|
+
|
|
39
|
+
function download(u, dest, redirects = 0) {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
if (redirects > 10) return reject(new Error('too many redirects'));
|
|
42
|
+
https.get(u, { headers: { 'User-Agent': 'janusmcp-npm-installer' } }, (res) => {
|
|
43
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
44
|
+
res.resume();
|
|
45
|
+
return resolve(download(res.headers.location, dest, redirects + 1));
|
|
46
|
+
}
|
|
47
|
+
if (res.statusCode !== 200) {
|
|
48
|
+
res.resume();
|
|
49
|
+
return reject(new Error(`HTTP ${res.statusCode} for ${u}`));
|
|
50
|
+
}
|
|
51
|
+
const file = fs.createWriteStream(dest);
|
|
52
|
+
res.pipe(file);
|
|
53
|
+
file.on('finish', () => file.close(resolve));
|
|
54
|
+
file.on('error', reject);
|
|
55
|
+
}).on('error', reject);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
(async () => {
|
|
60
|
+
try {
|
|
61
|
+
console.error(`[janusmcp] downloading ${asset} (v${version})…`);
|
|
62
|
+
await download(url, tmp);
|
|
63
|
+
|
|
64
|
+
// bsdtar (present on macOS, Linux, and Windows 10+) extracts both tar.gz and zip.
|
|
65
|
+
execFileSync('tar', ['-xf', tmp, '-C', binDir], { stdio: 'inherit' });
|
|
66
|
+
fs.rmSync(tmp, { force: true });
|
|
67
|
+
|
|
68
|
+
const binPath = path.join(binDir, isWin ? 'janusmcp.exe' : 'janusmcp');
|
|
69
|
+
if (!fs.existsSync(binPath)) fail('binary not found in archive after extraction');
|
|
70
|
+
if (!isWin) fs.chmodSync(binPath, 0o755);
|
|
71
|
+
console.error('[janusmcp] installed.');
|
|
72
|
+
} catch (e) {
|
|
73
|
+
fail('install failed: ' + e.message);
|
|
74
|
+
}
|
|
75
|
+
})();
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bayway/janusmcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.bayway/janusmcp",
|
|
5
|
+
"description": "Local multi-account MCP broker — one endpoint, every account. Add credentials once, switch identity without reconnecting, from any LLM.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"mcp",
|
|
8
|
+
"model-context-protocol",
|
|
9
|
+
"broker",
|
|
10
|
+
"multi-account",
|
|
11
|
+
"supabase",
|
|
12
|
+
"llm",
|
|
13
|
+
"claude",
|
|
14
|
+
"cli"
|
|
15
|
+
],
|
|
16
|
+
"homepage": "https://github.com/bayway/janusmcp",
|
|
17
|
+
"bugs": "https://github.com/bayway/janusmcp/issues",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/bayway/janusmcp.git",
|
|
21
|
+
"directory": "npm"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Massimiliano Fiori",
|
|
25
|
+
"bin": {
|
|
26
|
+
"janusmcp": "bin/janusmcp.js"
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"postinstall": "node install.js"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"bin/janusmcp.js",
|
|
33
|
+
"install.js",
|
|
34
|
+
"README.md"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18"
|
|
38
|
+
}
|
|
39
|
+
}
|