nomadic-mcp 0.2.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 ADDED
@@ -0,0 +1,36 @@
1
+ # nomadicml-mcp
2
+
3
+ MCP server for NomadicML — use NomadicML's video analysis platform directly from Claude Code and Claude.ai. Upload videos, run analysis, search events, and manage your fleet, all through natural language.
4
+
5
+ ## Quickstart
6
+
7
+ ```bash
8
+ # Register with Claude Code
9
+ claude mcp add nomadicml \
10
+ -e NOMADICML_API_KEY=your_api_key \
11
+ -- npx nomadicml-mcp
12
+ ```
13
+
14
+ Get your API key at [app.nomadicml.com](https://app.nomadicml.com) → **Profile** → **API Keys**.
15
+
16
+ Then just talk to Claude:
17
+
18
+ > Analyze this dashcam video for driving violations:
19
+ > https://storage.example.com/clip.mp4
20
+
21
+ > Find all near-miss events in my fleet_march folder
22
+
23
+ > Upload /Users/me/videos/trip.mp4 and detect lane changes
24
+
25
+ ## Requirements
26
+
27
+ - Claude Code or Claude.ai with MCP support
28
+ - A NomadicML account and API key
29
+ - No Python, no pip — the binary is self-contained
30
+
31
+ To create an npm update, run -
32
+
33
+ git tag -d v0.2.0
34
+ git push origin --delete v0.2.0
35
+ git tag v0.2.0
36
+ git push origin v0.2.0
package/bin/run.js ADDED
@@ -0,0 +1,52 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Entry point for nomadicml-mcp.
4
+ * Resolves the correct pre-compiled binary for the current platform,
5
+ * then spawns it — passing through all stdio so it works as an MCP server.
6
+ */
7
+
8
+ const { spawnSync } = require("child_process");
9
+ const path = require("path");
10
+ const fs = require("fs");
11
+ const os = require("os");
12
+
13
+ function getPlatformKey() {
14
+ const p = process.platform;
15
+ const a = process.arch;
16
+ if (p === "darwin" && a === "arm64") return "darwin-arm64";
17
+ if (p === "darwin" && a === "x64") return "darwin-x64";
18
+ if (p === "linux" && a === "x64") return "linux-x64";
19
+ if (p === "win32" && a === "x64") return "win32-x64";
20
+ throw new Error(
21
+ `Unsupported platform: ${p}/${a}. ` +
22
+ "Please open an issue at https://github.com/nomadic-ml/nomadicml-mcp"
23
+ );
24
+ }
25
+
26
+ function getBinaryPath() {
27
+ const key = getPlatformKey();
28
+ const ext = process.platform === "win32" ? ".exe" : "";
29
+ const binaryName = `nomadicml-mcp-${key}${ext}`;
30
+ const binaryPath = path.join(__dirname, "..", "bin", binaryName);
31
+
32
+ if (!fs.existsSync(binaryPath)) {
33
+ throw new Error(
34
+ `Binary not found: ${binaryPath}\n` +
35
+ "Try reinstalling: npx nomadicml-mcp@latest\n" +
36
+ "Or run: node scripts/install.js"
37
+ );
38
+ }
39
+ return binaryPath;
40
+ }
41
+
42
+ try {
43
+ const binary = getBinaryPath();
44
+ const result = spawnSync(binary, process.argv.slice(2), {
45
+ stdio: "inherit",
46
+ env: process.env,
47
+ });
48
+ process.exit(result.status ?? 1);
49
+ } catch (err) {
50
+ console.error(`[nomadicml-mcp] ${err.message}`);
51
+ process.exit(1);
52
+ }
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "nomadic-mcp",
3
+ "version": "0.2.0",
4
+ "description": "MCP server for NomadicML — full video analysis SDK for Claude Code and Claude.ai",
5
+ "keywords": ["mcp", "nomadicml", "video", "ai", "claude", "video-analysis"],
6
+ "homepage": "https://nomadicml.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/nomadic-ml/nomadicml-mcp"
10
+ },
11
+ "license": "MIT",
12
+ "bin": {
13
+ "nomadicml-mcp": "./bin/run.js"
14
+ },
15
+ "scripts": {
16
+ "postinstall": "node scripts/install.js"
17
+ },
18
+ "files": [
19
+ "bin/",
20
+ "scripts/",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=18"
25
+ }
26
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Runs after `npm install` (postinstall hook).
3
+ * Downloads the correct pre-compiled binary from GitHub Releases
4
+ * for the current platform and places it in bin/.
5
+ */
6
+
7
+ const https = require("https");
8
+ const fs = require("fs");
9
+ const path = require("path");
10
+ const os = require("os");
11
+ const { execSync } = require("child_process");
12
+
13
+ const PACKAGE_VERSION = require("../package.json").version;
14
+ const GITHUB_REPO = "nomadic-ml/nomadic-mcp";
15
+ const BIN_DIR = path.join(__dirname, "..", "bin");
16
+
17
+ function getPlatformKey() {
18
+ const p = process.platform;
19
+ const a = process.arch;
20
+ if (p === "darwin" && a === "arm64") return "darwin-arm64";
21
+ if (p === "darwin" && a === "x64") return "darwin-x64";
22
+ if (p === "linux" && a === "x64") return "linux-x64";
23
+ if (p === "win32" && a === "x64") return "win32-x64";
24
+ return null;
25
+ }
26
+
27
+ function getBinaryName(key) {
28
+ const ext = process.platform === "win32" ? ".exe" : "";
29
+ return `nomadicml-mcp-${key}${ext}`;
30
+ }
31
+
32
+ function download(url, dest) {
33
+ return new Promise((resolve, reject) => {
34
+ const file = fs.createWriteStream(dest);
35
+ const follow = (u) => {
36
+ https.get(u, (res) => {
37
+ if (res.statusCode === 301 || res.statusCode === 302) {
38
+ follow(res.headers.location);
39
+ return;
40
+ }
41
+ if (res.statusCode !== 200) {
42
+ reject(new Error(`HTTP ${res.statusCode} downloading ${u}`));
43
+ return;
44
+ }
45
+ res.pipe(file);
46
+ file.on("finish", () => file.close(resolve));
47
+ file.on("error", reject);
48
+ }).on("error", reject);
49
+ };
50
+ follow(url);
51
+ });
52
+ }
53
+
54
+ async function main() {
55
+ const key = getPlatformKey();
56
+ if (!key) {
57
+ console.warn(
58
+ `[nomadicml-mcp] Unsupported platform ${process.platform}/${process.arch} — skipping binary install.`
59
+ );
60
+ return;
61
+ }
62
+
63
+ const binaryName = getBinaryName(key);
64
+ const binaryPath = path.join(BIN_DIR, binaryName);
65
+
66
+ // Already installed
67
+ if (fs.existsSync(binaryPath)) {
68
+ console.log(`[nomadicml-mcp] Binary already installed: ${binaryName}`);
69
+ return;
70
+ }
71
+
72
+ fs.mkdirSync(BIN_DIR, { recursive: true });
73
+
74
+ const url = `https://github.com/${GITHUB_REPO}/releases/download/v${PACKAGE_VERSION}/${binaryName}`;
75
+ console.log(`[nomadicml-mcp] Downloading binary for ${key}...`);
76
+ console.log(`[nomadicml-mcp] ${url}`);
77
+
78
+ try {
79
+ await download(url, binaryPath);
80
+ // Make executable on Unix
81
+ if (process.platform !== "win32") {
82
+ fs.chmodSync(binaryPath, 0o755);
83
+ }
84
+ console.log(`[nomadicml-mcp] Installed: ${binaryName}`);
85
+ } catch (err) {
86
+ fs.unlink(binaryPath, () => {});
87
+ console.error(`[nomadicml-mcp] Failed to download binary: ${err.message}`);
88
+ console.error(
89
+ `[nomadicml-mcp] You can download it manually from:\n` +
90
+ ` https://github.com/${GITHUB_REPO}/releases/tag/v${PACKAGE_VERSION}`
91
+ );
92
+ process.exit(1);
93
+ }
94
+ }
95
+
96
+ main();