openvisio-agent 0.3.0 → 0.3.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/bin/cli.mjs +16 -3
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -51,6 +51,19 @@ watch
|
|
|
51
51
|
|
|
52
52
|
Docs: https://www.npmjs.com/package/openvisio-agent`
|
|
53
53
|
|
|
54
|
+
// Register the `openvisio-team` MCP at USER (global) scope so it's available in
|
|
55
|
+
// every project without re-adding, and the credentials (baked into the headers)
|
|
56
|
+
// are sent on every call — no per-project prompt. Two gotchas handled here:
|
|
57
|
+
// 1. `claude mcp add` defaults to LOCAL (project) scope — pass `--scope user`.
|
|
58
|
+
// 2. `add` will NOT overwrite an existing same-named server, so a stale entry
|
|
59
|
+
// (old URL/auth) silently shadows a re-connect ("stuck on the old one").
|
|
60
|
+
// Remove it from BOTH scopes first, then add global.
|
|
61
|
+
function mcpReplace(claude, addArgs) {
|
|
62
|
+
spawnSync(claude, ['mcp', 'remove', 'openvisio-team', '-s', 'user'], { stdio: 'ignore' })
|
|
63
|
+
spawnSync(claude, ['mcp', 'remove', 'openvisio-team', '-s', 'local'], { stdio: 'ignore' })
|
|
64
|
+
spawnSync(claude, ['mcp', 'add', '--scope', 'user', ...addArgs], { stdio: 'ignore' })
|
|
65
|
+
}
|
|
66
|
+
|
|
54
67
|
async function runConnect({ positional, flags }) {
|
|
55
68
|
if (flags.backend) return runConnectBackend({ positional, flags })
|
|
56
69
|
const token = positional[0] || flags.token
|
|
@@ -67,8 +80,8 @@ async function runConnect({ positional, flags }) {
|
|
|
67
80
|
|
|
68
81
|
const claude = ensureClaude()
|
|
69
82
|
|
|
70
|
-
// Register with Claude Code
|
|
71
|
-
|
|
83
|
+
// Register with Claude Code — remove any stale entry first so a changed URL sticks.
|
|
84
|
+
mcpReplace(claude, ['--transport', 'http', 'openvisio-team', mcpUrl, '--header', `Authorization: Bearer ${key}`])
|
|
72
85
|
|
|
73
86
|
// A scoped MCP config (for the watcher's --strict-mcp-config) + a saved profile.
|
|
74
87
|
const mcpCfg = mcpConfigPath(slug)
|
|
@@ -125,7 +138,7 @@ async function runConnectBackend({ flags }) {
|
|
|
125
138
|
const claude = ensureClaude()
|
|
126
139
|
// Backend agents authenticate with the agent header pair, not a Bearer JWT.
|
|
127
140
|
const hdr = ['--header', `x-agent-api-key: ${apiKey}`, '--header', `x-agent-identifier: ${identifier}`]
|
|
128
|
-
|
|
141
|
+
mcpReplace(claude, ['--transport', 'http', 'openvisio-team', mcpUrl, ...hdr])
|
|
129
142
|
mcpConfig = mcpConfigPath(slug)
|
|
130
143
|
writeJson(mcpConfig, { mcpServers: { 'openvisio-team': { type: 'http', url: mcpUrl, headers: { 'x-agent-api-key': apiKey, 'x-agent-identifier': identifier } } } }, true)
|
|
131
144
|
}
|
package/package.json
CHANGED