@kolbo/mcp 1.20.1 → 1.21.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/bin/kolbo-mcp.js CHANGED
@@ -1,2 +1,15 @@
1
- #!/usr/bin/env node
2
- require('../src/index.js');
1
+ #!/usr/bin/env node
2
+
3
+ // `npx @kolbo/mcp install` → one-command keyless setup (configures the user's
4
+ // agent). Anything else → run the MCP stdio server (the default).
5
+ if (process.argv[2] === 'install') {
6
+ require('../src/install.js')
7
+ .run()
8
+ .then((code) => process.exit(code || 0))
9
+ .catch((err) => {
10
+ console.error('Kolbo install failed:', err && err.message ? err.message : err);
11
+ process.exit(1);
12
+ });
13
+ } else {
14
+ require('../src/index.js');
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolbo/mcp",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "Kolbo AI MCP Server - Generate images, videos, music, speech, and sound effects from Claude Code",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/src/install.js ADDED
@@ -0,0 +1,98 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * `npx @kolbo/mcp install` — one-command, keyless setup.
5
+ *
6
+ * Detects the MCP config of every supported local agent (Claude Desktop,
7
+ * Claude Code, Cursor) that's actually installed, and adds the Kolbo MCP server
8
+ * to it — to the RIGHT file, merging instead of clobbering. No API key (the
9
+ * server logs in via the browser on first use). This exists because having an
10
+ * agent hand-edit settings.json is fragile (wrong file, JSON breakage, and
11
+ * Claude Code's self-modification guard) — one deterministic command is not.
12
+ */
13
+
14
+ const fs = require('fs');
15
+ const path = require('path');
16
+ const os = require('os');
17
+
18
+ const KOLBO_ENTRY = { command: 'npx', args: ['-y', '@kolbo/mcp@latest'] };
19
+
20
+ function targets() {
21
+ const home = os.homedir();
22
+ let desktop;
23
+ if (process.platform === 'darwin') {
24
+ desktop = path.join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
25
+ } else if (process.platform === 'win32') {
26
+ desktop = path.join(process.env.APPDATA || path.join(home, 'AppData', 'Roaming'), 'Claude', 'claude_desktop_config.json');
27
+ } else {
28
+ desktop = path.join(home, '.config', 'Claude', 'claude_desktop_config.json');
29
+ }
30
+ return [
31
+ { name: 'Claude Desktop', file: desktop, restart: 'Fully quit and reopen Claude Desktop' },
32
+ { name: 'Claude Code', file: path.join(home, '.claude', 'settings.json'), restart: 'Restart Claude Code' },
33
+ { name: 'Cursor', file: path.join(home, '.cursor', 'mcp.json'), restart: 'Restart Cursor' },
34
+ ];
35
+ }
36
+
37
+ function configure(t) {
38
+ const dir = path.dirname(t.file);
39
+ const fileExists = fs.existsSync(t.file);
40
+ // Only touch an app that looks installed (its config file or parent dir exists)
41
+ // so we don't create configs for apps the user doesn't have.
42
+ if (!fileExists && !fs.existsSync(dir)) return { ...t, status: 'not found' };
43
+
44
+ let cfg = {};
45
+ if (fileExists) {
46
+ try {
47
+ cfg = JSON.parse(fs.readFileSync(t.file, 'utf8'));
48
+ } catch (_) {
49
+ return { ...t, status: 'skipped — existing config is not valid JSON' };
50
+ }
51
+ }
52
+ cfg.mcpServers = cfg.mcpServers || {};
53
+ if (cfg.mcpServers.kolbo) return { ...t, status: 'already set up' };
54
+
55
+ cfg.mcpServers.kolbo = { ...KOLBO_ENTRY };
56
+ try {
57
+ fs.mkdirSync(dir, { recursive: true });
58
+ fs.writeFileSync(t.file, JSON.stringify(cfg, null, 2) + '\n');
59
+ return { ...t, status: 'configured' };
60
+ } catch (e) {
61
+ return { ...t, status: `failed — ${e.message}` };
62
+ }
63
+ }
64
+
65
+ async function run() {
66
+ const out = (s = '') => process.stdout.write(s + '\n');
67
+ const results = targets().map(configure);
68
+ const newlyConfigured = results.filter((r) => r.status === 'configured');
69
+ const ready = results.filter((r) => r.status === 'configured' || r.status === 'already set up');
70
+
71
+ out();
72
+ out(' Kolbo MCP — keyless setup');
73
+ out(' ─────────────────────────');
74
+ for (const r of results) {
75
+ const ok = r.status === 'configured' || r.status === 'already set up';
76
+ out(` ${ok ? '✓' : '·'} ${r.name}: ${r.status}${ok ? ` (${r.file})` : ''}`);
77
+ }
78
+ out();
79
+
80
+ if (ready.length === 0) {
81
+ out(' No supported agent found (Claude Desktop / Claude Code / Cursor).');
82
+ out(' Add this to your agent\'s MCP config manually, then restart it:');
83
+ out(' {"mcpServers":{"kolbo":{"command":"npx","args":["-y","@kolbo/mcp@latest"]}}}');
84
+ out();
85
+ return 0;
86
+ }
87
+
88
+ out(' Done — no API key needed.');
89
+ if (newlyConfigured.length) {
90
+ const steps = [...new Set(newlyConfigured.map((r) => r.restart))];
91
+ out(` Next: ${steps.join('; ')}.`);
92
+ }
93
+ out(' On your first Kolbo generation, a login opens in your browser — click Allow.');
94
+ out();
95
+ return 0;
96
+ }
97
+
98
+ module.exports = { run };