@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 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
- const child = spawn('claude', extraArgs, {
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 Interactive workspace picker',
449
- ' tacit <name> Launch Claude Code connected to <name>',
450
- ' tacit login Authenticate and create a profile',
451
- ' tacit ls List workspace profiles',
452
- ' tacit use <name> Set the default profile',
453
- ' tacit rm <name> Remove a profile',
454
- ' tacit status Show connection info',
455
- ' tacit install Add generic entry to .mcp.json',
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
@@ -169,6 +169,7 @@ function buildProfileEntry(apiUrl, envVarName, token) {
169
169
  TACIT_TOKEN: token ?? `\${${envVarName}}`,
170
170
  TACIT_API_URL: apiUrl,
171
171
  TACIT_APP_URL: deriveAppUrl(apiUrl),
172
+ TACIT_PROFILE: '${TACIT_PROFILE}',
172
173
  },
173
174
  };
174
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tacitai/mcp-server",
3
- "version": "0.6.46",
3
+ "version": "0.6.48",
4
4
  "description": "stdio MCP server wrapping Tacit /api/v1 REST/SSE API",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {