@agentvalet/register 0.4.1 → 0.4.3
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/index.js
CHANGED
|
@@ -277,6 +277,84 @@ Dashboard: https://app.agentvalet.ai
|
|
|
277
277
|
console.log(chalk2.green(" \u2713 SKILL.md created in current directory"));
|
|
278
278
|
console.log(chalk2.dim(" Commit this file to your repo"));
|
|
279
279
|
}
|
|
280
|
+
function writeQuickstartDoc(opts) {
|
|
281
|
+
const dest = path.join(process.cwd(), "AGENTVALET.md");
|
|
282
|
+
if (existsSync(dest)) {
|
|
283
|
+
console.log(chalk2.dim(" AGENTVALET.md already exists \u2014 skipping"));
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const { agentId, ownerId, proxyUrl, keyPath, detected } = opts;
|
|
287
|
+
const ideSection = (() => {
|
|
288
|
+
const lines = [];
|
|
289
|
+
if (detected.cursor) {
|
|
290
|
+
lines.push(`### Cursor
|
|
291
|
+
The \`.mcp.json\` in this directory has been configured. Restart Cursor and the AgentValet MCP server will start automatically.`);
|
|
292
|
+
}
|
|
293
|
+
if (detected.claudeCode) {
|
|
294
|
+
lines.push(`### Claude Code
|
|
295
|
+
The \`.mcp.json\` in this directory has been configured. Run \`/mcp\` in Claude Code to verify \`agentvalet\` appears in the list.`);
|
|
296
|
+
}
|
|
297
|
+
if (detected.codex) {
|
|
298
|
+
lines.push(`### Codex
|
|
299
|
+
\`~/.codex/config.toml\` has been updated with the MCP server block. See \`AGENTS.md\` for platform call instructions.`);
|
|
300
|
+
}
|
|
301
|
+
if (detected.openclaw) {
|
|
302
|
+
lines.push(`### OpenClaw
|
|
303
|
+
See \`SKILL.md\` for platform call instructions.`);
|
|
304
|
+
}
|
|
305
|
+
if (lines.length === 0) {
|
|
306
|
+
lines.push(`Add the MCP server to your IDE manually. See: https://docs.agentvalet.ai/setup`);
|
|
307
|
+
}
|
|
308
|
+
return lines.join("\n\n");
|
|
309
|
+
})();
|
|
310
|
+
const content = `# AgentValet \u2014 Quick Reference
|
|
311
|
+
|
|
312
|
+
## This agent
|
|
313
|
+
|
|
314
|
+
| | |
|
|
315
|
+
|---|---|
|
|
316
|
+
| Agent ID | \`${agentId}\` |
|
|
317
|
+
| Owner ID | \`${ownerId}\` |
|
|
318
|
+
| Proxy URL | \`${proxyUrl}\` |
|
|
319
|
+
| Private key | \`${keyPath}\` |
|
|
320
|
+
|
|
321
|
+
Dashboard: https://app.agentvalet.ai
|
|
322
|
+
Activate or manage this agent at: https://app.agentvalet.ai/agents
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## CLI commands
|
|
327
|
+
|
|
328
|
+
| Command | What it does |
|
|
329
|
+
|---|---|
|
|
330
|
+
| \`npx @agentvalet/register\` | Register a new agent or re-run setup |
|
|
331
|
+
| \`npx @agentvalet/register refresh\` | Refresh approved platform permissions |
|
|
332
|
+
|
|
333
|
+
> These commands use \`npx\` \u2014 you do not need to install the package globally.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## IDE setup
|
|
338
|
+
|
|
339
|
+
${ideSection}
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## Environment variables
|
|
344
|
+
|
|
345
|
+
Set these wherever your IDE agent reads environment from:
|
|
346
|
+
|
|
347
|
+
\`\`\`
|
|
348
|
+
AGENT_ID=${agentId}
|
|
349
|
+
OWNER_ID=${ownerId}
|
|
350
|
+
PROXY_URL=${proxyUrl}
|
|
351
|
+
AGENT_PRIVATE_KEY_PATH=${keyPath}
|
|
352
|
+
\`\`\`
|
|
353
|
+
`;
|
|
354
|
+
writeFileSync(dest, content, "utf8");
|
|
355
|
+
console.log(chalk2.green(" \u2713 AGENTVALET.md created \u2014 quick reference for this agent"));
|
|
356
|
+
console.log(chalk2.dim(" Add to .gitignore if it contains sensitive paths"));
|
|
357
|
+
}
|
|
280
358
|
function ensureMcpServer() {
|
|
281
359
|
try {
|
|
282
360
|
execSync("npx --yes @agentvalet/mcp-server --version", {
|
|
@@ -314,12 +392,12 @@ ${platformSections}
|
|
|
314
392
|
|
|
315
393
|
## How to call a platform
|
|
316
394
|
|
|
317
|
-
All platform calls **must** go through the \`
|
|
395
|
+
All platform calls **must** go through the \`mcp__agentvalet__use_platform\` MCP tool.
|
|
318
396
|
|
|
319
397
|
**NEVER** write inline JWT signing code, \`node -e\` scripts, or manual HTTP calls. The MCP tool handles all authentication internally.
|
|
320
398
|
|
|
321
399
|
\`\`\`
|
|
322
|
-
|
|
400
|
+
mcp__agentvalet__use_platform({
|
|
323
401
|
platform: "<platformId>",
|
|
324
402
|
endpoint: "<endpoint>",
|
|
325
403
|
method: "POST",
|
|
@@ -328,7 +406,7 @@ mcp__agent-authority__use_platform({
|
|
|
328
406
|
})
|
|
329
407
|
\`\`\`
|
|
330
408
|
|
|
331
|
-
To refresh this file: \`agentvalet
|
|
409
|
+
To refresh this file: \`npx @agentvalet/register refresh\`
|
|
332
410
|
`;
|
|
333
411
|
}
|
|
334
412
|
|
|
@@ -518,7 +596,7 @@ function ensureHook() {
|
|
|
518
596
|
}
|
|
519
597
|
const perms = settings.permissions ?? {};
|
|
520
598
|
const allow = perms.allow ?? [];
|
|
521
|
-
const mcpAllows = ["
|
|
599
|
+
const mcpAllows = ["mcp__agentvalet__list_platforms", "mcp__agentvalet__use_platform"];
|
|
522
600
|
const missing = mcpAllows.filter((e) => !allow.includes(e));
|
|
523
601
|
if (missing.length > 0) {
|
|
524
602
|
perms.allow = [...allow, ...missing];
|
|
@@ -539,7 +617,7 @@ function ensureMcpJson() {
|
|
|
539
617
|
}
|
|
540
618
|
}
|
|
541
619
|
const servers = mcpConfig.mcpServers ?? {};
|
|
542
|
-
if (servers["
|
|
620
|
+
if (servers["agentvalet"]) return;
|
|
543
621
|
let agentId;
|
|
544
622
|
let ownerId;
|
|
545
623
|
let apiUrl = "https://api.agentvalet.ai";
|
|
@@ -574,7 +652,7 @@ function ensureMcpJson() {
|
|
|
574
652
|
}
|
|
575
653
|
}
|
|
576
654
|
if (!agentId || !ownerId || !keyPath) return;
|
|
577
|
-
servers["
|
|
655
|
+
servers["agentvalet"] = {
|
|
578
656
|
command: "npx",
|
|
579
657
|
args: ["-y", "@agentvalet/register", "mcp-server"],
|
|
580
658
|
env: {
|
|
@@ -818,10 +896,10 @@ Never call platform APIs (Slack, Stripe, Gmail, GitHub, etc.) directly.
|
|
|
818
896
|
|
|
819
897
|
## Making a platform call
|
|
820
898
|
|
|
821
|
-
Use the \`
|
|
899
|
+
Use the \`mcp__agentvalet__use_platform\` MCP tool:
|
|
822
900
|
|
|
823
901
|
\`\`\`
|
|
824
|
-
|
|
902
|
+
mcp__agentvalet__use_platform({
|
|
825
903
|
platform: "slack",
|
|
826
904
|
endpoint: "/api/chat.postMessage",
|
|
827
905
|
method: "POST",
|
|
@@ -832,8 +910,8 @@ mcp__agent-authority__use_platform({
|
|
|
832
910
|
|
|
833
911
|
## Before any platform session
|
|
834
912
|
|
|
835
|
-
1. Call \`
|
|
836
|
-
2. Call \`
|
|
913
|
+
1. Call \`mcp__agentvalet__list_platforms\` to see approved platforms and scopes
|
|
914
|
+
2. Call \`mcp__agentvalet__authzen_evaluate\` before destructive operations
|
|
837
915
|
3. If a call returns \`pending_approval\` \u2014 wait, do not retry
|
|
838
916
|
|
|
839
917
|
## Rules
|
|
@@ -1209,6 +1287,13 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1209
1287
|
if (detected.openclaw) {
|
|
1210
1288
|
writeSkillMd();
|
|
1211
1289
|
}
|
|
1290
|
+
writeQuickstartDoc({
|
|
1291
|
+
agentId: agent.agent_id,
|
|
1292
|
+
ownerId,
|
|
1293
|
+
proxyUrl,
|
|
1294
|
+
keyPath,
|
|
1295
|
+
detected
|
|
1296
|
+
});
|
|
1212
1297
|
ensureMcpServer();
|
|
1213
1298
|
} else if (shouldSetup === false) {
|
|
1214
1299
|
console.log("");
|
|
@@ -1235,6 +1320,10 @@ async function registerAgentFlow(apiKey, ownerId) {
|
|
|
1235
1320
|
);
|
|
1236
1321
|
console.log(chalk6.dim(" Approve this agent in your dashboard to activate it."));
|
|
1237
1322
|
console.log("");
|
|
1323
|
+
console.log(" Useful commands:");
|
|
1324
|
+
console.log(chalk6.dim(" npx @agentvalet/register \u2014 register another agent"));
|
|
1325
|
+
console.log(chalk6.dim(" npx @agentvalet/register refresh \u2014 refresh approved permissions"));
|
|
1326
|
+
console.log("");
|
|
1238
1327
|
}
|
|
1239
1328
|
function showCredentials(config) {
|
|
1240
1329
|
console.log("");
|
|
@@ -1419,7 +1508,7 @@ program.command("refresh").description("Refresh approved permissions and update
|
|
|
1419
1508
|
}
|
|
1420
1509
|
});
|
|
1421
1510
|
program.command("mcp-server").description("Start the AgentValet MCP server (stdio transport)").action(async () => {
|
|
1422
|
-
await import("./mcp-server-
|
|
1511
|
+
await import("./mcp-server-SBGWYBP7.js");
|
|
1423
1512
|
});
|
|
1424
1513
|
program.parseAsync().catch((err) => {
|
|
1425
1514
|
console.error(err);
|
|
@@ -8,7 +8,7 @@ if (!process.env.AGENT_PRIVATE_KEY && process.env.AGENT_PRIVATE_KEY_PATH) {
|
|
|
8
8
|
try {
|
|
9
9
|
process.env.AGENT_PRIVATE_KEY = readFileSync(process.env.AGENT_PRIVATE_KEY_PATH, "utf-8").trim();
|
|
10
10
|
} catch (err) {
|
|
11
|
-
process.stderr.write(`[
|
|
11
|
+
process.stderr.write(`[agentvalet] Cannot read AGENT_PRIVATE_KEY_PATH: ${err instanceof Error ? err.message : err}
|
|
12
12
|
`);
|
|
13
13
|
process.exit(1);
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ if (!process.env.AGENT_PRIVATE_KEY && process.env.AGENT_PRIVATE_KEY_PATH) {
|
|
|
16
16
|
var REQUIRED = ["AGENT_PRIVATE_KEY", "AGENT_ID", "OWNER_ID", "PROXY_URL"];
|
|
17
17
|
for (const key of REQUIRED) {
|
|
18
18
|
if (!process.env[key]) {
|
|
19
|
-
process.stderr.write(`[
|
|
19
|
+
process.stderr.write(`[agentvalet] Missing env var: ${key}
|
|
20
20
|
`);
|
|
21
21
|
process.exit(1);
|
|
22
22
|
}
|
|
@@ -65,7 +65,7 @@ function errResult(msg) {
|
|
|
65
65
|
}
|
|
66
66
|
var ALLOWED_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
67
67
|
var server = new Server(
|
|
68
|
-
{ name: "
|
|
68
|
+
{ name: "agentvalet", version: "1.0.0" },
|
|
69
69
|
{ capabilities: { tools: {} } }
|
|
70
70
|
);
|
|
71
71
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|