@vapi-network/cli 0.9.6 → 0.10.0
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 +312 -38
- package/dist/cli.js.map +3 -3
- package/dist/index.js +312 -38
- package/dist/index.js.map +3 -3
- package/dist/publish-client.d.ts +10 -2
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -40525,14 +40525,14 @@ function assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLen
|
|
|
40525
40525
|
}
|
|
40526
40526
|
}
|
|
40527
40527
|
function addEncoderSizePrefix(encoder5, prefix) {
|
|
40528
|
-
const
|
|
40528
|
+
const write2 = ((value, bytes, offset) => {
|
|
40529
40529
|
const encoderBytes = encoder5.encode(value);
|
|
40530
40530
|
offset = prefix.write(encoderBytes.length, bytes, offset);
|
|
40531
40531
|
bytes.set(encoderBytes, offset);
|
|
40532
40532
|
return offset + encoderBytes.length;
|
|
40533
40533
|
});
|
|
40534
40534
|
if (isFixedSize(prefix) && isFixedSize(encoder5)) {
|
|
40535
|
-
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write });
|
|
40535
|
+
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write: write2 });
|
|
40536
40536
|
}
|
|
40537
40537
|
const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
|
|
40538
40538
|
const encoderMaxSize = isFixedSize(encoder5) ? encoder5.fixedSize : encoder5.maxSize ?? null;
|
|
@@ -40544,7 +40544,7 @@ function addEncoderSizePrefix(encoder5, prefix) {
|
|
|
40544
40544
|
const encoderSize = getEncodedSize(value, encoder5);
|
|
40545
40545
|
return getEncodedSize(encoderSize, prefix) + encoderSize;
|
|
40546
40546
|
},
|
|
40547
|
-
write
|
|
40547
|
+
write: write2
|
|
40548
40548
|
});
|
|
40549
40549
|
}
|
|
40550
40550
|
function addDecoderSizePrefix(decoder2, prefix) {
|
|
@@ -41380,13 +41380,13 @@ function getTupleDecoder(items) {
|
|
|
41380
41380
|
}
|
|
41381
41381
|
function getUnionEncoder(variants, getIndexFromValue) {
|
|
41382
41382
|
const fixedSize = getUnionFixedSize(variants);
|
|
41383
|
-
const
|
|
41383
|
+
const write2 = (variant, bytes, offset) => {
|
|
41384
41384
|
const index2 = getIndexFromValue(variant);
|
|
41385
41385
|
assertValidVariantIndex(variants, index2);
|
|
41386
41386
|
return variants[index2].write(variant, bytes, offset);
|
|
41387
41387
|
};
|
|
41388
41388
|
if (fixedSize !== null) {
|
|
41389
|
-
return createEncoder({ fixedSize, write });
|
|
41389
|
+
return createEncoder({ fixedSize, write: write2 });
|
|
41390
41390
|
}
|
|
41391
41391
|
const maxSize = getUnionMaxSize(variants);
|
|
41392
41392
|
return createEncoder({
|
|
@@ -41396,7 +41396,7 @@ function getUnionEncoder(variants, getIndexFromValue) {
|
|
|
41396
41396
|
assertValidVariantIndex(variants, index2);
|
|
41397
41397
|
return getEncodedSize(variant, variants[index2]);
|
|
41398
41398
|
},
|
|
41399
|
-
write
|
|
41399
|
+
write: write2
|
|
41400
41400
|
});
|
|
41401
41401
|
}
|
|
41402
41402
|
function getUnionDecoder(variants, getIndexFromBytes) {
|
|
@@ -70185,7 +70185,7 @@ function keychainStore(platform2, run) {
|
|
|
70185
70185
|
const value = withoutTrailingNewline(result.stdout);
|
|
70186
70186
|
return value.length === 0 ? void 0 : value;
|
|
70187
70187
|
};
|
|
70188
|
-
const
|
|
70188
|
+
const write2 = async (account, value, what) => {
|
|
70189
70189
|
const result = await run(
|
|
70190
70190
|
SECURITY_BINARY,
|
|
70191
70191
|
[
|
|
@@ -70256,7 +70256,7 @@ ${value}
|
|
|
70256
70256
|
const account = accountFor(name);
|
|
70257
70257
|
const what = `store the passphrase of ${name} in the macOS Keychain`;
|
|
70258
70258
|
if (passphrase.length <= KEYCHAIN_PROMPT_LIMIT) {
|
|
70259
|
-
await
|
|
70259
|
+
await write2(account, passphrase, what);
|
|
70260
70260
|
return;
|
|
70261
70261
|
}
|
|
70262
70262
|
const chunks = [];
|
|
@@ -70267,10 +70267,10 @@ ${value}
|
|
|
70267
70267
|
throw new KeystoreError(`The secret ${name} is too long for the macOS Keychain.`);
|
|
70268
70268
|
}
|
|
70269
70269
|
for (const [index2, chunk] of chunks.entries()) {
|
|
70270
|
-
await
|
|
70270
|
+
await write2(keychainPart(account, index2 + 1), chunk, what);
|
|
70271
70271
|
}
|
|
70272
70272
|
await erasePartsAfter(account, chunks.length, what);
|
|
70273
|
-
await
|
|
70273
|
+
await write2(account, `${CHUNKED_MARKER}${chunks.length}`, what);
|
|
70274
70274
|
},
|
|
70275
70275
|
async remove(name) {
|
|
70276
70276
|
const account = accountFor(name);
|
|
@@ -77603,7 +77603,7 @@ function createRunBudget(args) {
|
|
|
77603
77603
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
77604
77604
|
import { arch, platform, release } from "node:os";
|
|
77605
77605
|
import { join as join13 } from "node:path";
|
|
77606
|
-
var VAPI_CLIENT_VERSION = "0.
|
|
77606
|
+
var VAPI_CLIENT_VERSION = "0.10.0";
|
|
77607
77607
|
async function createSupportReport(options) {
|
|
77608
77608
|
const message = options.message.trim();
|
|
77609
77609
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -90062,8 +90062,8 @@ var LOOP_BINDINGS = {
|
|
|
90062
90062
|
};
|
|
90063
90063
|
},
|
|
90064
90064
|
async run(input2, ctx, execution) {
|
|
90065
|
-
const
|
|
90066
|
-
const rows = await execution.deps.search(
|
|
90065
|
+
const search2 = input2;
|
|
90066
|
+
const rows = await execution.deps.search(search2);
|
|
90067
90067
|
for (const row of rows) ctx.caller.run?.searchedRefs.add(row.ref);
|
|
90068
90068
|
return rows;
|
|
90069
90069
|
}
|
|
@@ -93461,6 +93461,106 @@ function createDocsTools(options) {
|
|
|
93461
93461
|
};
|
|
93462
93462
|
}
|
|
93463
93463
|
|
|
93464
|
+
// ../mcp/src/tool-presentation.ts
|
|
93465
|
+
var SERVER_ICONS = [
|
|
93466
|
+
{
|
|
93467
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-light.png",
|
|
93468
|
+
mimeType: "image/png",
|
|
93469
|
+
sizes: ["1024x1024"],
|
|
93470
|
+
theme: "light"
|
|
93471
|
+
},
|
|
93472
|
+
{
|
|
93473
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-dark.png",
|
|
93474
|
+
mimeType: "image/png",
|
|
93475
|
+
sizes: ["1024x1024"],
|
|
93476
|
+
theme: "dark"
|
|
93477
|
+
}
|
|
93478
|
+
];
|
|
93479
|
+
var readOnly = {
|
|
93480
|
+
readOnlyHint: true,
|
|
93481
|
+
destructiveHint: false,
|
|
93482
|
+
idempotentHint: true,
|
|
93483
|
+
openWorldHint: false
|
|
93484
|
+
};
|
|
93485
|
+
var write = {
|
|
93486
|
+
readOnlyHint: false,
|
|
93487
|
+
destructiveHint: false,
|
|
93488
|
+
idempotentHint: false,
|
|
93489
|
+
openWorldHint: false
|
|
93490
|
+
};
|
|
93491
|
+
var destructive = { ...write, destructiveHint: true };
|
|
93492
|
+
var search = { ...readOnly, openWorldHint: true };
|
|
93493
|
+
var TOOL_PRESENTATION = {
|
|
93494
|
+
"docs.search": { title: "Search the vAPI docs", annotations: readOnly },
|
|
93495
|
+
"docs.read": { title: "Read a vAPI docs page", annotations: readOnly },
|
|
93496
|
+
"auth.link": {
|
|
93497
|
+
title: "Link this account to the vAPI dashboard",
|
|
93498
|
+
annotations: { ...write, idempotentHint: true }
|
|
93499
|
+
},
|
|
93500
|
+
"auth.status": { title: "Check the dashboard link", annotations: readOnly },
|
|
93501
|
+
"router.models": { title: "List Router models", annotations: readOnly },
|
|
93502
|
+
"router.usage": { title: "Show Router usage", annotations: readOnly },
|
|
93503
|
+
"router.chat": { title: "Chat through the vAPI Router", annotations: destructive },
|
|
93504
|
+
"router.buy": { title: "Buy Router balance", annotations: destructive },
|
|
93505
|
+
"tasks.search": { title: "Browse tasks", annotations: readOnly },
|
|
93506
|
+
"tasks.show": { title: "Show a task", annotations: readOnly },
|
|
93507
|
+
"tasks.post": { title: "Post a task", annotations: write },
|
|
93508
|
+
"tasks.propose": { title: "Propose on a task", annotations: write },
|
|
93509
|
+
"tasks.submit": { title: "Submit a proposal", annotations: write },
|
|
93510
|
+
"tasks.award": { title: "Award a task", annotations: write },
|
|
93511
|
+
"tasks.sign": { title: "Sign a task step", annotations: destructive },
|
|
93512
|
+
"tasks.fund": { title: "Fund escrow", annotations: destructive },
|
|
93513
|
+
"tasks.deliver": { title: "Deliver work", annotations: write },
|
|
93514
|
+
"tasks.release": { title: "Release escrow", annotations: destructive },
|
|
93515
|
+
"tasks.refund": { title: "Refund escrow", annotations: destructive },
|
|
93516
|
+
"tasks.dispute": { title: "Open a dispute", annotations: destructive },
|
|
93517
|
+
"tasks.counter-evidence": { title: "Add counter-evidence", annotations: write },
|
|
93518
|
+
"tasks.resolve-unmatched": { title: "Resolve an unmatched escrow", annotations: destructive },
|
|
93519
|
+
"tasks.message": { title: "Message a task thread", annotations: write },
|
|
93520
|
+
"tasks.thread": { title: "Read a task thread", annotations: readOnly },
|
|
93521
|
+
"tasks.watch": { title: "Watch a task", annotations: readOnly },
|
|
93522
|
+
"tasks.status": { title: "Check a task's chain status", annotations: readOnly },
|
|
93523
|
+
"vapi.status": { title: "Show the vAPI status screen", annotations: readOnly },
|
|
93524
|
+
"vapi.accounts": { title: "List vAPI accounts", annotations: readOnly },
|
|
93525
|
+
"vapi.siblings": { title: "List sibling agents", annotations: readOnly },
|
|
93526
|
+
"accounts.add": { title: "Add a local account", annotations: write },
|
|
93527
|
+
"accounts.caps": { title: "Lower an account's spend caps", annotations: write },
|
|
93528
|
+
"accounts.send": { title: "Send USDC from an account", annotations: destructive },
|
|
93529
|
+
"call.search": { title: "Search the vAPI marketplace", annotations: search },
|
|
93530
|
+
search: { title: "Search the vAPI marketplace (deprecated)", annotations: search },
|
|
93531
|
+
"call.inspect": { title: "Inspect a Call listing", annotations: readOnly },
|
|
93532
|
+
inspect: { title: "Inspect a Call listing (deprecated)", annotations: readOnly },
|
|
93533
|
+
"call.pay": { title: "Pay an x402 API", annotations: destructive },
|
|
93534
|
+
call: { title: "Pay an x402 API (deprecated)", annotations: destructive },
|
|
93535
|
+
"call.read": { title: "Read a paid origin", annotations: readOnly },
|
|
93536
|
+
"wallet.address": { title: "Show the account address", annotations: readOnly },
|
|
93537
|
+
"wallet.balance": { title: "Show the account balance", annotations: readOnly },
|
|
93538
|
+
"wallet.accounts": { title: "Show the account's addresses", annotations: readOnly },
|
|
93539
|
+
"wallet.list": { title: "List local accounts", annotations: readOnly },
|
|
93540
|
+
"wallet.use": { title: "Switch the active account", annotations: write },
|
|
93541
|
+
"wallet.fund": { title: "Fund the account", annotations: destructive },
|
|
93542
|
+
wallet: { title: "Show the account balance (deprecated)", annotations: readOnly },
|
|
93543
|
+
"receipts.list": { title: "List payment receipts", annotations: readOnly },
|
|
93544
|
+
"receipts.stats": { title: "Show receipt statistics", annotations: readOnly },
|
|
93545
|
+
"support.report": { title: "Create a local support report", annotations: write },
|
|
93546
|
+
"swarm.setup": { title: "Set up a swarm", annotations: write },
|
|
93547
|
+
"swarm.add": { title: "Add a swarm member", annotations: write },
|
|
93548
|
+
"swarm.leave": { title: "Leave a swarm", annotations: write },
|
|
93549
|
+
"swarm.fund": { title: "Fund a swarm", annotations: destructive },
|
|
93550
|
+
"swarm.rebalance": { title: "Rebalance a swarm", annotations: destructive },
|
|
93551
|
+
"swarm.status": { title: "Show swarm status", annotations: readOnly },
|
|
93552
|
+
"swarm.dissolve": { title: "Dissolve a swarm", annotations: destructive },
|
|
93553
|
+
"swarm.run": { title: "Run a swarm", annotations: destructive },
|
|
93554
|
+
"swarm.allocate": { title: "Allocate swarm budget", annotations: destructive },
|
|
93555
|
+
"swarm.delegate": { title: "Delegate a swarm task", annotations: destructive },
|
|
93556
|
+
"swarm.runs": { title: "List swarm runs", annotations: readOnly }
|
|
93557
|
+
};
|
|
93558
|
+
function withPresentation(tool) {
|
|
93559
|
+
const presentation = Object.hasOwn(TOOL_PRESENTATION, tool.name) ? TOOL_PRESENTATION[tool.name] : void 0;
|
|
93560
|
+
if (!presentation) throw new Error(`no presentation for tool ${tool.name}`);
|
|
93561
|
+
return { ...tool, ...presentation };
|
|
93562
|
+
}
|
|
93563
|
+
|
|
93464
93564
|
// ../mcp/src/wallet-session.ts
|
|
93465
93565
|
var WalletSession = class {
|
|
93466
93566
|
constructor(options) {
|
|
@@ -93689,6 +93789,99 @@ var WalletSession = class {
|
|
|
93689
93789
|
}
|
|
93690
93790
|
};
|
|
93691
93791
|
|
|
93792
|
+
// ../mcp/src/views.ts
|
|
93793
|
+
var searchView = { view: "call-search", uri: "ui://vapi/call-search.html" };
|
|
93794
|
+
var inspectView = { view: "call-inspect", uri: "ui://vapi/call-inspect.html" };
|
|
93795
|
+
var MCP_APP_VIEWS = {
|
|
93796
|
+
"call.search": searchView,
|
|
93797
|
+
"call.inspect": inspectView,
|
|
93798
|
+
search: searchView,
|
|
93799
|
+
inspect: inspectView
|
|
93800
|
+
};
|
|
93801
|
+
var VIEW_RESOURCE_META = {
|
|
93802
|
+
"call-search": {
|
|
93803
|
+
title: "vAPI marketplace results",
|
|
93804
|
+
description: "Interactive list of Call listings returned by call.search."
|
|
93805
|
+
},
|
|
93806
|
+
"call-inspect": {
|
|
93807
|
+
title: "vAPI listing inspector",
|
|
93808
|
+
description: "Interactive request contract and price for one Call listing."
|
|
93809
|
+
}
|
|
93810
|
+
};
|
|
93811
|
+
function createViewLoader(options) {
|
|
93812
|
+
const origin = new URL(options.registryUrl).origin;
|
|
93813
|
+
const timeoutMs = options.timeoutMs ?? 2e3;
|
|
93814
|
+
const log = options.log ?? ((line) => process.stderr.write(`${line}
|
|
93815
|
+
`));
|
|
93816
|
+
const cache = /* @__PURE__ */ new Map();
|
|
93817
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
93818
|
+
const logged = /* @__PURE__ */ new Set();
|
|
93819
|
+
async function fetchHtml(view) {
|
|
93820
|
+
const url2 = `${origin}/mcp/apps/${view}.html`;
|
|
93821
|
+
const controller = new AbortController();
|
|
93822
|
+
let timer;
|
|
93823
|
+
const timedOut = new Promise((_resolve, reject) => {
|
|
93824
|
+
timer = setTimeout(() => {
|
|
93825
|
+
const error61 = new Error(`timed out after ${timeoutMs} ms`);
|
|
93826
|
+
reject(error61);
|
|
93827
|
+
controller.abort(error61);
|
|
93828
|
+
}, timeoutMs);
|
|
93829
|
+
});
|
|
93830
|
+
try {
|
|
93831
|
+
return await Promise.race([
|
|
93832
|
+
(async () => {
|
|
93833
|
+
const response = await options.fetchImpl(url2, {
|
|
93834
|
+
signal: controller.signal,
|
|
93835
|
+
redirect: "manual"
|
|
93836
|
+
});
|
|
93837
|
+
if (response.status !== 200) {
|
|
93838
|
+
void response.body?.cancel().catch(() => {
|
|
93839
|
+
});
|
|
93840
|
+
throw new Error(`HTTP ${response.status}`);
|
|
93841
|
+
}
|
|
93842
|
+
return await response.text();
|
|
93843
|
+
})(),
|
|
93844
|
+
timedOut
|
|
93845
|
+
]);
|
|
93846
|
+
} catch (error61) {
|
|
93847
|
+
if (!logged.has(view)) {
|
|
93848
|
+
logged.add(view);
|
|
93849
|
+
const reason = (error61 instanceof Error ? error61.message : String(error61)).replace(
|
|
93850
|
+
/[\r\n\u2028\u2029]+/gu,
|
|
93851
|
+
" "
|
|
93852
|
+
);
|
|
93853
|
+
try {
|
|
93854
|
+
log(`vapi mcp: could not load view ${view} from ${url2}: ${reason}`);
|
|
93855
|
+
} catch {
|
|
93856
|
+
}
|
|
93857
|
+
}
|
|
93858
|
+
return void 0;
|
|
93859
|
+
} finally {
|
|
93860
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
93861
|
+
}
|
|
93862
|
+
}
|
|
93863
|
+
function load(view) {
|
|
93864
|
+
const html = cache.get(view);
|
|
93865
|
+
if (html !== void 0) return Promise.resolve(html);
|
|
93866
|
+
const pending = inFlight.get(view);
|
|
93867
|
+
if (pending) return pending;
|
|
93868
|
+
const request = fetchHtml(view).then((html2) => {
|
|
93869
|
+
if (html2 !== void 0) cache.set(view, html2);
|
|
93870
|
+
return html2;
|
|
93871
|
+
}).finally(() => inFlight.delete(view));
|
|
93872
|
+
inFlight.set(view, request);
|
|
93873
|
+
return request;
|
|
93874
|
+
}
|
|
93875
|
+
return {
|
|
93876
|
+
origin,
|
|
93877
|
+
load,
|
|
93878
|
+
get: (view) => cache.get(view),
|
|
93879
|
+
async warm() {
|
|
93880
|
+
await Promise.allSettled([load("call-search"), load("call-inspect")]);
|
|
93881
|
+
}
|
|
93882
|
+
};
|
|
93883
|
+
}
|
|
93884
|
+
|
|
93692
93885
|
// ../mcp/src/server.ts
|
|
93693
93886
|
var allWalletsArgument = {
|
|
93694
93887
|
allWallets: external_exports.boolean().optional().describe("Read every account's rows instead of one account's.")
|
|
@@ -93829,16 +94022,50 @@ function objectOutputSchema(schema) {
|
|
|
93829
94022
|
const json2 = external_exports.toJSONSchema(schema);
|
|
93830
94023
|
return json2.type === "object" ? { outputSchema: json2 } : {};
|
|
93831
94024
|
}
|
|
94025
|
+
function appViewForTool(name) {
|
|
94026
|
+
return Object.hasOwn(MCP_APP_VIEWS, name) ? MCP_APP_VIEWS[name] : void 0;
|
|
94027
|
+
}
|
|
94028
|
+
function appViewResource({ view, uri }, origin) {
|
|
94029
|
+
return {
|
|
94030
|
+
uri,
|
|
94031
|
+
name: `vapi-${view}`,
|
|
94032
|
+
...VIEW_RESOURCE_META[view],
|
|
94033
|
+
mimeType: "text/html;profile=mcp-app",
|
|
94034
|
+
_meta: {
|
|
94035
|
+
ui: {
|
|
94036
|
+
csp: {
|
|
94037
|
+
connectDomains: [origin],
|
|
94038
|
+
resourceDomains: ["https://assets.claude.ai", origin]
|
|
94039
|
+
},
|
|
94040
|
+
prefersBorder: view === "call-inspect"
|
|
94041
|
+
}
|
|
94042
|
+
}
|
|
94043
|
+
};
|
|
94044
|
+
}
|
|
93832
94045
|
var VapiMcpServer = class {
|
|
93833
94046
|
#tools = /* @__PURE__ */ new Map();
|
|
93834
94047
|
#onClose;
|
|
93835
94048
|
#stdio;
|
|
94049
|
+
#views;
|
|
94050
|
+
#viewSequence = 0;
|
|
93836
94051
|
constructor(onClose) {
|
|
93837
94052
|
this.#onClose = onClose;
|
|
93838
94053
|
}
|
|
94054
|
+
useViews(loader) {
|
|
94055
|
+
this.#views = loader;
|
|
94056
|
+
}
|
|
94057
|
+
#resources() {
|
|
94058
|
+
const loader = this.#views;
|
|
94059
|
+
return loader ? [MCP_APP_VIEWS["call.search"], MCP_APP_VIEWS["call.inspect"]].map(
|
|
94060
|
+
(view) => appViewResource(view, loader.origin)
|
|
94061
|
+
) : [];
|
|
94062
|
+
}
|
|
93839
94063
|
registerTool(name, definition, handler) {
|
|
94064
|
+
const presentation = definition.title !== void 0 && definition.annotations !== void 0 ? { title: definition.title, annotations: definition.annotations } : withPresentation({ name, ...definition });
|
|
93840
94065
|
const inputSchema = definition.strictInput ? external_exports.strictObject(definition.inputSchema) : external_exports.object(definition.inputSchema);
|
|
93841
94066
|
this.#tools.set(name, {
|
|
94067
|
+
title: presentation.title,
|
|
94068
|
+
annotations: presentation.annotations,
|
|
93842
94069
|
...definition.description ? { description: definition.description } : {},
|
|
93843
94070
|
...definition.deprecatedReplacement ? { deprecatedReplacement: definition.deprecatedReplacement } : {},
|
|
93844
94071
|
inputSchema,
|
|
@@ -93848,12 +94075,19 @@ var VapiMcpServer = class {
|
|
|
93848
94075
|
}
|
|
93849
94076
|
async listTools() {
|
|
93850
94077
|
return {
|
|
93851
|
-
tools: [...this.#tools].map(([name, tool]) =>
|
|
93852
|
-
name
|
|
93853
|
-
|
|
93854
|
-
|
|
93855
|
-
|
|
93856
|
-
|
|
94078
|
+
tools: [...this.#tools].map(([name, tool]) => {
|
|
94079
|
+
const view = appViewForTool(name);
|
|
94080
|
+
const uri = view && this.#views?.get(view.view) !== void 0 ? view.uri : void 0;
|
|
94081
|
+
return {
|
|
94082
|
+
name,
|
|
94083
|
+
title: tool.title,
|
|
94084
|
+
annotations: tool.annotations,
|
|
94085
|
+
...tool.description ? { description: tool.description } : {},
|
|
94086
|
+
inputSchema: external_exports.toJSONSchema(tool.inputSchema),
|
|
94087
|
+
...objectOutputSchema(tool.outputSchema),
|
|
94088
|
+
...uri === void 0 ? {} : { _meta: { ui: { resourceUri: uri }, "ui/resourceUri": uri } }
|
|
94089
|
+
};
|
|
94090
|
+
})
|
|
93857
94091
|
};
|
|
93858
94092
|
}
|
|
93859
94093
|
async callTool(request) {
|
|
@@ -93865,7 +94099,16 @@ var VapiMcpServer = class {
|
|
|
93865
94099
|
};
|
|
93866
94100
|
}
|
|
93867
94101
|
try {
|
|
93868
|
-
|
|
94102
|
+
let result = await tool.handler(request.arguments ?? {});
|
|
94103
|
+
if (!result.isError && appViewForTool(request.name)) {
|
|
94104
|
+
result = {
|
|
94105
|
+
...result,
|
|
94106
|
+
structuredContent: {
|
|
94107
|
+
...result.structuredContent,
|
|
94108
|
+
_view: { createdAt: Date.now(), seq: ++this.#viewSequence }
|
|
94109
|
+
}
|
|
94110
|
+
};
|
|
94111
|
+
}
|
|
93869
94112
|
return tool.deprecatedReplacement ? withDeprecation(result, tool.deprecatedReplacement) : result;
|
|
93870
94113
|
} catch (error61) {
|
|
93871
94114
|
const result = request.name.startsWith("tasks.") ? tasksErrorResult(error61) : toolError(error61);
|
|
@@ -93897,17 +94140,44 @@ var VapiMcpServer = class {
|
|
|
93897
94140
|
this.#write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } });
|
|
93898
94141
|
return;
|
|
93899
94142
|
}
|
|
94143
|
+
const response = await this.handleRequest(request);
|
|
94144
|
+
if (response !== void 0) this.#write(response);
|
|
94145
|
+
}
|
|
94146
|
+
async handleRequest(request) {
|
|
93900
94147
|
const id2 = request.id;
|
|
93901
94148
|
const method = request.method;
|
|
93902
94149
|
if (typeof method !== "string" || id2 === void 0) return;
|
|
93903
94150
|
try {
|
|
93904
94151
|
let result;
|
|
93905
94152
|
if (method === "initialize") {
|
|
94153
|
+
await this.#views?.warm();
|
|
93906
94154
|
const params = asRecord2(request.params);
|
|
93907
94155
|
result = {
|
|
93908
94156
|
protocolVersion: typeof params?.protocolVersion === "string" ? params.protocolVersion : "2025-11-25",
|
|
93909
|
-
capabilities: { tools: {} },
|
|
93910
|
-
serverInfo: {
|
|
94157
|
+
capabilities: { tools: {}, ...this.#views ? { resources: {} } : {} },
|
|
94158
|
+
serverInfo: {
|
|
94159
|
+
name: "@vapi-network/mcp",
|
|
94160
|
+
title: "vAPI Network",
|
|
94161
|
+
version: VAPI_CLIENT_VERSION,
|
|
94162
|
+
websiteUrl: "https://vapinetwork.ai",
|
|
94163
|
+
icons: SERVER_ICONS
|
|
94164
|
+
}
|
|
94165
|
+
};
|
|
94166
|
+
} else if (method === "resources/list") {
|
|
94167
|
+
result = { resources: this.#resources() };
|
|
94168
|
+
} else if (method === "resources/read") {
|
|
94169
|
+
const params = asRecord2(request.params);
|
|
94170
|
+
const view = Object.values(MCP_APP_VIEWS).find((view2) => view2.uri === params?.uri);
|
|
94171
|
+
if (!this.#views || !view) {
|
|
94172
|
+
return { jsonrpc: "2.0", id: id2, error: { code: -32002, message: "resource not found" } };
|
|
94173
|
+
}
|
|
94174
|
+
const html = await this.#views.load(view.view);
|
|
94175
|
+
if (html === void 0) throw new Error(`view ${view.view} is unavailable`);
|
|
94176
|
+
const resource = appViewResource(view, this.#views.origin);
|
|
94177
|
+
result = {
|
|
94178
|
+
contents: [
|
|
94179
|
+
{ uri: resource.uri, mimeType: resource.mimeType, text: html, _meta: resource._meta }
|
|
94180
|
+
]
|
|
93911
94181
|
};
|
|
93912
94182
|
} else if (method === "tools/list") {
|
|
93913
94183
|
result = await this.listTools();
|
|
@@ -93920,20 +94190,19 @@ var VapiMcpServer = class {
|
|
|
93920
94190
|
} else if (method === "ping") {
|
|
93921
94191
|
result = {};
|
|
93922
94192
|
} else {
|
|
93923
|
-
|
|
94193
|
+
return {
|
|
93924
94194
|
jsonrpc: "2.0",
|
|
93925
94195
|
id: id2,
|
|
93926
94196
|
error: { code: -32601, message: `Method not found: ${method}` }
|
|
93927
|
-
}
|
|
93928
|
-
return;
|
|
94197
|
+
};
|
|
93929
94198
|
}
|
|
93930
|
-
|
|
94199
|
+
return { jsonrpc: "2.0", id: id2, result };
|
|
93931
94200
|
} catch (error61) {
|
|
93932
|
-
|
|
94201
|
+
return {
|
|
93933
94202
|
jsonrpc: "2.0",
|
|
93934
94203
|
id: id2,
|
|
93935
94204
|
error: { code: -32603, message: error61 instanceof Error ? error61.message : String(error61) }
|
|
93936
|
-
}
|
|
94205
|
+
};
|
|
93937
94206
|
}
|
|
93938
94207
|
}
|
|
93939
94208
|
#write(message) {
|
|
@@ -93972,6 +94241,7 @@ function createVapiServer(options = {}) {
|
|
|
93972
94241
|
});
|
|
93973
94242
|
const guardedFetch2 = options.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: config2.allowPrivateNetwork ?? false });
|
|
93974
94243
|
const apiBase = options.agentLink?.apiBase ?? agentApiBase(config2, options.env);
|
|
94244
|
+
server.useViews(createViewLoader({ registryUrl: apiBase, fetchImpl: guardedFetch2 }));
|
|
93975
94245
|
const auth = createAuthTools({
|
|
93976
94246
|
session,
|
|
93977
94247
|
secrets,
|
|
@@ -94348,7 +94618,9 @@ function createVapiServer(options = {}) {
|
|
|
94348
94618
|
const tool = {
|
|
94349
94619
|
description: action.description,
|
|
94350
94620
|
inputSchema: action.input.shape,
|
|
94351
|
-
outputSchema: action.output
|
|
94621
|
+
outputSchema: appViewForTool(action.name) && action.output instanceof external_exports.ZodObject ? action.output.extend({
|
|
94622
|
+
_view: external_exports.object({ createdAt: external_exports.number(), seq: external_exports.number().int() }).optional()
|
|
94623
|
+
}) : action.output
|
|
94352
94624
|
};
|
|
94353
94625
|
const handler = async (input2) => asStructuredToolResult(() => runAction(registeredAction, input2, actionContext));
|
|
94354
94626
|
server.registerTool(action.name, tool, handler);
|
|
@@ -95053,11 +95325,12 @@ function buildPayoutSiweMessage(args) {
|
|
|
95053
95325
|
);
|
|
95054
95326
|
}
|
|
95055
95327
|
function readProbeOperations(probe) {
|
|
95056
|
-
const operations = probe.operations;
|
|
95057
|
-
if (
|
|
95058
|
-
return
|
|
95059
|
-
|
|
95060
|
-
|
|
95328
|
+
const operations = (Array.isArray(probe.operations) ? probe.operations : []).filter(isOperation);
|
|
95329
|
+
if (operations.length > 0) return operations;
|
|
95330
|
+
return isOperation(probe.endpoint) ? [probe.endpoint] : [];
|
|
95331
|
+
}
|
|
95332
|
+
function isOperation(operation) {
|
|
95333
|
+
return isRecord6(operation) && typeof operation.name === "string" && operation.name.length > 0;
|
|
95061
95334
|
}
|
|
95062
95335
|
function readProbeRejection(probe) {
|
|
95063
95336
|
const rejection = probe.diagnostics?.rejection;
|
|
@@ -98308,7 +98581,7 @@ async function readProcessStdin() {
|
|
|
98308
98581
|
}
|
|
98309
98582
|
|
|
98310
98583
|
// src/version.ts
|
|
98311
|
-
var CLI_VERSION = "0.
|
|
98584
|
+
var CLI_VERSION = "0.10.0";
|
|
98312
98585
|
|
|
98313
98586
|
// src/status.ts
|
|
98314
98587
|
async function statusCommand(argv, json2, io, dependencies) {
|
|
@@ -102461,9 +102734,9 @@ async function buildAgentRunDeps(input2) {
|
|
|
102461
102734
|
})
|
|
102462
102735
|
}
|
|
102463
102736
|
});
|
|
102464
|
-
const
|
|
102737
|
+
const search2 = runDependencies.search;
|
|
102465
102738
|
runDependencies.search = async (query) => {
|
|
102466
|
-
const rows = await
|
|
102739
|
+
const rows = await search2(query);
|
|
102467
102740
|
for (const row of rows) listingNames.set(row.ref, row.name);
|
|
102468
102741
|
return rows;
|
|
102469
102742
|
};
|
|
@@ -107485,7 +107758,8 @@ function toListingEndpoint(operation, fallbackDescription) {
|
|
|
107485
107758
|
...operation.requestSchema === void 0 ? {} : { requestSchema: operation.requestSchema },
|
|
107486
107759
|
...optionalStringField(operation, "responseContentType"),
|
|
107487
107760
|
...optionalStringField(operation, "pathTemplate"),
|
|
107488
|
-
...operation.pathParameters === void 0 ? {} : { pathParameters: operation.pathParameters }
|
|
107761
|
+
...operation.pathParameters === void 0 ? {} : { pathParameters: operation.pathParameters },
|
|
107762
|
+
...optionalStringField(operation, "metadataEvidence")
|
|
107489
107763
|
};
|
|
107490
107764
|
}
|
|
107491
107765
|
function optionalStringField(operation, key2) {
|