@vapi-network/cli 0.9.7 → 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 +304 -32
- package/dist/cli.js.map +3 -3
- package/dist/index.js +304 -32
- package/dist/index.js.map +3 -3
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40526,14 +40526,14 @@ function assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLen
|
|
|
40526
40526
|
}
|
|
40527
40527
|
}
|
|
40528
40528
|
function addEncoderSizePrefix(encoder5, prefix) {
|
|
40529
|
-
const
|
|
40529
|
+
const write2 = ((value, bytes, offset) => {
|
|
40530
40530
|
const encoderBytes = encoder5.encode(value);
|
|
40531
40531
|
offset = prefix.write(encoderBytes.length, bytes, offset);
|
|
40532
40532
|
bytes.set(encoderBytes, offset);
|
|
40533
40533
|
return offset + encoderBytes.length;
|
|
40534
40534
|
});
|
|
40535
40535
|
if (isFixedSize(prefix) && isFixedSize(encoder5)) {
|
|
40536
|
-
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write });
|
|
40536
|
+
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write: write2 });
|
|
40537
40537
|
}
|
|
40538
40538
|
const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
|
|
40539
40539
|
const encoderMaxSize = isFixedSize(encoder5) ? encoder5.fixedSize : encoder5.maxSize ?? null;
|
|
@@ -40545,7 +40545,7 @@ function addEncoderSizePrefix(encoder5, prefix) {
|
|
|
40545
40545
|
const encoderSize = getEncodedSize(value, encoder5);
|
|
40546
40546
|
return getEncodedSize(encoderSize, prefix) + encoderSize;
|
|
40547
40547
|
},
|
|
40548
|
-
write
|
|
40548
|
+
write: write2
|
|
40549
40549
|
});
|
|
40550
40550
|
}
|
|
40551
40551
|
function addDecoderSizePrefix(decoder2, prefix) {
|
|
@@ -41381,13 +41381,13 @@ function getTupleDecoder(items) {
|
|
|
41381
41381
|
}
|
|
41382
41382
|
function getUnionEncoder(variants, getIndexFromValue) {
|
|
41383
41383
|
const fixedSize = getUnionFixedSize(variants);
|
|
41384
|
-
const
|
|
41384
|
+
const write2 = (variant, bytes, offset) => {
|
|
41385
41385
|
const index2 = getIndexFromValue(variant);
|
|
41386
41386
|
assertValidVariantIndex(variants, index2);
|
|
41387
41387
|
return variants[index2].write(variant, bytes, offset);
|
|
41388
41388
|
};
|
|
41389
41389
|
if (fixedSize !== null) {
|
|
41390
|
-
return createEncoder({ fixedSize, write });
|
|
41390
|
+
return createEncoder({ fixedSize, write: write2 });
|
|
41391
41391
|
}
|
|
41392
41392
|
const maxSize = getUnionMaxSize(variants);
|
|
41393
41393
|
return createEncoder({
|
|
@@ -41397,7 +41397,7 @@ function getUnionEncoder(variants, getIndexFromValue) {
|
|
|
41397
41397
|
assertValidVariantIndex(variants, index2);
|
|
41398
41398
|
return getEncodedSize(variant, variants[index2]);
|
|
41399
41399
|
},
|
|
41400
|
-
write
|
|
41400
|
+
write: write2
|
|
41401
41401
|
});
|
|
41402
41402
|
}
|
|
41403
41403
|
function getUnionDecoder(variants, getIndexFromBytes) {
|
|
@@ -70186,7 +70186,7 @@ function keychainStore(platform2, run) {
|
|
|
70186
70186
|
const value = withoutTrailingNewline(result.stdout);
|
|
70187
70187
|
return value.length === 0 ? void 0 : value;
|
|
70188
70188
|
};
|
|
70189
|
-
const
|
|
70189
|
+
const write2 = async (account, value, what) => {
|
|
70190
70190
|
const result = await run(
|
|
70191
70191
|
SECURITY_BINARY,
|
|
70192
70192
|
[
|
|
@@ -70257,7 +70257,7 @@ ${value}
|
|
|
70257
70257
|
const account = accountFor(name);
|
|
70258
70258
|
const what = `store the passphrase of ${name} in the macOS Keychain`;
|
|
70259
70259
|
if (passphrase.length <= KEYCHAIN_PROMPT_LIMIT) {
|
|
70260
|
-
await
|
|
70260
|
+
await write2(account, passphrase, what);
|
|
70261
70261
|
return;
|
|
70262
70262
|
}
|
|
70263
70263
|
const chunks = [];
|
|
@@ -70268,10 +70268,10 @@ ${value}
|
|
|
70268
70268
|
throw new KeystoreError(`The secret ${name} is too long for the macOS Keychain.`);
|
|
70269
70269
|
}
|
|
70270
70270
|
for (const [index2, chunk] of chunks.entries()) {
|
|
70271
|
-
await
|
|
70271
|
+
await write2(keychainPart(account, index2 + 1), chunk, what);
|
|
70272
70272
|
}
|
|
70273
70273
|
await erasePartsAfter(account, chunks.length, what);
|
|
70274
|
-
await
|
|
70274
|
+
await write2(account, `${CHUNKED_MARKER}${chunks.length}`, what);
|
|
70275
70275
|
},
|
|
70276
70276
|
async remove(name) {
|
|
70277
70277
|
const account = accountFor(name);
|
|
@@ -77604,7 +77604,7 @@ function createRunBudget(args) {
|
|
|
77604
77604
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
77605
77605
|
import { arch, platform, release } from "node:os";
|
|
77606
77606
|
import { join as join13 } from "node:path";
|
|
77607
|
-
var VAPI_CLIENT_VERSION = "0.
|
|
77607
|
+
var VAPI_CLIENT_VERSION = "0.10.0";
|
|
77608
77608
|
async function createSupportReport(options) {
|
|
77609
77609
|
const message = options.message.trim();
|
|
77610
77610
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -90057,8 +90057,8 @@ var LOOP_BINDINGS = {
|
|
|
90057
90057
|
};
|
|
90058
90058
|
},
|
|
90059
90059
|
async run(input2, ctx, execution) {
|
|
90060
|
-
const
|
|
90061
|
-
const rows = await execution.deps.search(
|
|
90060
|
+
const search2 = input2;
|
|
90061
|
+
const rows = await execution.deps.search(search2);
|
|
90062
90062
|
for (const row of rows) ctx.caller.run?.searchedRefs.add(row.ref);
|
|
90063
90063
|
return rows;
|
|
90064
90064
|
}
|
|
@@ -93456,6 +93456,106 @@ function createDocsTools(options) {
|
|
|
93456
93456
|
};
|
|
93457
93457
|
}
|
|
93458
93458
|
|
|
93459
|
+
// ../mcp/src/tool-presentation.ts
|
|
93460
|
+
var SERVER_ICONS = [
|
|
93461
|
+
{
|
|
93462
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-light.png",
|
|
93463
|
+
mimeType: "image/png",
|
|
93464
|
+
sizes: ["1024x1024"],
|
|
93465
|
+
theme: "light"
|
|
93466
|
+
},
|
|
93467
|
+
{
|
|
93468
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-dark.png",
|
|
93469
|
+
mimeType: "image/png",
|
|
93470
|
+
sizes: ["1024x1024"],
|
|
93471
|
+
theme: "dark"
|
|
93472
|
+
}
|
|
93473
|
+
];
|
|
93474
|
+
var readOnly = {
|
|
93475
|
+
readOnlyHint: true,
|
|
93476
|
+
destructiveHint: false,
|
|
93477
|
+
idempotentHint: true,
|
|
93478
|
+
openWorldHint: false
|
|
93479
|
+
};
|
|
93480
|
+
var write = {
|
|
93481
|
+
readOnlyHint: false,
|
|
93482
|
+
destructiveHint: false,
|
|
93483
|
+
idempotentHint: false,
|
|
93484
|
+
openWorldHint: false
|
|
93485
|
+
};
|
|
93486
|
+
var destructive = { ...write, destructiveHint: true };
|
|
93487
|
+
var search = { ...readOnly, openWorldHint: true };
|
|
93488
|
+
var TOOL_PRESENTATION = {
|
|
93489
|
+
"docs.search": { title: "Search the vAPI docs", annotations: readOnly },
|
|
93490
|
+
"docs.read": { title: "Read a vAPI docs page", annotations: readOnly },
|
|
93491
|
+
"auth.link": {
|
|
93492
|
+
title: "Link this account to the vAPI dashboard",
|
|
93493
|
+
annotations: { ...write, idempotentHint: true }
|
|
93494
|
+
},
|
|
93495
|
+
"auth.status": { title: "Check the dashboard link", annotations: readOnly },
|
|
93496
|
+
"router.models": { title: "List Router models", annotations: readOnly },
|
|
93497
|
+
"router.usage": { title: "Show Router usage", annotations: readOnly },
|
|
93498
|
+
"router.chat": { title: "Chat through the vAPI Router", annotations: destructive },
|
|
93499
|
+
"router.buy": { title: "Buy Router balance", annotations: destructive },
|
|
93500
|
+
"tasks.search": { title: "Browse tasks", annotations: readOnly },
|
|
93501
|
+
"tasks.show": { title: "Show a task", annotations: readOnly },
|
|
93502
|
+
"tasks.post": { title: "Post a task", annotations: write },
|
|
93503
|
+
"tasks.propose": { title: "Propose on a task", annotations: write },
|
|
93504
|
+
"tasks.submit": { title: "Submit a proposal", annotations: write },
|
|
93505
|
+
"tasks.award": { title: "Award a task", annotations: write },
|
|
93506
|
+
"tasks.sign": { title: "Sign a task step", annotations: destructive },
|
|
93507
|
+
"tasks.fund": { title: "Fund escrow", annotations: destructive },
|
|
93508
|
+
"tasks.deliver": { title: "Deliver work", annotations: write },
|
|
93509
|
+
"tasks.release": { title: "Release escrow", annotations: destructive },
|
|
93510
|
+
"tasks.refund": { title: "Refund escrow", annotations: destructive },
|
|
93511
|
+
"tasks.dispute": { title: "Open a dispute", annotations: destructive },
|
|
93512
|
+
"tasks.counter-evidence": { title: "Add counter-evidence", annotations: write },
|
|
93513
|
+
"tasks.resolve-unmatched": { title: "Resolve an unmatched escrow", annotations: destructive },
|
|
93514
|
+
"tasks.message": { title: "Message a task thread", annotations: write },
|
|
93515
|
+
"tasks.thread": { title: "Read a task thread", annotations: readOnly },
|
|
93516
|
+
"tasks.watch": { title: "Watch a task", annotations: readOnly },
|
|
93517
|
+
"tasks.status": { title: "Check a task's chain status", annotations: readOnly },
|
|
93518
|
+
"vapi.status": { title: "Show the vAPI status screen", annotations: readOnly },
|
|
93519
|
+
"vapi.accounts": { title: "List vAPI accounts", annotations: readOnly },
|
|
93520
|
+
"vapi.siblings": { title: "List sibling agents", annotations: readOnly },
|
|
93521
|
+
"accounts.add": { title: "Add a local account", annotations: write },
|
|
93522
|
+
"accounts.caps": { title: "Lower an account's spend caps", annotations: write },
|
|
93523
|
+
"accounts.send": { title: "Send USDC from an account", annotations: destructive },
|
|
93524
|
+
"call.search": { title: "Search the vAPI marketplace", annotations: search },
|
|
93525
|
+
search: { title: "Search the vAPI marketplace (deprecated)", annotations: search },
|
|
93526
|
+
"call.inspect": { title: "Inspect a Call listing", annotations: readOnly },
|
|
93527
|
+
inspect: { title: "Inspect a Call listing (deprecated)", annotations: readOnly },
|
|
93528
|
+
"call.pay": { title: "Pay an x402 API", annotations: destructive },
|
|
93529
|
+
call: { title: "Pay an x402 API (deprecated)", annotations: destructive },
|
|
93530
|
+
"call.read": { title: "Read a paid origin", annotations: readOnly },
|
|
93531
|
+
"wallet.address": { title: "Show the account address", annotations: readOnly },
|
|
93532
|
+
"wallet.balance": { title: "Show the account balance", annotations: readOnly },
|
|
93533
|
+
"wallet.accounts": { title: "Show the account's addresses", annotations: readOnly },
|
|
93534
|
+
"wallet.list": { title: "List local accounts", annotations: readOnly },
|
|
93535
|
+
"wallet.use": { title: "Switch the active account", annotations: write },
|
|
93536
|
+
"wallet.fund": { title: "Fund the account", annotations: destructive },
|
|
93537
|
+
wallet: { title: "Show the account balance (deprecated)", annotations: readOnly },
|
|
93538
|
+
"receipts.list": { title: "List payment receipts", annotations: readOnly },
|
|
93539
|
+
"receipts.stats": { title: "Show receipt statistics", annotations: readOnly },
|
|
93540
|
+
"support.report": { title: "Create a local support report", annotations: write },
|
|
93541
|
+
"swarm.setup": { title: "Set up a swarm", annotations: write },
|
|
93542
|
+
"swarm.add": { title: "Add a swarm member", annotations: write },
|
|
93543
|
+
"swarm.leave": { title: "Leave a swarm", annotations: write },
|
|
93544
|
+
"swarm.fund": { title: "Fund a swarm", annotations: destructive },
|
|
93545
|
+
"swarm.rebalance": { title: "Rebalance a swarm", annotations: destructive },
|
|
93546
|
+
"swarm.status": { title: "Show swarm status", annotations: readOnly },
|
|
93547
|
+
"swarm.dissolve": { title: "Dissolve a swarm", annotations: destructive },
|
|
93548
|
+
"swarm.run": { title: "Run a swarm", annotations: destructive },
|
|
93549
|
+
"swarm.allocate": { title: "Allocate swarm budget", annotations: destructive },
|
|
93550
|
+
"swarm.delegate": { title: "Delegate a swarm task", annotations: destructive },
|
|
93551
|
+
"swarm.runs": { title: "List swarm runs", annotations: readOnly }
|
|
93552
|
+
};
|
|
93553
|
+
function withPresentation(tool) {
|
|
93554
|
+
const presentation = Object.hasOwn(TOOL_PRESENTATION, tool.name) ? TOOL_PRESENTATION[tool.name] : void 0;
|
|
93555
|
+
if (!presentation) throw new Error(`no presentation for tool ${tool.name}`);
|
|
93556
|
+
return { ...tool, ...presentation };
|
|
93557
|
+
}
|
|
93558
|
+
|
|
93459
93559
|
// ../mcp/src/wallet-session.ts
|
|
93460
93560
|
var WalletSession = class {
|
|
93461
93561
|
constructor(options) {
|
|
@@ -93684,6 +93784,99 @@ var WalletSession = class {
|
|
|
93684
93784
|
}
|
|
93685
93785
|
};
|
|
93686
93786
|
|
|
93787
|
+
// ../mcp/src/views.ts
|
|
93788
|
+
var searchView = { view: "call-search", uri: "ui://vapi/call-search.html" };
|
|
93789
|
+
var inspectView = { view: "call-inspect", uri: "ui://vapi/call-inspect.html" };
|
|
93790
|
+
var MCP_APP_VIEWS = {
|
|
93791
|
+
"call.search": searchView,
|
|
93792
|
+
"call.inspect": inspectView,
|
|
93793
|
+
search: searchView,
|
|
93794
|
+
inspect: inspectView
|
|
93795
|
+
};
|
|
93796
|
+
var VIEW_RESOURCE_META = {
|
|
93797
|
+
"call-search": {
|
|
93798
|
+
title: "vAPI marketplace results",
|
|
93799
|
+
description: "Interactive list of Call listings returned by call.search."
|
|
93800
|
+
},
|
|
93801
|
+
"call-inspect": {
|
|
93802
|
+
title: "vAPI listing inspector",
|
|
93803
|
+
description: "Interactive request contract and price for one Call listing."
|
|
93804
|
+
}
|
|
93805
|
+
};
|
|
93806
|
+
function createViewLoader(options) {
|
|
93807
|
+
const origin = new URL(options.registryUrl).origin;
|
|
93808
|
+
const timeoutMs = options.timeoutMs ?? 2e3;
|
|
93809
|
+
const log = options.log ?? ((line) => process.stderr.write(`${line}
|
|
93810
|
+
`));
|
|
93811
|
+
const cache = /* @__PURE__ */ new Map();
|
|
93812
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
93813
|
+
const logged = /* @__PURE__ */ new Set();
|
|
93814
|
+
async function fetchHtml(view) {
|
|
93815
|
+
const url2 = `${origin}/mcp/apps/${view}.html`;
|
|
93816
|
+
const controller = new AbortController();
|
|
93817
|
+
let timer;
|
|
93818
|
+
const timedOut = new Promise((_resolve, reject) => {
|
|
93819
|
+
timer = setTimeout(() => {
|
|
93820
|
+
const error61 = new Error(`timed out after ${timeoutMs} ms`);
|
|
93821
|
+
reject(error61);
|
|
93822
|
+
controller.abort(error61);
|
|
93823
|
+
}, timeoutMs);
|
|
93824
|
+
});
|
|
93825
|
+
try {
|
|
93826
|
+
return await Promise.race([
|
|
93827
|
+
(async () => {
|
|
93828
|
+
const response = await options.fetchImpl(url2, {
|
|
93829
|
+
signal: controller.signal,
|
|
93830
|
+
redirect: "manual"
|
|
93831
|
+
});
|
|
93832
|
+
if (response.status !== 200) {
|
|
93833
|
+
void response.body?.cancel().catch(() => {
|
|
93834
|
+
});
|
|
93835
|
+
throw new Error(`HTTP ${response.status}`);
|
|
93836
|
+
}
|
|
93837
|
+
return await response.text();
|
|
93838
|
+
})(),
|
|
93839
|
+
timedOut
|
|
93840
|
+
]);
|
|
93841
|
+
} catch (error61) {
|
|
93842
|
+
if (!logged.has(view)) {
|
|
93843
|
+
logged.add(view);
|
|
93844
|
+
const reason = (error61 instanceof Error ? error61.message : String(error61)).replace(
|
|
93845
|
+
/[\r\n\u2028\u2029]+/gu,
|
|
93846
|
+
" "
|
|
93847
|
+
);
|
|
93848
|
+
try {
|
|
93849
|
+
log(`vapi mcp: could not load view ${view} from ${url2}: ${reason}`);
|
|
93850
|
+
} catch {
|
|
93851
|
+
}
|
|
93852
|
+
}
|
|
93853
|
+
return void 0;
|
|
93854
|
+
} finally {
|
|
93855
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
93856
|
+
}
|
|
93857
|
+
}
|
|
93858
|
+
function load(view) {
|
|
93859
|
+
const html = cache.get(view);
|
|
93860
|
+
if (html !== void 0) return Promise.resolve(html);
|
|
93861
|
+
const pending = inFlight.get(view);
|
|
93862
|
+
if (pending) return pending;
|
|
93863
|
+
const request = fetchHtml(view).then((html2) => {
|
|
93864
|
+
if (html2 !== void 0) cache.set(view, html2);
|
|
93865
|
+
return html2;
|
|
93866
|
+
}).finally(() => inFlight.delete(view));
|
|
93867
|
+
inFlight.set(view, request);
|
|
93868
|
+
return request;
|
|
93869
|
+
}
|
|
93870
|
+
return {
|
|
93871
|
+
origin,
|
|
93872
|
+
load,
|
|
93873
|
+
get: (view) => cache.get(view),
|
|
93874
|
+
async warm() {
|
|
93875
|
+
await Promise.allSettled([load("call-search"), load("call-inspect")]);
|
|
93876
|
+
}
|
|
93877
|
+
};
|
|
93878
|
+
}
|
|
93879
|
+
|
|
93687
93880
|
// ../mcp/src/server.ts
|
|
93688
93881
|
var allWalletsArgument = {
|
|
93689
93882
|
allWallets: external_exports.boolean().optional().describe("Read every account's rows instead of one account's.")
|
|
@@ -93824,16 +94017,50 @@ function objectOutputSchema(schema) {
|
|
|
93824
94017
|
const json2 = external_exports.toJSONSchema(schema);
|
|
93825
94018
|
return json2.type === "object" ? { outputSchema: json2 } : {};
|
|
93826
94019
|
}
|
|
94020
|
+
function appViewForTool(name) {
|
|
94021
|
+
return Object.hasOwn(MCP_APP_VIEWS, name) ? MCP_APP_VIEWS[name] : void 0;
|
|
94022
|
+
}
|
|
94023
|
+
function appViewResource({ view, uri }, origin) {
|
|
94024
|
+
return {
|
|
94025
|
+
uri,
|
|
94026
|
+
name: `vapi-${view}`,
|
|
94027
|
+
...VIEW_RESOURCE_META[view],
|
|
94028
|
+
mimeType: "text/html;profile=mcp-app",
|
|
94029
|
+
_meta: {
|
|
94030
|
+
ui: {
|
|
94031
|
+
csp: {
|
|
94032
|
+
connectDomains: [origin],
|
|
94033
|
+
resourceDomains: ["https://assets.claude.ai", origin]
|
|
94034
|
+
},
|
|
94035
|
+
prefersBorder: view === "call-inspect"
|
|
94036
|
+
}
|
|
94037
|
+
}
|
|
94038
|
+
};
|
|
94039
|
+
}
|
|
93827
94040
|
var VapiMcpServer = class {
|
|
93828
94041
|
#tools = /* @__PURE__ */ new Map();
|
|
93829
94042
|
#onClose;
|
|
93830
94043
|
#stdio;
|
|
94044
|
+
#views;
|
|
94045
|
+
#viewSequence = 0;
|
|
93831
94046
|
constructor(onClose) {
|
|
93832
94047
|
this.#onClose = onClose;
|
|
93833
94048
|
}
|
|
94049
|
+
useViews(loader) {
|
|
94050
|
+
this.#views = loader;
|
|
94051
|
+
}
|
|
94052
|
+
#resources() {
|
|
94053
|
+
const loader = this.#views;
|
|
94054
|
+
return loader ? [MCP_APP_VIEWS["call.search"], MCP_APP_VIEWS["call.inspect"]].map(
|
|
94055
|
+
(view) => appViewResource(view, loader.origin)
|
|
94056
|
+
) : [];
|
|
94057
|
+
}
|
|
93834
94058
|
registerTool(name, definition, handler) {
|
|
94059
|
+
const presentation = definition.title !== void 0 && definition.annotations !== void 0 ? { title: definition.title, annotations: definition.annotations } : withPresentation({ name, ...definition });
|
|
93835
94060
|
const inputSchema = definition.strictInput ? external_exports.strictObject(definition.inputSchema) : external_exports.object(definition.inputSchema);
|
|
93836
94061
|
this.#tools.set(name, {
|
|
94062
|
+
title: presentation.title,
|
|
94063
|
+
annotations: presentation.annotations,
|
|
93837
94064
|
...definition.description ? { description: definition.description } : {},
|
|
93838
94065
|
...definition.deprecatedReplacement ? { deprecatedReplacement: definition.deprecatedReplacement } : {},
|
|
93839
94066
|
inputSchema,
|
|
@@ -93843,12 +94070,19 @@ var VapiMcpServer = class {
|
|
|
93843
94070
|
}
|
|
93844
94071
|
async listTools() {
|
|
93845
94072
|
return {
|
|
93846
|
-
tools: [...this.#tools].map(([name, tool]) =>
|
|
93847
|
-
name
|
|
93848
|
-
|
|
93849
|
-
|
|
93850
|
-
|
|
93851
|
-
|
|
94073
|
+
tools: [...this.#tools].map(([name, tool]) => {
|
|
94074
|
+
const view = appViewForTool(name);
|
|
94075
|
+
const uri = view && this.#views?.get(view.view) !== void 0 ? view.uri : void 0;
|
|
94076
|
+
return {
|
|
94077
|
+
name,
|
|
94078
|
+
title: tool.title,
|
|
94079
|
+
annotations: tool.annotations,
|
|
94080
|
+
...tool.description ? { description: tool.description } : {},
|
|
94081
|
+
inputSchema: external_exports.toJSONSchema(tool.inputSchema),
|
|
94082
|
+
...objectOutputSchema(tool.outputSchema),
|
|
94083
|
+
...uri === void 0 ? {} : { _meta: { ui: { resourceUri: uri }, "ui/resourceUri": uri } }
|
|
94084
|
+
};
|
|
94085
|
+
})
|
|
93852
94086
|
};
|
|
93853
94087
|
}
|
|
93854
94088
|
async callTool(request) {
|
|
@@ -93860,7 +94094,16 @@ var VapiMcpServer = class {
|
|
|
93860
94094
|
};
|
|
93861
94095
|
}
|
|
93862
94096
|
try {
|
|
93863
|
-
|
|
94097
|
+
let result = await tool.handler(request.arguments ?? {});
|
|
94098
|
+
if (!result.isError && appViewForTool(request.name)) {
|
|
94099
|
+
result = {
|
|
94100
|
+
...result,
|
|
94101
|
+
structuredContent: {
|
|
94102
|
+
...result.structuredContent,
|
|
94103
|
+
_view: { createdAt: Date.now(), seq: ++this.#viewSequence }
|
|
94104
|
+
}
|
|
94105
|
+
};
|
|
94106
|
+
}
|
|
93864
94107
|
return tool.deprecatedReplacement ? withDeprecation(result, tool.deprecatedReplacement) : result;
|
|
93865
94108
|
} catch (error61) {
|
|
93866
94109
|
const result = request.name.startsWith("tasks.") ? tasksErrorResult(error61) : toolError(error61);
|
|
@@ -93892,17 +94135,44 @@ var VapiMcpServer = class {
|
|
|
93892
94135
|
this.#write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } });
|
|
93893
94136
|
return;
|
|
93894
94137
|
}
|
|
94138
|
+
const response = await this.handleRequest(request);
|
|
94139
|
+
if (response !== void 0) this.#write(response);
|
|
94140
|
+
}
|
|
94141
|
+
async handleRequest(request) {
|
|
93895
94142
|
const id2 = request.id;
|
|
93896
94143
|
const method = request.method;
|
|
93897
94144
|
if (typeof method !== "string" || id2 === void 0) return;
|
|
93898
94145
|
try {
|
|
93899
94146
|
let result;
|
|
93900
94147
|
if (method === "initialize") {
|
|
94148
|
+
await this.#views?.warm();
|
|
93901
94149
|
const params = asRecord2(request.params);
|
|
93902
94150
|
result = {
|
|
93903
94151
|
protocolVersion: typeof params?.protocolVersion === "string" ? params.protocolVersion : "2025-11-25",
|
|
93904
|
-
capabilities: { tools: {} },
|
|
93905
|
-
serverInfo: {
|
|
94152
|
+
capabilities: { tools: {}, ...this.#views ? { resources: {} } : {} },
|
|
94153
|
+
serverInfo: {
|
|
94154
|
+
name: "@vapi-network/mcp",
|
|
94155
|
+
title: "vAPI Network",
|
|
94156
|
+
version: VAPI_CLIENT_VERSION,
|
|
94157
|
+
websiteUrl: "https://vapinetwork.ai",
|
|
94158
|
+
icons: SERVER_ICONS
|
|
94159
|
+
}
|
|
94160
|
+
};
|
|
94161
|
+
} else if (method === "resources/list") {
|
|
94162
|
+
result = { resources: this.#resources() };
|
|
94163
|
+
} else if (method === "resources/read") {
|
|
94164
|
+
const params = asRecord2(request.params);
|
|
94165
|
+
const view = Object.values(MCP_APP_VIEWS).find((view2) => view2.uri === params?.uri);
|
|
94166
|
+
if (!this.#views || !view) {
|
|
94167
|
+
return { jsonrpc: "2.0", id: id2, error: { code: -32002, message: "resource not found" } };
|
|
94168
|
+
}
|
|
94169
|
+
const html = await this.#views.load(view.view);
|
|
94170
|
+
if (html === void 0) throw new Error(`view ${view.view} is unavailable`);
|
|
94171
|
+
const resource = appViewResource(view, this.#views.origin);
|
|
94172
|
+
result = {
|
|
94173
|
+
contents: [
|
|
94174
|
+
{ uri: resource.uri, mimeType: resource.mimeType, text: html, _meta: resource._meta }
|
|
94175
|
+
]
|
|
93906
94176
|
};
|
|
93907
94177
|
} else if (method === "tools/list") {
|
|
93908
94178
|
result = await this.listTools();
|
|
@@ -93915,20 +94185,19 @@ var VapiMcpServer = class {
|
|
|
93915
94185
|
} else if (method === "ping") {
|
|
93916
94186
|
result = {};
|
|
93917
94187
|
} else {
|
|
93918
|
-
|
|
94188
|
+
return {
|
|
93919
94189
|
jsonrpc: "2.0",
|
|
93920
94190
|
id: id2,
|
|
93921
94191
|
error: { code: -32601, message: `Method not found: ${method}` }
|
|
93922
|
-
}
|
|
93923
|
-
return;
|
|
94192
|
+
};
|
|
93924
94193
|
}
|
|
93925
|
-
|
|
94194
|
+
return { jsonrpc: "2.0", id: id2, result };
|
|
93926
94195
|
} catch (error61) {
|
|
93927
|
-
|
|
94196
|
+
return {
|
|
93928
94197
|
jsonrpc: "2.0",
|
|
93929
94198
|
id: id2,
|
|
93930
94199
|
error: { code: -32603, message: error61 instanceof Error ? error61.message : String(error61) }
|
|
93931
|
-
}
|
|
94200
|
+
};
|
|
93932
94201
|
}
|
|
93933
94202
|
}
|
|
93934
94203
|
#write(message) {
|
|
@@ -93967,6 +94236,7 @@ function createVapiServer(options = {}) {
|
|
|
93967
94236
|
});
|
|
93968
94237
|
const guardedFetch2 = options.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: config2.allowPrivateNetwork ?? false });
|
|
93969
94238
|
const apiBase = options.agentLink?.apiBase ?? agentApiBase(config2, options.env);
|
|
94239
|
+
server.useViews(createViewLoader({ registryUrl: apiBase, fetchImpl: guardedFetch2 }));
|
|
93970
94240
|
const auth = createAuthTools({
|
|
93971
94241
|
session,
|
|
93972
94242
|
secrets,
|
|
@@ -94343,7 +94613,9 @@ function createVapiServer(options = {}) {
|
|
|
94343
94613
|
const tool = {
|
|
94344
94614
|
description: action.description,
|
|
94345
94615
|
inputSchema: action.input.shape,
|
|
94346
|
-
outputSchema: action.output
|
|
94616
|
+
outputSchema: appViewForTool(action.name) && action.output instanceof external_exports.ZodObject ? action.output.extend({
|
|
94617
|
+
_view: external_exports.object({ createdAt: external_exports.number(), seq: external_exports.number().int() }).optional()
|
|
94618
|
+
}) : action.output
|
|
94347
94619
|
};
|
|
94348
94620
|
const handler = async (input2) => asStructuredToolResult(() => runAction(registeredAction, input2, actionContext));
|
|
94349
94621
|
server.registerTool(action.name, tool, handler);
|
|
@@ -98304,7 +98576,7 @@ async function readProcessStdin() {
|
|
|
98304
98576
|
}
|
|
98305
98577
|
|
|
98306
98578
|
// src/version.ts
|
|
98307
|
-
var CLI_VERSION = "0.
|
|
98579
|
+
var CLI_VERSION = "0.10.0";
|
|
98308
98580
|
|
|
98309
98581
|
// src/status.ts
|
|
98310
98582
|
async function statusCommand(argv, json2, io, dependencies) {
|
|
@@ -102457,9 +102729,9 @@ async function buildAgentRunDeps(input2) {
|
|
|
102457
102729
|
})
|
|
102458
102730
|
}
|
|
102459
102731
|
});
|
|
102460
|
-
const
|
|
102732
|
+
const search2 = runDependencies.search;
|
|
102461
102733
|
runDependencies.search = async (query) => {
|
|
102462
|
-
const rows = await
|
|
102734
|
+
const rows = await search2(query);
|
|
102463
102735
|
for (const row of rows) listingNames.set(row.ref, row.name);
|
|
102464
102736
|
return rows;
|
|
102465
102737
|
};
|