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