@onescienceai/scnet 0.0.0-stage → 0.1.1
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 +19 -2
- package/bin/scnet.js +64 -0
- package/package.json +29 -4
- package/postinstall.js +31 -0
package/README.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @onescienceai/scnet
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
SCNet MCP server for local MCP clients.
|
|
4
|
+
|
|
5
|
+
## MCP config
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"command": "npx",
|
|
10
|
+
"args": ["-y", "@onescienceai/scnet@latest"]
|
|
11
|
+
}
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Global install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g @onescienceai/scnet@latest --allow-scripts=@onescienceai/scnet
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Prebuilt binaries: linux-x64, win32-x64.
|
package/bin/scnet.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the platform binary from optionalDependencies and exec it.
|
|
6
|
+
* MCP clients run: npx -y @onescienceai/scnet@latest
|
|
7
|
+
*/
|
|
8
|
+
const { spawn } = require("node:child_process")
|
|
9
|
+
const fs = require("node:fs")
|
|
10
|
+
const path = require("node:path")
|
|
11
|
+
|
|
12
|
+
function platformPackageName() {
|
|
13
|
+
const { platform, arch } = process
|
|
14
|
+
if (platform === "linux" && arch === "x64") return "@onescienceai/scnet-linux-x64"
|
|
15
|
+
if (platform === "win32" && arch === "x64") return "@onescienceai/scnet-win32-x64"
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function binaryName() {
|
|
20
|
+
return process.platform === "win32" ? "scnet-mcp-server.exe" : "scnet-mcp-server"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resolveBinary() {
|
|
24
|
+
const pkgName = platformPackageName()
|
|
25
|
+
if (!pkgName) {
|
|
26
|
+
console.error(
|
|
27
|
+
`@onescienceai/scnet: unsupported platform ${process.platform}/${process.arch}. ` +
|
|
28
|
+
`Supported: linux-x64, win32-x64.`,
|
|
29
|
+
)
|
|
30
|
+
process.exit(1)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let pkgJson
|
|
34
|
+
try {
|
|
35
|
+
pkgJson = require.resolve(`${pkgName}/package.json`)
|
|
36
|
+
} catch {
|
|
37
|
+
console.error(
|
|
38
|
+
`@onescienceai/scnet: missing ${pkgName}. Reinstall with:\n` +
|
|
39
|
+
` npm install -g @onescienceai/scnet@latest --allow-scripts=@onescienceai/scnet`,
|
|
40
|
+
)
|
|
41
|
+
process.exit(1)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const binPath = path.join(path.dirname(pkgJson), "bin", binaryName())
|
|
45
|
+
if (!fs.existsSync(binPath)) {
|
|
46
|
+
console.error(`@onescienceai/scnet: binary not found at ${binPath}`)
|
|
47
|
+
process.exit(1)
|
|
48
|
+
}
|
|
49
|
+
return binPath
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const binPath = resolveBinary()
|
|
53
|
+
const child = spawn(binPath, process.argv.slice(2), { stdio: "inherit" })
|
|
54
|
+
child.on("error", (err) => {
|
|
55
|
+
console.error(`@onescienceai/scnet: failed to start ${binPath}: ${err.message}`)
|
|
56
|
+
process.exit(1)
|
|
57
|
+
})
|
|
58
|
+
child.on("exit", (code, signal) => {
|
|
59
|
+
if (signal) {
|
|
60
|
+
process.kill(process.pid, signal)
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
process.exit(code ?? 1)
|
|
64
|
+
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onescienceai/scnet",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "SCNet MCP server — use with npx -y @onescienceai/scnet@latest",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"scnet": "bin/scnet.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"postinstall": "node ./postinstall.js"
|
|
11
|
+
},
|
|
12
|
+
"optionalDependencies": {
|
|
13
|
+
"@onescienceai/scnet-linux-x64": "0.1.1",
|
|
14
|
+
"@onescienceai/scnet-win32-x64": "0.1.1"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"bin/**",
|
|
18
|
+
"postinstall.js"
|
|
19
|
+
],
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=18"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"mcp",
|
|
28
|
+
"scnet",
|
|
29
|
+
"onescience"
|
|
30
|
+
]
|
|
31
|
+
}
|
package/postinstall.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Soft check after install. optionalDependencies may skip unsupported OS;
|
|
6
|
+
* fail with a clear message rather than a cryptic missing-module error later.
|
|
7
|
+
*/
|
|
8
|
+
const { platform, arch } = process
|
|
9
|
+
|
|
10
|
+
const supported =
|
|
11
|
+
(platform === "linux" && arch === "x64") || (platform === "win32" && arch === "x64")
|
|
12
|
+
|
|
13
|
+
if (!supported) {
|
|
14
|
+
console.warn(
|
|
15
|
+
`@onescienceai/scnet: warning — no prebuilt binary for ${platform}/${arch} ` +
|
|
16
|
+
`(supported: linux-x64, win32-x64).`,
|
|
17
|
+
)
|
|
18
|
+
process.exit(0)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const pkg =
|
|
22
|
+
platform === "win32" ? "@onescienceai/scnet-win32-x64" : "@onescienceai/scnet-linux-x64"
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
require.resolve(`${pkg}/package.json`)
|
|
26
|
+
} catch {
|
|
27
|
+
console.warn(
|
|
28
|
+
`@onescienceai/scnet: platform package ${pkg} was not installed. ` +
|
|
29
|
+
`Retry: npm install -g @onescienceai/scnet@latest --allow-scripts=@onescienceai/scnet`,
|
|
30
|
+
)
|
|
31
|
+
}
|