@tacitai/mcp-server 0.6.47 → 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 +27 -1
- package/dist/client.js +1 -1
- package/dist/setup.js +1 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@ 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');
|
|
@@ -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) {
|
|
@@ -142,6 +167,7 @@ async function cmdLaunch(name, extraArgs) {
|
|
|
142
167
|
if (model) {
|
|
143
168
|
claudeArgs.push('--model', model);
|
|
144
169
|
}
|
|
170
|
+
migrateMcpProfilePassthrough();
|
|
145
171
|
const child = spawn('claude', claudeArgs, {
|
|
146
172
|
stdio: 'inherit',
|
|
147
173
|
env: { ...process.env, TACIT_PROFILE: name },
|
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