@rvry/mcp 0.4.1 → 0.4.3
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/dist/client.js +1 -0
- package/dist/fetch.d.ts +12 -0
- package/dist/fetch.js +30 -0
- package/dist/setup.js +78 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
package/dist/fetch.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable fetch — uses globalThis.fetch if available, falls back to
|
|
3
|
+
* Node's bundled undici (ships with Node 18+, no extra install).
|
|
4
|
+
*
|
|
5
|
+
* Delegates at call time (not import time) so globalThis.fetch can be
|
|
6
|
+
* overridden in tests.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Portable fetch that delegates to globalThis.fetch (checked at call time)
|
|
10
|
+
* or the undici fallback resolved at import time.
|
|
11
|
+
*/
|
|
12
|
+
export declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
package/dist/fetch.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Portable fetch — uses globalThis.fetch if available, falls back to
|
|
3
|
+
* Node's bundled undici (ships with Node 18+, no extra install).
|
|
4
|
+
*
|
|
5
|
+
* Delegates at call time (not import time) so globalThis.fetch can be
|
|
6
|
+
* overridden in tests.
|
|
7
|
+
*/
|
|
8
|
+
let _undiciFetch = null;
|
|
9
|
+
if (typeof globalThis.fetch !== 'function') {
|
|
10
|
+
try {
|
|
11
|
+
// @ts-ignore -- undici has no type declarations in this package; runtime-only fallback
|
|
12
|
+
const mod = await import('undici');
|
|
13
|
+
_undiciFetch = mod.fetch;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
throw new Error('[rvry-mcp] fetch is not available and undici import failed. ' +
|
|
17
|
+
'Node.js 18.13.0+ or Bun is required. Current version: ' + process.version);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Portable fetch that delegates to globalThis.fetch (checked at call time)
|
|
22
|
+
* or the undici fallback resolved at import time.
|
|
23
|
+
*/
|
|
24
|
+
export function fetch(input, init) {
|
|
25
|
+
const fn = globalThis.fetch ?? _undiciFetch;
|
|
26
|
+
if (!fn) {
|
|
27
|
+
throw new Error('[rvry-mcp] No fetch implementation available.');
|
|
28
|
+
}
|
|
29
|
+
return fn(input, init);
|
|
30
|
+
}
|
package/dist/setup.js
CHANGED
|
@@ -16,6 +16,7 @@ import { createInterface } from 'readline';
|
|
|
16
16
|
import { execSync } from 'child_process';
|
|
17
17
|
import { platform } from 'os';
|
|
18
18
|
import { createRequire } from 'module';
|
|
19
|
+
import { fetch } from './fetch.js';
|
|
19
20
|
const require = createRequire(import.meta.url);
|
|
20
21
|
const PKG_VERSION = require('../package.json').version;
|
|
21
22
|
const ENGINE_URL = 'https://engine.rvry.ai';
|
|
@@ -345,6 +346,32 @@ function configureTomlMcp(configPath, token) {
|
|
|
345
346
|
return 'error';
|
|
346
347
|
}
|
|
347
348
|
}
|
|
349
|
+
function isGeminiCLIAvailable() {
|
|
350
|
+
try {
|
|
351
|
+
const cmd = platform() === 'win32' ? 'where gemini' : 'which gemini';
|
|
352
|
+
execSync(cmd, { stdio: 'pipe' });
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
catch { /* not on PATH */ }
|
|
356
|
+
if (existsSync(join(homedir(), '.gemini', 'settings.json')))
|
|
357
|
+
return true;
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
function registerGeminiCLI(token) {
|
|
361
|
+
try {
|
|
362
|
+
// Remove existing entry first (silent fail if not registered)
|
|
363
|
+
try {
|
|
364
|
+
execSync('gemini mcp remove rvry', { stdio: 'pipe' });
|
|
365
|
+
}
|
|
366
|
+
catch { /* not registered */ }
|
|
367
|
+
execSync(`gemini mcp add rvry -e RVRY_TOKEN="${token}" --scope user npx -y @rvry/mcp`, { stdio: 'inherit' });
|
|
368
|
+
return 'ok';
|
|
369
|
+
}
|
|
370
|
+
catch {
|
|
371
|
+
// Fallback: write settings.json directly
|
|
372
|
+
return configureJsonMcp(join(homedir(), '.gemini', 'settings.json'), token);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
348
375
|
function isCodexAvailable() {
|
|
349
376
|
try {
|
|
350
377
|
const cmd = platform() === 'win32' ? 'where codex' : 'which codex';
|
|
@@ -376,6 +403,7 @@ const CLIENT_REGISTRY = [
|
|
|
376
403
|
{
|
|
377
404
|
name: 'Anti-Gravity',
|
|
378
405
|
id: 'antigravity',
|
|
406
|
+
defaultSelected: false,
|
|
379
407
|
detect: () => {
|
|
380
408
|
// OR-logic: binary (agy or antigravity), config dir, or macOS app bundle
|
|
381
409
|
try {
|
|
@@ -400,9 +428,58 @@ const CLIENT_REGISTRY = [
|
|
|
400
428
|
configure: (token) => configureJsonMcp(join(homedir(), '.gemini', 'antigravity', 'mcp_config.json'), token),
|
|
401
429
|
notInstalledHint: 'Not installed (https://antigravity.google)',
|
|
402
430
|
},
|
|
431
|
+
{
|
|
432
|
+
name: 'Cursor',
|
|
433
|
+
id: 'cursor',
|
|
434
|
+
defaultSelected: false,
|
|
435
|
+
detect: () => {
|
|
436
|
+
if (platform() === 'darwin' && existsSync('/Applications/Cursor.app'))
|
|
437
|
+
return true;
|
|
438
|
+
if (existsSync(join(homedir(), '.cursor', 'mcp.json')))
|
|
439
|
+
return true;
|
|
440
|
+
try {
|
|
441
|
+
const cmd = platform() === 'win32' ? 'where cursor' : 'which cursor';
|
|
442
|
+
execSync(cmd, { stdio: 'pipe' });
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
catch { /* not on PATH */ }
|
|
446
|
+
return false;
|
|
447
|
+
},
|
|
448
|
+
configure: (token) => configureJsonMcp(join(homedir(), '.cursor', 'mcp.json'), token),
|
|
449
|
+
notInstalledHint: 'Not installed (https://cursor.com)',
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
name: 'Gemini CLI',
|
|
453
|
+
id: 'gemini',
|
|
454
|
+
defaultSelected: false,
|
|
455
|
+
detect: isGeminiCLIAvailable,
|
|
456
|
+
configure: registerGeminiCLI,
|
|
457
|
+
notInstalledHint: 'Not installed (https://github.com/google-gemini/gemini-cli)',
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: 'Windsurf',
|
|
461
|
+
id: 'windsurf',
|
|
462
|
+
defaultSelected: false,
|
|
463
|
+
detect: () => {
|
|
464
|
+
if (platform() === 'darwin' && existsSync('/Applications/Windsurf.app'))
|
|
465
|
+
return true;
|
|
466
|
+
if (existsSync(join(homedir(), '.codeium', 'windsurf', 'mcp_config.json')))
|
|
467
|
+
return true;
|
|
468
|
+
try {
|
|
469
|
+
const cmd = platform() === 'win32' ? 'where windsurf' : 'which windsurf';
|
|
470
|
+
execSync(cmd, { stdio: 'pipe' });
|
|
471
|
+
return true;
|
|
472
|
+
}
|
|
473
|
+
catch { /* not on PATH */ }
|
|
474
|
+
return false;
|
|
475
|
+
},
|
|
476
|
+
configure: (token) => configureJsonMcp(join(homedir(), '.codeium', 'windsurf', 'mcp_config.json'), token),
|
|
477
|
+
notInstalledHint: 'Not installed (https://windsurf.com)',
|
|
478
|
+
},
|
|
403
479
|
{
|
|
404
480
|
name: 'Codex',
|
|
405
481
|
id: 'codex',
|
|
482
|
+
defaultSelected: false,
|
|
406
483
|
detect: isCodexAvailable,
|
|
407
484
|
configure: (token) => configureTomlMcp(join(homedir(), '.codex', 'config.toml'), token),
|
|
408
485
|
notInstalledHint: 'Not installed (https://openai.com/codex)',
|
|
@@ -837,7 +914,7 @@ export async function runSetup() {
|
|
|
837
914
|
console.log('');
|
|
838
915
|
const pickerItems = detected.map((d) => ({
|
|
839
916
|
label: d.client.name,
|
|
840
|
-
selected: d.available
|
|
917
|
+
selected: d.available && (d.client.defaultSelected !== false),
|
|
841
918
|
available: d.available,
|
|
842
919
|
hint: d.available ? undefined : d.client.notInstalledHint,
|
|
843
920
|
}));
|