@tacitai/mcp-server 0.6.46 → 0.6.48
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/cli.js +59 -11
- package/dist/client.js +1 -1
- package/dist/setup.js +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,12 +3,12 @@ import * as fs from 'fs';
|
|
|
3
3
|
import * as path from 'path';
|
|
4
4
|
import * as os from 'os';
|
|
5
5
|
import * as readline from 'readline';
|
|
6
|
-
import { spawn } from 'child_process';
|
|
6
|
+
import { spawn, execFile } from 'child_process';
|
|
7
7
|
import { deviceAuthFlow, loginFlow, deriveAppUrl, workspaceNameToProfile } from './setup.js';
|
|
8
8
|
const PROFILES_DIR = path.join(os.homedir(), '.tacit', 'profiles');
|
|
9
9
|
const DEFAULT_FILE = path.join(os.homedir(), '.tacit', 'default');
|
|
10
10
|
const PROFILE_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/;
|
|
11
|
-
const RESERVED_NAMES = new Set(['login', 'ls', 'use', 'rm', 'status', 'install', 'help', 'setup', 'version']);
|
|
11
|
+
const RESERVED_NAMES = new Set(['login', 'ls', 'use', 'rm', 'status', 'install', 'help', 'setup', 'version', 'launch']);
|
|
12
12
|
const DEFAULT_API_URL = 'https://api-beta.tacitai.app';
|
|
13
13
|
function listV2Profiles() {
|
|
14
14
|
if (!fs.existsSync(PROFILES_DIR))
|
|
@@ -115,6 +115,31 @@ function tryLoadProfile(name) {
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
// ─── Subcommands ─────────────────────────────────────────────────────────────
|
|
118
|
+
const PROFILE_PASSTHROUGH = '${TACIT_PROFILE}';
|
|
119
|
+
// Idempotent: older setups lack TACIT_PROFILE in the MCP env, so the spawned MCP server never sees the profile.
|
|
120
|
+
function migrateMcpProfilePassthrough() {
|
|
121
|
+
try {
|
|
122
|
+
const mcpPath = path.join(os.homedir(), '.claude', 'mcp.json');
|
|
123
|
+
if (!fs.existsSync(mcpPath))
|
|
124
|
+
return;
|
|
125
|
+
const config = JSON.parse(fs.readFileSync(mcpPath, 'utf-8'));
|
|
126
|
+
const entry = config.mcpServers?.['tacit'];
|
|
127
|
+
if (!entry || typeof entry !== 'object')
|
|
128
|
+
return;
|
|
129
|
+
const env = entry.env ?? {};
|
|
130
|
+
if ('TACIT_PROFILE' in env)
|
|
131
|
+
return;
|
|
132
|
+
entry.env = { ...env, TACIT_PROFILE: PROFILE_PASSTHROUGH };
|
|
133
|
+
const tmp = mcpPath + '.tmp';
|
|
134
|
+
fs.writeFileSync(tmp, JSON.stringify(config, null, 2) + '\n', { mode: 0o600 });
|
|
135
|
+
fs.renameSync(tmp, mcpPath);
|
|
136
|
+
// Skip add-json when a literal token is embedded: argv is visible to other local users via ps.
|
|
137
|
+
if (typeof env['TACIT_TOKEN'] === 'string' && env['TACIT_TOKEN'].startsWith('${')) {
|
|
138
|
+
execFile('claude', ['mcp', 'add-json', '--scope', 'user', 'tacit', JSON.stringify(entry)], () => { });
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
catch { /* best-effort migration */ }
|
|
142
|
+
}
|
|
118
143
|
async function cmdLaunch(name, extraArgs) {
|
|
119
144
|
const profile = loadProfile(name);
|
|
120
145
|
if (profile.expires_at) {
|
|
@@ -128,7 +153,22 @@ async function cmdLaunch(name, extraArgs) {
|
|
|
128
153
|
process.stderr.write(`[TACIT] Token expires in ${daysLeft} day${daysLeft === 1 ? '' : 's'}.\n`);
|
|
129
154
|
}
|
|
130
155
|
}
|
|
131
|
-
|
|
156
|
+
// Parse --model from extraArgs; pass remaining args to claude
|
|
157
|
+
let model = null;
|
|
158
|
+
const claudeArgs = [];
|
|
159
|
+
for (let i = 0; i < extraArgs.length; i++) {
|
|
160
|
+
if ((extraArgs[i] === '--model' || extraArgs[i] === '-m') && extraArgs[i + 1]) {
|
|
161
|
+
model = extraArgs[++i];
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
claudeArgs.push(extraArgs[i]);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if (model) {
|
|
168
|
+
claudeArgs.push('--model', model);
|
|
169
|
+
}
|
|
170
|
+
migrateMcpProfilePassthrough();
|
|
171
|
+
const child = spawn('claude', claudeArgs, {
|
|
132
172
|
stdio: 'inherit',
|
|
133
173
|
env: { ...process.env, TACIT_PROFILE: name },
|
|
134
174
|
});
|
|
@@ -420,6 +460,9 @@ async function main() {
|
|
|
420
460
|
const args = process.argv.slice(2);
|
|
421
461
|
const cmd = args[0] ?? '';
|
|
422
462
|
switch (cmd) {
|
|
463
|
+
case 'launch':
|
|
464
|
+
await cmdLaunch(args[1], args.slice(2));
|
|
465
|
+
break;
|
|
423
466
|
case 'login':
|
|
424
467
|
await cmdLogin(args.slice(1));
|
|
425
468
|
break;
|
|
@@ -445,14 +488,19 @@ async function main() {
|
|
|
445
488
|
'tacit — workspace launcher for Claude Code + TACIT',
|
|
446
489
|
'',
|
|
447
490
|
'Commands:',
|
|
448
|
-
' tacit
|
|
449
|
-
' tacit <name>
|
|
450
|
-
' tacit
|
|
451
|
-
' tacit
|
|
452
|
-
' tacit
|
|
453
|
-
' tacit
|
|
454
|
-
' tacit
|
|
455
|
-
' tacit
|
|
491
|
+
' tacit Interactive workspace picker',
|
|
492
|
+
' tacit <name> Launch Claude Code connected to <name>',
|
|
493
|
+
' tacit <name> --model opus Launch with a specific model',
|
|
494
|
+
' tacit launch <name> Same as tacit <name>',
|
|
495
|
+
' tacit login Authenticate and create a profile',
|
|
496
|
+
' tacit ls List workspace profiles',
|
|
497
|
+
' tacit use <name> Set the default profile',
|
|
498
|
+
' tacit rm <name> Remove a profile',
|
|
499
|
+
' tacit status Show connection info',
|
|
500
|
+
' tacit install Add generic entry to .mcp.json',
|
|
501
|
+
'',
|
|
502
|
+
'Options:',
|
|
503
|
+
' --model, -m <model> Claude model (opus, sonnet, haiku, etc.)',
|
|
456
504
|
'',
|
|
457
505
|
].join('\n'));
|
|
458
506
|
break;
|
package/dist/client.js
CHANGED
|
@@ -477,7 +477,7 @@ export function loadProfile(name) {
|
|
|
477
477
|
export function resolveProfileOptions() {
|
|
478
478
|
// Level 1: TACIT_PROFILE env → load profile (profile values take precedence over stray env vars)
|
|
479
479
|
const profileName = process.env['TACIT_PROFILE'];
|
|
480
|
-
if (isNonEmpty(profileName)) {
|
|
480
|
+
if (isNonEmpty(profileName) && !profileName.includes('${')) {
|
|
481
481
|
const profile = loadProfile(profileName);
|
|
482
482
|
return {
|
|
483
483
|
apiUrl: profile.api_url,
|
package/dist/setup.js
CHANGED