vapi-network 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/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -40887,14 +40887,14 @@ function assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLen
|
|
|
40887
40887
|
}
|
|
40888
40888
|
}
|
|
40889
40889
|
function addEncoderSizePrefix(encoder5, prefix) {
|
|
40890
|
-
const
|
|
40890
|
+
const write2 = ((value, bytes, offset) => {
|
|
40891
40891
|
const encoderBytes = encoder5.encode(value);
|
|
40892
40892
|
offset = prefix.write(encoderBytes.length, bytes, offset);
|
|
40893
40893
|
bytes.set(encoderBytes, offset);
|
|
40894
40894
|
return offset + encoderBytes.length;
|
|
40895
40895
|
});
|
|
40896
40896
|
if (isFixedSize(prefix) && isFixedSize(encoder5)) {
|
|
40897
|
-
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write });
|
|
40897
|
+
return createEncoder({ ...encoder5, fixedSize: prefix.fixedSize + encoder5.fixedSize, write: write2 });
|
|
40898
40898
|
}
|
|
40899
40899
|
const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;
|
|
40900
40900
|
const encoderMaxSize = isFixedSize(encoder5) ? encoder5.fixedSize : encoder5.maxSize ?? null;
|
|
@@ -40906,7 +40906,7 @@ function addEncoderSizePrefix(encoder5, prefix) {
|
|
|
40906
40906
|
const encoderSize = getEncodedSize(value, encoder5);
|
|
40907
40907
|
return getEncodedSize(encoderSize, prefix) + encoderSize;
|
|
40908
40908
|
},
|
|
40909
|
-
write
|
|
40909
|
+
write: write2
|
|
40910
40910
|
});
|
|
40911
40911
|
}
|
|
40912
40912
|
function addDecoderSizePrefix(decoder2, prefix) {
|
|
@@ -41742,13 +41742,13 @@ function getTupleDecoder(items) {
|
|
|
41742
41742
|
}
|
|
41743
41743
|
function getUnionEncoder(variants, getIndexFromValue) {
|
|
41744
41744
|
const fixedSize = getUnionFixedSize(variants);
|
|
41745
|
-
const
|
|
41745
|
+
const write2 = (variant, bytes, offset) => {
|
|
41746
41746
|
const index2 = getIndexFromValue(variant);
|
|
41747
41747
|
assertValidVariantIndex(variants, index2);
|
|
41748
41748
|
return variants[index2].write(variant, bytes, offset);
|
|
41749
41749
|
};
|
|
41750
41750
|
if (fixedSize !== null) {
|
|
41751
|
-
return createEncoder({ fixedSize, write });
|
|
41751
|
+
return createEncoder({ fixedSize, write: write2 });
|
|
41752
41752
|
}
|
|
41753
41753
|
const maxSize = getUnionMaxSize(variants);
|
|
41754
41754
|
return createEncoder({
|
|
@@ -41758,7 +41758,7 @@ function getUnionEncoder(variants, getIndexFromValue) {
|
|
|
41758
41758
|
assertValidVariantIndex(variants, index2);
|
|
41759
41759
|
return getEncodedSize(variant, variants[index2]);
|
|
41760
41760
|
},
|
|
41761
|
-
write
|
|
41761
|
+
write: write2
|
|
41762
41762
|
});
|
|
41763
41763
|
}
|
|
41764
41764
|
function getUnionDecoder(variants, getIndexFromBytes) {
|
|
@@ -70729,7 +70729,7 @@ function keychainStore(platform2, run) {
|
|
|
70729
70729
|
const value = withoutTrailingNewline(result.stdout);
|
|
70730
70730
|
return value.length === 0 ? void 0 : value;
|
|
70731
70731
|
};
|
|
70732
|
-
const
|
|
70732
|
+
const write2 = async (account, value, what) => {
|
|
70733
70733
|
const result = await run(
|
|
70734
70734
|
SECURITY_BINARY,
|
|
70735
70735
|
[
|
|
@@ -70800,7 +70800,7 @@ ${value}
|
|
|
70800
70800
|
const account = accountFor(name);
|
|
70801
70801
|
const what = `store the passphrase of ${name} in the macOS Keychain`;
|
|
70802
70802
|
if (passphrase.length <= KEYCHAIN_PROMPT_LIMIT) {
|
|
70803
|
-
await
|
|
70803
|
+
await write2(account, passphrase, what);
|
|
70804
70804
|
return;
|
|
70805
70805
|
}
|
|
70806
70806
|
const chunks = [];
|
|
@@ -70811,10 +70811,10 @@ ${value}
|
|
|
70811
70811
|
throw new KeystoreError(`The secret ${name} is too long for the macOS Keychain.`);
|
|
70812
70812
|
}
|
|
70813
70813
|
for (const [index2, chunk] of chunks.entries()) {
|
|
70814
|
-
await
|
|
70814
|
+
await write2(keychainPart(account, index2 + 1), chunk, what);
|
|
70815
70815
|
}
|
|
70816
70816
|
await erasePartsAfter(account, chunks.length, what);
|
|
70817
|
-
await
|
|
70817
|
+
await write2(account, `${CHUNKED_MARKER}${chunks.length}`, what);
|
|
70818
70818
|
},
|
|
70819
70819
|
async remove(name) {
|
|
70820
70820
|
const account = accountFor(name);
|
|
@@ -78150,7 +78150,7 @@ function createRunBudget(args) {
|
|
|
78150
78150
|
import { mkdir as mkdir15, writeFile as writeFile8 } from "node:fs/promises";
|
|
78151
78151
|
import { arch, platform, release } from "node:os";
|
|
78152
78152
|
import { join as join13 } from "node:path";
|
|
78153
|
-
var VAPI_CLIENT_VERSION = "0.
|
|
78153
|
+
var VAPI_CLIENT_VERSION = "0.10.0";
|
|
78154
78154
|
async function createSupportReport(options) {
|
|
78155
78155
|
const message = options.message.trim();
|
|
78156
78156
|
if (!message) throw new Error("Support report message must not be empty.");
|
|
@@ -91302,8 +91302,8 @@ var LOOP_BINDINGS = {
|
|
|
91302
91302
|
};
|
|
91303
91303
|
},
|
|
91304
91304
|
async run(input2, ctx, execution) {
|
|
91305
|
-
const
|
|
91306
|
-
const rows = await execution.deps.search(
|
|
91305
|
+
const search2 = input2;
|
|
91306
|
+
const rows = await execution.deps.search(search2);
|
|
91307
91307
|
for (const row of rows) ctx.caller.run?.searchedRefs.add(row.ref);
|
|
91308
91308
|
return rows;
|
|
91309
91309
|
}
|
|
@@ -94701,6 +94701,106 @@ function createDocsTools(options) {
|
|
|
94701
94701
|
};
|
|
94702
94702
|
}
|
|
94703
94703
|
|
|
94704
|
+
// ../mcp/src/tool-presentation.ts
|
|
94705
|
+
var SERVER_ICONS = [
|
|
94706
|
+
{
|
|
94707
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-light.png",
|
|
94708
|
+
mimeType: "image/png",
|
|
94709
|
+
sizes: ["1024x1024"],
|
|
94710
|
+
theme: "light"
|
|
94711
|
+
},
|
|
94712
|
+
{
|
|
94713
|
+
src: "https://vapinetwork.ai/branding/kit/logos/vapi-app-icon-dark.png",
|
|
94714
|
+
mimeType: "image/png",
|
|
94715
|
+
sizes: ["1024x1024"],
|
|
94716
|
+
theme: "dark"
|
|
94717
|
+
}
|
|
94718
|
+
];
|
|
94719
|
+
var readOnly = {
|
|
94720
|
+
readOnlyHint: true,
|
|
94721
|
+
destructiveHint: false,
|
|
94722
|
+
idempotentHint: true,
|
|
94723
|
+
openWorldHint: false
|
|
94724
|
+
};
|
|
94725
|
+
var write = {
|
|
94726
|
+
readOnlyHint: false,
|
|
94727
|
+
destructiveHint: false,
|
|
94728
|
+
idempotentHint: false,
|
|
94729
|
+
openWorldHint: false
|
|
94730
|
+
};
|
|
94731
|
+
var destructive = { ...write, destructiveHint: true };
|
|
94732
|
+
var search = { ...readOnly, openWorldHint: true };
|
|
94733
|
+
var TOOL_PRESENTATION = {
|
|
94734
|
+
"docs.search": { title: "Search the vAPI docs", annotations: readOnly },
|
|
94735
|
+
"docs.read": { title: "Read a vAPI docs page", annotations: readOnly },
|
|
94736
|
+
"auth.link": {
|
|
94737
|
+
title: "Link this account to the vAPI dashboard",
|
|
94738
|
+
annotations: { ...write, idempotentHint: true }
|
|
94739
|
+
},
|
|
94740
|
+
"auth.status": { title: "Check the dashboard link", annotations: readOnly },
|
|
94741
|
+
"router.models": { title: "List Router models", annotations: readOnly },
|
|
94742
|
+
"router.usage": { title: "Show Router usage", annotations: readOnly },
|
|
94743
|
+
"router.chat": { title: "Chat through the vAPI Router", annotations: destructive },
|
|
94744
|
+
"router.buy": { title: "Buy Router balance", annotations: destructive },
|
|
94745
|
+
"tasks.search": { title: "Browse tasks", annotations: readOnly },
|
|
94746
|
+
"tasks.show": { title: "Show a task", annotations: readOnly },
|
|
94747
|
+
"tasks.post": { title: "Post a task", annotations: write },
|
|
94748
|
+
"tasks.propose": { title: "Propose on a task", annotations: write },
|
|
94749
|
+
"tasks.submit": { title: "Submit a proposal", annotations: write },
|
|
94750
|
+
"tasks.award": { title: "Award a task", annotations: write },
|
|
94751
|
+
"tasks.sign": { title: "Sign a task step", annotations: destructive },
|
|
94752
|
+
"tasks.fund": { title: "Fund escrow", annotations: destructive },
|
|
94753
|
+
"tasks.deliver": { title: "Deliver work", annotations: write },
|
|
94754
|
+
"tasks.release": { title: "Release escrow", annotations: destructive },
|
|
94755
|
+
"tasks.refund": { title: "Refund escrow", annotations: destructive },
|
|
94756
|
+
"tasks.dispute": { title: "Open a dispute", annotations: destructive },
|
|
94757
|
+
"tasks.counter-evidence": { title: "Add counter-evidence", annotations: write },
|
|
94758
|
+
"tasks.resolve-unmatched": { title: "Resolve an unmatched escrow", annotations: destructive },
|
|
94759
|
+
"tasks.message": { title: "Message a task thread", annotations: write },
|
|
94760
|
+
"tasks.thread": { title: "Read a task thread", annotations: readOnly },
|
|
94761
|
+
"tasks.watch": { title: "Watch a task", annotations: readOnly },
|
|
94762
|
+
"tasks.status": { title: "Check a task's chain status", annotations: readOnly },
|
|
94763
|
+
"vapi.status": { title: "Show the vAPI status screen", annotations: readOnly },
|
|
94764
|
+
"vapi.accounts": { title: "List vAPI accounts", annotations: readOnly },
|
|
94765
|
+
"vapi.siblings": { title: "List sibling agents", annotations: readOnly },
|
|
94766
|
+
"accounts.add": { title: "Add a local account", annotations: write },
|
|
94767
|
+
"accounts.caps": { title: "Lower an account's spend caps", annotations: write },
|
|
94768
|
+
"accounts.send": { title: "Send USDC from an account", annotations: destructive },
|
|
94769
|
+
"call.search": { title: "Search the vAPI marketplace", annotations: search },
|
|
94770
|
+
search: { title: "Search the vAPI marketplace (deprecated)", annotations: search },
|
|
94771
|
+
"call.inspect": { title: "Inspect a Call listing", annotations: readOnly },
|
|
94772
|
+
inspect: { title: "Inspect a Call listing (deprecated)", annotations: readOnly },
|
|
94773
|
+
"call.pay": { title: "Pay an x402 API", annotations: destructive },
|
|
94774
|
+
call: { title: "Pay an x402 API (deprecated)", annotations: destructive },
|
|
94775
|
+
"call.read": { title: "Read a paid origin", annotations: readOnly },
|
|
94776
|
+
"wallet.address": { title: "Show the account address", annotations: readOnly },
|
|
94777
|
+
"wallet.balance": { title: "Show the account balance", annotations: readOnly },
|
|
94778
|
+
"wallet.accounts": { title: "Show the account's addresses", annotations: readOnly },
|
|
94779
|
+
"wallet.list": { title: "List local accounts", annotations: readOnly },
|
|
94780
|
+
"wallet.use": { title: "Switch the active account", annotations: write },
|
|
94781
|
+
"wallet.fund": { title: "Fund the account", annotations: destructive },
|
|
94782
|
+
wallet: { title: "Show the account balance (deprecated)", annotations: readOnly },
|
|
94783
|
+
"receipts.list": { title: "List payment receipts", annotations: readOnly },
|
|
94784
|
+
"receipts.stats": { title: "Show receipt statistics", annotations: readOnly },
|
|
94785
|
+
"support.report": { title: "Create a local support report", annotations: write },
|
|
94786
|
+
"swarm.setup": { title: "Set up a swarm", annotations: write },
|
|
94787
|
+
"swarm.add": { title: "Add a swarm member", annotations: write },
|
|
94788
|
+
"swarm.leave": { title: "Leave a swarm", annotations: write },
|
|
94789
|
+
"swarm.fund": { title: "Fund a swarm", annotations: destructive },
|
|
94790
|
+
"swarm.rebalance": { title: "Rebalance a swarm", annotations: destructive },
|
|
94791
|
+
"swarm.status": { title: "Show swarm status", annotations: readOnly },
|
|
94792
|
+
"swarm.dissolve": { title: "Dissolve a swarm", annotations: destructive },
|
|
94793
|
+
"swarm.run": { title: "Run a swarm", annotations: destructive },
|
|
94794
|
+
"swarm.allocate": { title: "Allocate swarm budget", annotations: destructive },
|
|
94795
|
+
"swarm.delegate": { title: "Delegate a swarm task", annotations: destructive },
|
|
94796
|
+
"swarm.runs": { title: "List swarm runs", annotations: readOnly }
|
|
94797
|
+
};
|
|
94798
|
+
function withPresentation(tool) {
|
|
94799
|
+
const presentation = Object.hasOwn(TOOL_PRESENTATION, tool.name) ? TOOL_PRESENTATION[tool.name] : void 0;
|
|
94800
|
+
if (!presentation) throw new Error(`no presentation for tool ${tool.name}`);
|
|
94801
|
+
return { ...tool, ...presentation };
|
|
94802
|
+
}
|
|
94803
|
+
|
|
94704
94804
|
// ../mcp/src/wallet-session.ts
|
|
94705
94805
|
var WalletSession = class {
|
|
94706
94806
|
constructor(options) {
|
|
@@ -94929,6 +95029,99 @@ var WalletSession = class {
|
|
|
94929
95029
|
}
|
|
94930
95030
|
};
|
|
94931
95031
|
|
|
95032
|
+
// ../mcp/src/views.ts
|
|
95033
|
+
var searchView = { view: "call-search", uri: "ui://vapi/call-search.html" };
|
|
95034
|
+
var inspectView = { view: "call-inspect", uri: "ui://vapi/call-inspect.html" };
|
|
95035
|
+
var MCP_APP_VIEWS = {
|
|
95036
|
+
"call.search": searchView,
|
|
95037
|
+
"call.inspect": inspectView,
|
|
95038
|
+
search: searchView,
|
|
95039
|
+
inspect: inspectView
|
|
95040
|
+
};
|
|
95041
|
+
var VIEW_RESOURCE_META = {
|
|
95042
|
+
"call-search": {
|
|
95043
|
+
title: "vAPI marketplace results",
|
|
95044
|
+
description: "Interactive list of Call listings returned by call.search."
|
|
95045
|
+
},
|
|
95046
|
+
"call-inspect": {
|
|
95047
|
+
title: "vAPI listing inspector",
|
|
95048
|
+
description: "Interactive request contract and price for one Call listing."
|
|
95049
|
+
}
|
|
95050
|
+
};
|
|
95051
|
+
function createViewLoader(options) {
|
|
95052
|
+
const origin = new URL(options.registryUrl).origin;
|
|
95053
|
+
const timeoutMs = options.timeoutMs ?? 2e3;
|
|
95054
|
+
const log = options.log ?? ((line) => process.stderr.write(`${line}
|
|
95055
|
+
`));
|
|
95056
|
+
const cache = /* @__PURE__ */ new Map();
|
|
95057
|
+
const inFlight = /* @__PURE__ */ new Map();
|
|
95058
|
+
const logged = /* @__PURE__ */ new Set();
|
|
95059
|
+
async function fetchHtml(view) {
|
|
95060
|
+
const url2 = `${origin}/mcp/apps/${view}.html`;
|
|
95061
|
+
const controller = new AbortController();
|
|
95062
|
+
let timer;
|
|
95063
|
+
const timedOut = new Promise((_resolve, reject) => {
|
|
95064
|
+
timer = setTimeout(() => {
|
|
95065
|
+
const error61 = new Error(`timed out after ${timeoutMs} ms`);
|
|
95066
|
+
reject(error61);
|
|
95067
|
+
controller.abort(error61);
|
|
95068
|
+
}, timeoutMs);
|
|
95069
|
+
});
|
|
95070
|
+
try {
|
|
95071
|
+
return await Promise.race([
|
|
95072
|
+
(async () => {
|
|
95073
|
+
const response = await options.fetchImpl(url2, {
|
|
95074
|
+
signal: controller.signal,
|
|
95075
|
+
redirect: "manual"
|
|
95076
|
+
});
|
|
95077
|
+
if (response.status !== 200) {
|
|
95078
|
+
void response.body?.cancel().catch(() => {
|
|
95079
|
+
});
|
|
95080
|
+
throw new Error(`HTTP ${response.status}`);
|
|
95081
|
+
}
|
|
95082
|
+
return await response.text();
|
|
95083
|
+
})(),
|
|
95084
|
+
timedOut
|
|
95085
|
+
]);
|
|
95086
|
+
} catch (error61) {
|
|
95087
|
+
if (!logged.has(view)) {
|
|
95088
|
+
logged.add(view);
|
|
95089
|
+
const reason = (error61 instanceof Error ? error61.message : String(error61)).replace(
|
|
95090
|
+
/[\r\n\u2028\u2029]+/gu,
|
|
95091
|
+
" "
|
|
95092
|
+
);
|
|
95093
|
+
try {
|
|
95094
|
+
log(`vapi mcp: could not load view ${view} from ${url2}: ${reason}`);
|
|
95095
|
+
} catch {
|
|
95096
|
+
}
|
|
95097
|
+
}
|
|
95098
|
+
return void 0;
|
|
95099
|
+
} finally {
|
|
95100
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
95101
|
+
}
|
|
95102
|
+
}
|
|
95103
|
+
function load(view) {
|
|
95104
|
+
const html = cache.get(view);
|
|
95105
|
+
if (html !== void 0) return Promise.resolve(html);
|
|
95106
|
+
const pending = inFlight.get(view);
|
|
95107
|
+
if (pending) return pending;
|
|
95108
|
+
const request = fetchHtml(view).then((html2) => {
|
|
95109
|
+
if (html2 !== void 0) cache.set(view, html2);
|
|
95110
|
+
return html2;
|
|
95111
|
+
}).finally(() => inFlight.delete(view));
|
|
95112
|
+
inFlight.set(view, request);
|
|
95113
|
+
return request;
|
|
95114
|
+
}
|
|
95115
|
+
return {
|
|
95116
|
+
origin,
|
|
95117
|
+
load,
|
|
95118
|
+
get: (view) => cache.get(view),
|
|
95119
|
+
async warm() {
|
|
95120
|
+
await Promise.allSettled([load("call-search"), load("call-inspect")]);
|
|
95121
|
+
}
|
|
95122
|
+
};
|
|
95123
|
+
}
|
|
95124
|
+
|
|
94932
95125
|
// ../mcp/src/server.ts
|
|
94933
95126
|
var allWalletsArgument = {
|
|
94934
95127
|
allWallets: external_exports.boolean().optional().describe("Read every account's rows instead of one account's.")
|
|
@@ -95069,16 +95262,50 @@ function objectOutputSchema(schema) {
|
|
|
95069
95262
|
const json2 = external_exports.toJSONSchema(schema);
|
|
95070
95263
|
return json2.type === "object" ? { outputSchema: json2 } : {};
|
|
95071
95264
|
}
|
|
95265
|
+
function appViewForTool(name) {
|
|
95266
|
+
return Object.hasOwn(MCP_APP_VIEWS, name) ? MCP_APP_VIEWS[name] : void 0;
|
|
95267
|
+
}
|
|
95268
|
+
function appViewResource({ view, uri }, origin) {
|
|
95269
|
+
return {
|
|
95270
|
+
uri,
|
|
95271
|
+
name: `vapi-${view}`,
|
|
95272
|
+
...VIEW_RESOURCE_META[view],
|
|
95273
|
+
mimeType: "text/html;profile=mcp-app",
|
|
95274
|
+
_meta: {
|
|
95275
|
+
ui: {
|
|
95276
|
+
csp: {
|
|
95277
|
+
connectDomains: [origin],
|
|
95278
|
+
resourceDomains: ["https://assets.claude.ai", origin]
|
|
95279
|
+
},
|
|
95280
|
+
prefersBorder: view === "call-inspect"
|
|
95281
|
+
}
|
|
95282
|
+
}
|
|
95283
|
+
};
|
|
95284
|
+
}
|
|
95072
95285
|
var VapiMcpServer = class {
|
|
95073
95286
|
#tools = /* @__PURE__ */ new Map();
|
|
95074
95287
|
#onClose;
|
|
95075
95288
|
#stdio;
|
|
95289
|
+
#views;
|
|
95290
|
+
#viewSequence = 0;
|
|
95076
95291
|
constructor(onClose) {
|
|
95077
95292
|
this.#onClose = onClose;
|
|
95078
95293
|
}
|
|
95294
|
+
useViews(loader) {
|
|
95295
|
+
this.#views = loader;
|
|
95296
|
+
}
|
|
95297
|
+
#resources() {
|
|
95298
|
+
const loader = this.#views;
|
|
95299
|
+
return loader ? [MCP_APP_VIEWS["call.search"], MCP_APP_VIEWS["call.inspect"]].map(
|
|
95300
|
+
(view) => appViewResource(view, loader.origin)
|
|
95301
|
+
) : [];
|
|
95302
|
+
}
|
|
95079
95303
|
registerTool(name, definition, handler) {
|
|
95304
|
+
const presentation = definition.title !== void 0 && definition.annotations !== void 0 ? { title: definition.title, annotations: definition.annotations } : withPresentation({ name, ...definition });
|
|
95080
95305
|
const inputSchema = definition.strictInput ? external_exports.strictObject(definition.inputSchema) : external_exports.object(definition.inputSchema);
|
|
95081
95306
|
this.#tools.set(name, {
|
|
95307
|
+
title: presentation.title,
|
|
95308
|
+
annotations: presentation.annotations,
|
|
95082
95309
|
...definition.description ? { description: definition.description } : {},
|
|
95083
95310
|
...definition.deprecatedReplacement ? { deprecatedReplacement: definition.deprecatedReplacement } : {},
|
|
95084
95311
|
inputSchema,
|
|
@@ -95088,12 +95315,19 @@ var VapiMcpServer = class {
|
|
|
95088
95315
|
}
|
|
95089
95316
|
async listTools() {
|
|
95090
95317
|
return {
|
|
95091
|
-
tools: [...this.#tools].map(([name, tool]) =>
|
|
95092
|
-
name
|
|
95093
|
-
|
|
95094
|
-
|
|
95095
|
-
|
|
95096
|
-
|
|
95318
|
+
tools: [...this.#tools].map(([name, tool]) => {
|
|
95319
|
+
const view = appViewForTool(name);
|
|
95320
|
+
const uri = view && this.#views?.get(view.view) !== void 0 ? view.uri : void 0;
|
|
95321
|
+
return {
|
|
95322
|
+
name,
|
|
95323
|
+
title: tool.title,
|
|
95324
|
+
annotations: tool.annotations,
|
|
95325
|
+
...tool.description ? { description: tool.description } : {},
|
|
95326
|
+
inputSchema: external_exports.toJSONSchema(tool.inputSchema),
|
|
95327
|
+
...objectOutputSchema(tool.outputSchema),
|
|
95328
|
+
...uri === void 0 ? {} : { _meta: { ui: { resourceUri: uri }, "ui/resourceUri": uri } }
|
|
95329
|
+
};
|
|
95330
|
+
})
|
|
95097
95331
|
};
|
|
95098
95332
|
}
|
|
95099
95333
|
async callTool(request) {
|
|
@@ -95105,7 +95339,16 @@ var VapiMcpServer = class {
|
|
|
95105
95339
|
};
|
|
95106
95340
|
}
|
|
95107
95341
|
try {
|
|
95108
|
-
|
|
95342
|
+
let result = await tool.handler(request.arguments ?? {});
|
|
95343
|
+
if (!result.isError && appViewForTool(request.name)) {
|
|
95344
|
+
result = {
|
|
95345
|
+
...result,
|
|
95346
|
+
structuredContent: {
|
|
95347
|
+
...result.structuredContent,
|
|
95348
|
+
_view: { createdAt: Date.now(), seq: ++this.#viewSequence }
|
|
95349
|
+
}
|
|
95350
|
+
};
|
|
95351
|
+
}
|
|
95109
95352
|
return tool.deprecatedReplacement ? withDeprecation(result, tool.deprecatedReplacement) : result;
|
|
95110
95353
|
} catch (error61) {
|
|
95111
95354
|
const result = request.name.startsWith("tasks.") ? tasksErrorResult(error61) : toolError(error61);
|
|
@@ -95137,17 +95380,44 @@ var VapiMcpServer = class {
|
|
|
95137
95380
|
this.#write({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } });
|
|
95138
95381
|
return;
|
|
95139
95382
|
}
|
|
95383
|
+
const response = await this.handleRequest(request);
|
|
95384
|
+
if (response !== void 0) this.#write(response);
|
|
95385
|
+
}
|
|
95386
|
+
async handleRequest(request) {
|
|
95140
95387
|
const id2 = request.id;
|
|
95141
95388
|
const method = request.method;
|
|
95142
95389
|
if (typeof method !== "string" || id2 === void 0) return;
|
|
95143
95390
|
try {
|
|
95144
95391
|
let result;
|
|
95145
95392
|
if (method === "initialize") {
|
|
95393
|
+
await this.#views?.warm();
|
|
95146
95394
|
const params = asRecord3(request.params);
|
|
95147
95395
|
result = {
|
|
95148
95396
|
protocolVersion: typeof params?.protocolVersion === "string" ? params.protocolVersion : "2025-11-25",
|
|
95149
|
-
capabilities: { tools: {} },
|
|
95150
|
-
serverInfo: {
|
|
95397
|
+
capabilities: { tools: {}, ...this.#views ? { resources: {} } : {} },
|
|
95398
|
+
serverInfo: {
|
|
95399
|
+
name: "@vapi-network/mcp",
|
|
95400
|
+
title: "vAPI Network",
|
|
95401
|
+
version: VAPI_CLIENT_VERSION,
|
|
95402
|
+
websiteUrl: "https://vapinetwork.ai",
|
|
95403
|
+
icons: SERVER_ICONS
|
|
95404
|
+
}
|
|
95405
|
+
};
|
|
95406
|
+
} else if (method === "resources/list") {
|
|
95407
|
+
result = { resources: this.#resources() };
|
|
95408
|
+
} else if (method === "resources/read") {
|
|
95409
|
+
const params = asRecord3(request.params);
|
|
95410
|
+
const view = Object.values(MCP_APP_VIEWS).find((view2) => view2.uri === params?.uri);
|
|
95411
|
+
if (!this.#views || !view) {
|
|
95412
|
+
return { jsonrpc: "2.0", id: id2, error: { code: -32002, message: "resource not found" } };
|
|
95413
|
+
}
|
|
95414
|
+
const html = await this.#views.load(view.view);
|
|
95415
|
+
if (html === void 0) throw new Error(`view ${view.view} is unavailable`);
|
|
95416
|
+
const resource = appViewResource(view, this.#views.origin);
|
|
95417
|
+
result = {
|
|
95418
|
+
contents: [
|
|
95419
|
+
{ uri: resource.uri, mimeType: resource.mimeType, text: html, _meta: resource._meta }
|
|
95420
|
+
]
|
|
95151
95421
|
};
|
|
95152
95422
|
} else if (method === "tools/list") {
|
|
95153
95423
|
result = await this.listTools();
|
|
@@ -95160,20 +95430,19 @@ var VapiMcpServer = class {
|
|
|
95160
95430
|
} else if (method === "ping") {
|
|
95161
95431
|
result = {};
|
|
95162
95432
|
} else {
|
|
95163
|
-
|
|
95433
|
+
return {
|
|
95164
95434
|
jsonrpc: "2.0",
|
|
95165
95435
|
id: id2,
|
|
95166
95436
|
error: { code: -32601, message: `Method not found: ${method}` }
|
|
95167
|
-
}
|
|
95168
|
-
return;
|
|
95437
|
+
};
|
|
95169
95438
|
}
|
|
95170
|
-
|
|
95439
|
+
return { jsonrpc: "2.0", id: id2, result };
|
|
95171
95440
|
} catch (error61) {
|
|
95172
|
-
|
|
95441
|
+
return {
|
|
95173
95442
|
jsonrpc: "2.0",
|
|
95174
95443
|
id: id2,
|
|
95175
95444
|
error: { code: -32603, message: error61 instanceof Error ? error61.message : String(error61) }
|
|
95176
|
-
}
|
|
95445
|
+
};
|
|
95177
95446
|
}
|
|
95178
95447
|
}
|
|
95179
95448
|
#write(message) {
|
|
@@ -95212,6 +95481,7 @@ function createVapiServer(options = {}) {
|
|
|
95212
95481
|
});
|
|
95213
95482
|
const guardedFetch2 = options.fetchImpl ?? createPublicFetch({ allowPrivateNetwork: config2.allowPrivateNetwork ?? false });
|
|
95214
95483
|
const apiBase = options.agentLink?.apiBase ?? agentApiBase(config2, options.env);
|
|
95484
|
+
server.useViews(createViewLoader({ registryUrl: apiBase, fetchImpl: guardedFetch2 }));
|
|
95215
95485
|
const auth = createAuthTools({
|
|
95216
95486
|
session,
|
|
95217
95487
|
secrets,
|
|
@@ -95588,7 +95858,9 @@ function createVapiServer(options = {}) {
|
|
|
95588
95858
|
const tool = {
|
|
95589
95859
|
description: action.description,
|
|
95590
95860
|
inputSchema: action.input.shape,
|
|
95591
|
-
outputSchema: action.output
|
|
95861
|
+
outputSchema: appViewForTool(action.name) && action.output instanceof external_exports.ZodObject ? action.output.extend({
|
|
95862
|
+
_view: external_exports.object({ createdAt: external_exports.number(), seq: external_exports.number().int() }).optional()
|
|
95863
|
+
}) : action.output
|
|
95592
95864
|
};
|
|
95593
95865
|
const handler = async (input2) => asStructuredToolResult(() => runAction(registeredAction, input2, actionContext));
|
|
95594
95866
|
server.registerTool(action.name, tool, handler);
|
|
@@ -96296,11 +96568,12 @@ function buildPayoutSiweMessage(args) {
|
|
|
96296
96568
|
);
|
|
96297
96569
|
}
|
|
96298
96570
|
function readProbeOperations(probe) {
|
|
96299
|
-
const operations = probe.operations;
|
|
96300
|
-
if (
|
|
96301
|
-
return
|
|
96302
|
-
|
|
96303
|
-
|
|
96571
|
+
const operations = (Array.isArray(probe.operations) ? probe.operations : []).filter(isOperation);
|
|
96572
|
+
if (operations.length > 0) return operations;
|
|
96573
|
+
return isOperation(probe.endpoint) ? [probe.endpoint] : [];
|
|
96574
|
+
}
|
|
96575
|
+
function isOperation(operation) {
|
|
96576
|
+
return isRecord6(operation) && typeof operation.name === "string" && operation.name.length > 0;
|
|
96304
96577
|
}
|
|
96305
96578
|
function readProbeRejection(probe) {
|
|
96306
96579
|
const rejection = probe.diagnostics?.rejection;
|
|
@@ -99551,7 +99824,7 @@ async function readProcessStdin() {
|
|
|
99551
99824
|
}
|
|
99552
99825
|
|
|
99553
99826
|
// ../cli/src/version.ts
|
|
99554
|
-
var CLI_VERSION = "0.
|
|
99827
|
+
var CLI_VERSION = "0.10.0";
|
|
99555
99828
|
|
|
99556
99829
|
// ../cli/src/status.ts
|
|
99557
99830
|
async function statusCommand(argv, json2, io, dependencies) {
|
|
@@ -103704,9 +103977,9 @@ async function buildAgentRunDeps(input2) {
|
|
|
103704
103977
|
})
|
|
103705
103978
|
}
|
|
103706
103979
|
});
|
|
103707
|
-
const
|
|
103980
|
+
const search2 = runDependencies.search;
|
|
103708
103981
|
runDependencies.search = async (query) => {
|
|
103709
|
-
const rows = await
|
|
103982
|
+
const rows = await search2(query);
|
|
103710
103983
|
for (const row of rows) listingNames.set(row.ref, row.name);
|
|
103711
103984
|
return rows;
|
|
103712
103985
|
};
|
|
@@ -108728,7 +109001,8 @@ function toListingEndpoint(operation, fallbackDescription) {
|
|
|
108728
109001
|
...operation.requestSchema === void 0 ? {} : { requestSchema: operation.requestSchema },
|
|
108729
109002
|
...optionalStringField(operation, "responseContentType"),
|
|
108730
109003
|
...optionalStringField(operation, "pathTemplate"),
|
|
108731
|
-
...operation.pathParameters === void 0 ? {} : { pathParameters: operation.pathParameters }
|
|
109004
|
+
...operation.pathParameters === void 0 ? {} : { pathParameters: operation.pathParameters },
|
|
109005
|
+
...optionalStringField(operation, "metadataEvidence")
|
|
108732
109006
|
};
|
|
108733
109007
|
}
|
|
108734
109008
|
function optionalStringField(operation, key2) {
|