@vicaura/agent 0.1.0 → 0.1.1
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/package.json +1 -1
- package/src/cli.mjs +13 -5
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -107,6 +107,7 @@ async function installSkill(client, options) {
|
|
|
107
107
|
|
|
108
108
|
async function configureMcp(client, options) {
|
|
109
109
|
const current = mcpConfig(client, options.serverName);
|
|
110
|
+
let loginHandledByAdd = false;
|
|
110
111
|
if (current.exists && current.url === options.mcpUrl) {
|
|
111
112
|
ok(`${label(client)} MCP connection is current`);
|
|
112
113
|
} else {
|
|
@@ -117,7 +118,7 @@ async function configureMcp(client, options) {
|
|
|
117
118
|
change(`${current.exists ? "Replace" : "Add"} ${label(client)} MCP connection: ${options.mcpUrl}`);
|
|
118
119
|
} else {
|
|
119
120
|
if (current.exists) removeMcp(client, options.serverName);
|
|
120
|
-
addMcp(client, options.mcpUrl, options.serverName);
|
|
121
|
+
loginHandledByAdd = addMcp(client, options.mcpUrl, options.serverName, options.login);
|
|
121
122
|
ok(`${label(client)} MCP connection registered`);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
@@ -125,7 +126,7 @@ async function configureMcp(client, options) {
|
|
|
125
126
|
// `update` must remain non-interactive when the server registration is
|
|
126
127
|
// already healthy. `install` performs the initial OAuth hand-off; users can
|
|
127
128
|
// explicitly reconnect later with the command printed by `doctor`.
|
|
128
|
-
if (client === "codex" && options.login && options.command === "install" && !options.dryRun) {
|
|
129
|
+
if (client === "codex" && options.login && options.command === "install" && !options.dryRun && !loginHandledByAdd) {
|
|
129
130
|
const login = runClient("codex", ["mcp", "login", options.serverName, "--oauth-client-registration", "DCR"], "inherit");
|
|
130
131
|
if (login.status !== 0) throw new Error(`Codex OAuth did not complete. Run \`codex mcp login ${options.serverName} --oauth-client-registration DCR\` to retry.`);
|
|
131
132
|
ok("Codex OAuth completed");
|
|
@@ -186,11 +187,18 @@ function mcpConfig(client, serverName) {
|
|
|
186
187
|
return { exists: true, url: match?.[0]?.replace(/\/$/, "") ?? null };
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
function addMcp(client, url, serverName) {
|
|
190
|
+
function addMcp(client, url, serverName, login) {
|
|
191
|
+
const immediateCodexLogin = client === "codex" && login && codexAddSupportsOAuthRegistration();
|
|
190
192
|
const result = client === "codex"
|
|
191
|
-
? runClient("codex", ["mcp", "add", serverName, "--url", url], "inherit")
|
|
193
|
+
? runClient("codex", ["mcp", "add", serverName, ...(immediateCodexLogin ? ["--oauth-client-registration", "DCR"] : []), "--url", url], "inherit")
|
|
192
194
|
: runClient("claude", ["mcp", "add", "--transport", "http", "--scope", "user", serverName, url], "inherit");
|
|
193
195
|
if (result.status !== 0) throw new Error(`${label(client)} could not register the Vicaura MCP connection`);
|
|
196
|
+
return immediateCodexLogin;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function codexAddSupportsOAuthRegistration() {
|
|
200
|
+
const help = runClient("codex", ["mcp", "add", "--help"], "pipe");
|
|
201
|
+
return help.status === 0 && help.stdout.includes("--oauth-client-registration");
|
|
194
202
|
}
|
|
195
203
|
|
|
196
204
|
function removeMcp(client, serverName) {
|
|
@@ -270,7 +278,7 @@ Options:
|
|
|
270
278
|
--client <auto|all|codex|claude|codex,claude>
|
|
271
279
|
--mcp-url <url> Vicaura MCP endpoint (default: ${DEFAULT_MCP_URL})
|
|
272
280
|
--server-name <name> MCP entry name (default: ${DEFAULT_SERVER_NAME})
|
|
273
|
-
--no-login
|
|
281
|
+
--no-login Skip the explicit OAuth hand-off when the client permits it
|
|
274
282
|
--force Back up and replace a conflicting Vicaura entry
|
|
275
283
|
--dry-run Print intended changes only
|
|
276
284
|
--help Show this help`);
|