@deeprelay/mcp 0.0.1 → 0.1.1
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/README.md +194 -1
- package/dist/auth.d.ts +52 -0
- package/dist/auth.js +122 -0
- package/dist/auth.js.map +1 -0
- package/dist/errors.d.ts +83 -0
- package/dist/errors.js +307 -0
- package/dist/errors.js.map +1 -0
- package/dist/guardrail/budget.d.ts +95 -0
- package/dist/guardrail/budget.js +225 -0
- package/dist/guardrail/budget.js.map +1 -0
- package/dist/guardrail/elicitation.d.ts +12 -0
- package/dist/guardrail/elicitation.js +79 -0
- package/dist/guardrail/elicitation.js.map +1 -0
- package/dist/guardrail/estimate.d.ts +67 -0
- package/dist/guardrail/estimate.js +171 -0
- package/dist/guardrail/estimate.js.map +1 -0
- package/dist/guardrail/handshake.d.ts +32 -0
- package/dist/guardrail/handshake.js +164 -0
- package/dist/guardrail/handshake.js.map +1 -0
- package/dist/guardrail/types.d.ts +61 -0
- package/dist/guardrail/types.js +10 -0
- package/dist/guardrail/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +61 -0
- package/dist/index.js.map +1 -0
- package/dist/roster.d.ts +36 -0
- package/dist/roster.js +130 -0
- package/dist/roster.js.map +1 -0
- package/dist/tools/crypto-deposit-gate.d.ts +21 -0
- package/dist/tools/crypto-deposit-gate.js +91 -0
- package/dist/tools/crypto-deposit-gate.js.map +1 -0
- package/dist/tools/index.d.ts +16 -0
- package/dist/tools/index.js +108 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/readonly/define.d.ts +32 -0
- package/dist/tools/readonly/define.js +64 -0
- package/dist/tools/readonly/define.js.map +1 -0
- package/dist/tools/readonly/index.d.ts +7 -0
- package/dist/tools/readonly/index.js +286 -0
- package/dist/tools/readonly/index.js.map +1 -0
- package/dist/tools/readonly/usage.d.ts +29 -0
- package/dist/tools/readonly/usage.js +126 -0
- package/dist/tools/readonly/usage.js.map +1 -0
- package/dist/tools/readonly/video-reads.d.ts +11 -0
- package/dist/tools/readonly/video-reads.js +170 -0
- package/dist/tools/readonly/video-reads.js.map +1 -0
- package/dist/tools/result.d.ts +22 -0
- package/dist/tools/result.js +63 -0
- package/dist/tools/result.js.map +1 -0
- package/dist/tools/spend/define.d.ts +93 -0
- package/dist/tools/spend/define.js +286 -0
- package/dist/tools/spend/define.js.map +1 -0
- package/dist/tools/spend/index.d.ts +11 -0
- package/dist/tools/spend/index.js +163 -0
- package/dist/tools/spend/index.js.map +1 -0
- package/dist/tools/spend/media.d.ts +9 -0
- package/dist/tools/spend/media.js +164 -0
- package/dist/tools/spend/media.js.map +1 -0
- package/dist/tools/spend/pricing.d.ts +17 -0
- package/dist/tools/spend/pricing.js +58 -0
- package/dist/tools/spend/pricing.js.map +1 -0
- package/dist/tools/types.d.ts +45 -0
- package/dist/tools/types.js +3 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/write/define.d.ts +60 -0
- package/dist/tools/write/define.js +110 -0
- package/dist/tools/write/define.js.map +1 -0
- package/dist/tools/write/index.d.ts +12 -0
- package/dist/tools/write/index.js +159 -0
- package/dist/tools/write/index.js.map +1 -0
- package/dist/tools/write/payment-links.d.ts +3 -0
- package/dist/tools/write/payment-links.js +161 -0
- package/dist/tools/write/payment-links.js.map +1 -0
- package/dist/tools/write/spending-limit.d.ts +2 -0
- package/dist/tools/write/spending-limit.js +229 -0
- package/dist/tools/write/spending-limit.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.js +36 -0
- package/dist/version.js.map +1 -0
- package/package.json +39 -3
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.spendingLimitClearTool = exports.spendingLimitUpdateTool = void 0;
|
|
4
|
+
// The spending-limit write tools (Phase 104 D-03). Authored fresh (D-12).
|
|
5
|
+
//
|
|
6
|
+
// deeprelay_spending_limit_update — lower-only (carrying Phase 82 D-06)
|
|
7
|
+
// deeprelay_spending_limit_clear — remove the limit entirely (Plan 104-12:
|
|
8
|
+
// @deeprelay/sdk@0.2.0 ships
|
|
9
|
+
// BillingApi.deleteSpendingLimit)
|
|
10
|
+
//
|
|
11
|
+
// So from the agent's side a limit can be lowered or cleared, never raised.
|
|
12
|
+
// Raising is done in the dashboard.
|
|
13
|
+
//
|
|
14
|
+
// The update tool may only tighten the limit, never raise it. That is enforced
|
|
15
|
+
// structurally, twice:
|
|
16
|
+
//
|
|
17
|
+
// quote — GET the current limit. A requested monthly (or daily) value that
|
|
18
|
+
// is not strictly below the current one throws
|
|
19
|
+
// QuoteUnavailableError, so no confirmation token is minted: a
|
|
20
|
+
// raise cannot be confirmed, not merely "is discouraged".
|
|
21
|
+
// execute — GET again and re-apply the same checks. A token lives for its
|
|
22
|
+
// whole TTL and the limit can move during it, so time-of-check
|
|
23
|
+
// must be time-of-use.
|
|
24
|
+
//
|
|
25
|
+
// The PUT resends every field (enforcement, auto-terminate hours, daily
|
|
26
|
+
// limit) from the fresh GET, because the API has no partial update: an
|
|
27
|
+
// omitted field is defaulted server-side, which could silently change
|
|
28
|
+
// behaviour the confirmation never described (T-104-25).
|
|
29
|
+
//
|
|
30
|
+
// The clear tool quotes against a live GET and re-reads at execute, the same
|
|
31
|
+
// time-of-check/time-of-use discipline as the update. "No limit configured"
|
|
32
|
+
// (the API's typed 404 `no_spending_limit`, on either the GET or the DELETE)
|
|
33
|
+
// is a plain "nothing to clear" result, never an error: the account is
|
|
34
|
+
// already in the state the user asked for.
|
|
35
|
+
const sdk_1 = require("@deeprelay/sdk");
|
|
36
|
+
const zod_1 = require("zod");
|
|
37
|
+
const errors_js_1 = require("../../errors.js");
|
|
38
|
+
const define_js_1 = require("./define.js");
|
|
39
|
+
/** Run the limit GET; a 404 means "no limit configured" and becomes undefined. */
|
|
40
|
+
async function orNoLimit(read) {
|
|
41
|
+
try {
|
|
42
|
+
return await read();
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
if ((0, errors_js_1.httpStatusOf)(err) === 404) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
throw err;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function usd(v) {
|
|
52
|
+
return `$${v.toFixed(2)}`;
|
|
53
|
+
}
|
|
54
|
+
/** The reason a request is not a decrease against `current`, or undefined when it is. */
|
|
55
|
+
function notADecrease(current, monthly, daily) {
|
|
56
|
+
if (current === undefined) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (monthly >= current.monthlyLimitDollars) {
|
|
60
|
+
return `${usd(monthly)} is not a decrease from the current ${usd(current.monthlyLimitDollars)}/month limit`;
|
|
61
|
+
}
|
|
62
|
+
if (daily !== undefined && current.dailyLimitDollars !== undefined && daily >= current.dailyLimitDollars) {
|
|
63
|
+
return `${usd(daily)} is not a decrease from the current ${usd(current.dailyLimitDollars)}/day limit`;
|
|
64
|
+
}
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const LOWER_ONLY = "This tool only lowers limits; raises are done in the dashboard.";
|
|
68
|
+
exports.spendingLimitUpdateTool = (0, define_js_1.defineWriteTool)({
|
|
69
|
+
name: "deeprelay_spending_limit_update",
|
|
70
|
+
title: "Lower the deeprelay spending limit",
|
|
71
|
+
description: "LOWER the account's monthly spending limit (and optionally the daily one). Lower-only: a value at or above the " +
|
|
72
|
+
"current limit is refused before any confirmation is offered, and raising a limit is done in the dashboard. " +
|
|
73
|
+
"Requires the org-admin role. To remove the limit entirely use deeprelay_spending_limit_clear instead. Check " +
|
|
74
|
+
"the current value first with deeprelay_spending_limit_get. Charges nothing.",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
monthly_limit_dollars: zod_1.z.number().positive().describe("New monthly limit in US dollars. Must be below the current one."),
|
|
77
|
+
daily_limit_dollars: zod_1.z
|
|
78
|
+
.number()
|
|
79
|
+
.positive()
|
|
80
|
+
.optional()
|
|
81
|
+
.describe("New daily limit in US dollars. If a daily limit exists, must be below it."),
|
|
82
|
+
},
|
|
83
|
+
destructive: false,
|
|
84
|
+
question: (args) => `Lower the monthly spending limit to ${usd(args.monthly_limit_dollars)}?`,
|
|
85
|
+
context: "updating the spending limit",
|
|
86
|
+
async quote(args, config) {
|
|
87
|
+
const current = await orNoLimit(() => new sdk_1.BillingApi(config).getSpendingLimit());
|
|
88
|
+
const refusal = notADecrease(current, args.monthly_limit_dollars, args.daily_limit_dollars);
|
|
89
|
+
if (refusal !== undefined) {
|
|
90
|
+
throw new errors_js_1.QuoteUnavailableError(`Refused: ${refusal}. ${LOWER_ONLY}`);
|
|
91
|
+
}
|
|
92
|
+
const monthlyPart = current === undefined
|
|
93
|
+
? `Set a monthly spending limit of ${usd(args.monthly_limit_dollars)} (none is configured today)`
|
|
94
|
+
: `Lower the monthly spending limit from ${usd(current.monthlyLimitDollars)} to ${usd(args.monthly_limit_dollars)}`;
|
|
95
|
+
const dailyPart = args.daily_limit_dollars === undefined
|
|
96
|
+
? ""
|
|
97
|
+
: current?.dailyLimitDollars === undefined
|
|
98
|
+
? `, and set a daily limit of ${usd(args.daily_limit_dollars)}`
|
|
99
|
+
: `, and lower the daily limit from ${usd(current.dailyLimitDollars)} to ${usd(args.daily_limit_dollars)}`;
|
|
100
|
+
const plan = {
|
|
101
|
+
monthly_limit_dollars: args.monthly_limit_dollars,
|
|
102
|
+
daily_limit_dollars: args.daily_limit_dollars,
|
|
103
|
+
previous_monthly: current?.monthlyLimitDollars,
|
|
104
|
+
previous_daily: current?.dailyLimitDollars,
|
|
105
|
+
enforcement: current?.enforcement,
|
|
106
|
+
auto_terminate_hours: current?.autoTerminateHours,
|
|
107
|
+
};
|
|
108
|
+
return {
|
|
109
|
+
summary: `${monthlyPart}${dailyPart}. Raising it again cannot be done through this server.`,
|
|
110
|
+
resolvedParams: plan,
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
async execute(p, config) {
|
|
114
|
+
const fresh = await orNoLimit(() => new sdk_1.BillingApi(config).getSpendingLimit());
|
|
115
|
+
if (notADecrease(fresh, p.monthly_limit_dollars, p.daily_limit_dollars) !== undefined) {
|
|
116
|
+
throw new errors_js_1.QuoteUnavailableError("Refused at execution: the limit changed since the quote. The confirmation has been discarded.");
|
|
117
|
+
}
|
|
118
|
+
// Resend every field; prefer the fresh record, fall back to what was quoted.
|
|
119
|
+
const request = {
|
|
120
|
+
monthlyLimitDollars: p.monthly_limit_dollars,
|
|
121
|
+
dailyLimitDollars: p.daily_limit_dollars ?? fresh?.dailyLimitDollars ?? p.previous_daily,
|
|
122
|
+
enforcement: (fresh?.enforcement ?? p.enforcement),
|
|
123
|
+
autoTerminateHours: fresh?.autoTerminateHours ?? p.auto_terminate_hours,
|
|
124
|
+
};
|
|
125
|
+
const updated = await new sdk_1.BillingApi(config).updateSpendingLimit({ updateSpendingLimitRequest: request });
|
|
126
|
+
return {
|
|
127
|
+
lead: `Spending limit is now ${usd(updated.monthlyLimitDollars)}/month` +
|
|
128
|
+
(updated.dailyLimitDollars === undefined ? "." : ` and ${usd(updated.dailyLimitDollars)}/day.`),
|
|
129
|
+
payload: {
|
|
130
|
+
previous_monthly_limit_dollars: fresh?.monthlyLimitDollars ?? null,
|
|
131
|
+
monthly_limit_dollars: updated.monthlyLimitDollars,
|
|
132
|
+
daily_limit_dollars: updated.dailyLimitDollars ?? null,
|
|
133
|
+
enforcement: updated.enforcement,
|
|
134
|
+
current_month_spend_dollars: updated.currentMonthSpendDollars,
|
|
135
|
+
percent_used: updated.percentUsed,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
/** The API's typed code for "this org has no spending limit", on GET and DELETE alike. */
|
|
141
|
+
const NO_SPENDING_LIMIT = "no_spending_limit";
|
|
142
|
+
/** A 404 carrying the typed `no_spending_limit` code; any other 404 is a real error. */
|
|
143
|
+
async function isNoSpendingLimit(err) {
|
|
144
|
+
if ((0, errors_js_1.httpStatusOf)(err) !== 404) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
return (await (0, errors_js_1.readErrorEnvelope)(err)).code === NO_SPENDING_LIMIT;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Clear-path read: only the API's typed `no_spending_limit` 404 means "nothing
|
|
151
|
+
* to clear". Any other 404 (a proxy, a missing route) is a real error, so the
|
|
152
|
+
* agent is never told "no limit is configured" when one may exist.
|
|
153
|
+
*/
|
|
154
|
+
async function orTypedNoLimit(read) {
|
|
155
|
+
try {
|
|
156
|
+
return await read();
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
if (await isNoSpendingLimit(err)) {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
throw err;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
const NOTHING_TO_CLEAR = {
|
|
166
|
+
lead: "No spending limit is configured on this account, so there is nothing to clear. Nothing was changed.",
|
|
167
|
+
payload: { cleared: false, reason: NO_SPENDING_LIMIT },
|
|
168
|
+
};
|
|
169
|
+
function limitPhrase(monthly, daily) {
|
|
170
|
+
return daily === undefined ? `${usd(monthly)}/month limit` : `${usd(monthly)}/month limit and the ${usd(daily)}/day cap`;
|
|
171
|
+
}
|
|
172
|
+
exports.spendingLimitClearTool = (0, define_js_1.defineWriteTool)({
|
|
173
|
+
name: "deeprelay_spending_limit_clear",
|
|
174
|
+
title: "Clear the deeprelay spending limit",
|
|
175
|
+
description: "REMOVE the account's spending limit entirely: the monthly limit and the daily cap. Afterwards inference is " +
|
|
176
|
+
"bounded only by the account balance. Requires the org-admin role. If no limit is configured this reports " +
|
|
177
|
+
"that there is nothing to clear and changes nothing. A new limit can be set again with " +
|
|
178
|
+
"deeprelay_spending_limit_update. Charges nothing.",
|
|
179
|
+
inputSchema: {},
|
|
180
|
+
destructive: true,
|
|
181
|
+
question: "Remove the spending limit entirely? Inference will then be bounded only by the account balance.",
|
|
182
|
+
context: "clearing the spending limit",
|
|
183
|
+
async quote(_args, config) {
|
|
184
|
+
const current = await orTypedNoLimit(() => new sdk_1.BillingApi(config).getSpendingLimit());
|
|
185
|
+
if (current === undefined) {
|
|
186
|
+
throw new define_js_1.WriteNothingToDo(NOTHING_TO_CLEAR);
|
|
187
|
+
}
|
|
188
|
+
const plan = {
|
|
189
|
+
previous_monthly: current.monthlyLimitDollars,
|
|
190
|
+
previous_daily: current.dailyLimitDollars,
|
|
191
|
+
};
|
|
192
|
+
return {
|
|
193
|
+
summary: `This removes the ${limitPhrase(current.monthlyLimitDollars, current.dailyLimitDollars)} entirely — ` +
|
|
194
|
+
"inference is then bounded only by the account balance.",
|
|
195
|
+
resolvedParams: plan,
|
|
196
|
+
};
|
|
197
|
+
},
|
|
198
|
+
async execute(p, config) {
|
|
199
|
+
const fresh = await orTypedNoLimit(() => new sdk_1.BillingApi(config).getSpendingLimit());
|
|
200
|
+
if (fresh === undefined) {
|
|
201
|
+
throw new define_js_1.WriteNothingToDo(NOTHING_TO_CLEAR);
|
|
202
|
+
}
|
|
203
|
+
if (fresh.monthlyLimitDollars !== p.previous_monthly || fresh.dailyLimitDollars !== p.previous_daily) {
|
|
204
|
+
throw new errors_js_1.QuoteUnavailableError("Refused at execution: the limit changed since the quote. The confirmation has been discarded.");
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
await new sdk_1.BillingApi(config).deleteSpendingLimit();
|
|
208
|
+
}
|
|
209
|
+
catch (err) {
|
|
210
|
+
// Cleared by someone else between the re-read and the DELETE.
|
|
211
|
+
if (await isNoSpendingLimit(err)) {
|
|
212
|
+
throw new define_js_1.WriteNothingToDo(NOTHING_TO_CLEAR);
|
|
213
|
+
}
|
|
214
|
+
throw err;
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
lead: `Spending limit cleared. Removed: the ${limitPhrase(p.previous_monthly, p.previous_daily)}. ` +
|
|
218
|
+
"Inference is now bounded only by the account balance.",
|
|
219
|
+
payload: {
|
|
220
|
+
cleared: true,
|
|
221
|
+
previous: {
|
|
222
|
+
monthly_limit_dollars: p.previous_monthly,
|
|
223
|
+
daily_limit_dollars: p.previous_daily ?? null,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
//# sourceMappingURL=spending-limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spending-limit.js","sourceRoot":"","sources":["../../../src/tools/write/spending-limit.ts"],"names":[],"mappings":";;;AAAA,0EAA0E;AAC1E,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,iEAAiE;AACjE,sEAAsE;AACtE,EAAE;AACF,4EAA4E;AAC5E,oCAAoC;AACpC,EAAE;AACF,+EAA+E;AAC/E,uBAAuB;AACvB,EAAE;AACF,+EAA+E;AAC/E,2DAA2D;AAC3D,2EAA2E;AAC3E,sEAAsE;AACtE,4EAA4E;AAC5E,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,wEAAwE;AACxE,uEAAuE;AACvE,sEAAsE;AACtE,yDAAyD;AACzD,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,6EAA6E;AAC7E,uEAAuE;AACvE,2CAA2C;AAC3C,wCAAiG;AACjG,6BAAwB;AAExB,+CAAyF;AACzF,2CAAgE;AAYhE,kFAAkF;AAClF,KAAK,UAAU,SAAS,CAAC,IAAkC;IACzD,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAI,IAAA,wBAAY,EAAC,GAAG,CAAC,KAAK,GAAG,EAAE,CAAC;YAC9B,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,GAAG,CAAC,CAAS;IACpB,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5B,CAAC;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B,+FAA+F,CAChG,CAAC;QACJ,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,gBAAU,CAAC,MAAM,CAAC,CAAC,mBAAmB,EAAE,CAAC;QACrD,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,8DAA8D;YAC9D,IAAI,MAAM,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;gBACjC,MAAM,IAAI,4BAAgB,CAAC,gBAAgB,CAAC,CAAC;YAC/C,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QACD,OAAO;YACL,IAAI,EACF,wCAAwC,WAAW,CAAC,CAAC,CAAC,gBAAgB,EAAE,CAAC,CAAC,cAAc,CAAC,IAAI;gBAC7F,uDAAuD;YACzD,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;gBACb,QAAQ,EAAE;oBACR,qBAAqB,EAAE,CAAC,CAAC,gBAAgB;oBACzC,mBAAmB,EAAE,CAAC,CAAC,cAAc,IAAI,IAAI;iBAC9C;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FALLBACK_VERSION = void 0;
|
|
4
|
+
exports.readVersion = readVersion;
|
|
5
|
+
// The package's own version, read at runtime (Phase 104, D-12: authored fresh).
|
|
6
|
+
//
|
|
7
|
+
// Two places need the same number: the server identity MCP clients see in the
|
|
8
|
+
// handshake, and the outbound User-Agent that auth.ts stamps on every API
|
|
9
|
+
// call. Keeping it in its own module lets auth.ts import it without importing
|
|
10
|
+
// the server entry point.
|
|
11
|
+
//
|
|
12
|
+
// The value is read from package.json at runtime rather than compiled in, so a
|
|
13
|
+
// release that injects the version into package.json is reported correctly
|
|
14
|
+
// without a rebuild. The compiled file is dist/version.js, so the manifest is
|
|
15
|
+
// one directory up. Under vitest the source file is src/version.ts, which also
|
|
16
|
+
// sits one directory below package.json.
|
|
17
|
+
const node_fs_1 = require("node:fs");
|
|
18
|
+
const node_path_1 = require("node:path");
|
|
19
|
+
/** Reported when package.json cannot be read. Matches the committed placeholder. */
|
|
20
|
+
exports.FALLBACK_VERSION = "0.0.0-dev";
|
|
21
|
+
function readVersion() {
|
|
22
|
+
try {
|
|
23
|
+
const manifest = JSON.parse((0, node_fs_1.readFileSync)((0, node_path_1.join)(__dirname, "..", "package.json"), "utf8"));
|
|
24
|
+
if (typeof manifest === "object" && manifest !== null) {
|
|
25
|
+
const version = manifest.version;
|
|
26
|
+
if (typeof version === "string" && version.trim() !== "") {
|
|
27
|
+
return version;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// An unreadable manifest must never stop the server from starting.
|
|
33
|
+
}
|
|
34
|
+
return exports.FALLBACK_VERSION;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAkBA,kCAeC;AAjCD,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1E,8EAA8E;AAC9E,0BAA0B;AAC1B,EAAE;AACF,+EAA+E;AAC/E,2EAA2E;AAC3E,8EAA8E;AAC9E,+EAA+E;AAC/E,yCAAyC;AACzC,qCAAuC;AACvC,yCAAiC;AAEjC,oFAAoF;AACvE,QAAA,gBAAgB,GAAG,WAAW,CAAC;AAE5C,SAAgB,WAAW;IACzB,IAAI,CAAC;QACH,MAAM,QAAQ,GAAY,IAAI,CAAC,KAAK,CAClC,IAAA,sBAAY,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAC5D,CAAC;QACF,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtD,MAAM,OAAO,GAAI,QAAkC,CAAC,OAAO,CAAC;YAC5D,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;gBACzD,OAAO,OAAO,CAAC;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,mEAAmE;IACrE,CAAC;IACD,OAAO,wBAAgB,CAAC;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deeprelay/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "MCP server for the deeprelay serverless inference API",
|
|
5
|
+
"author": "deeprelay",
|
|
6
|
+
"homepage": "https://deeprelay.ai/docs",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/deeprelay-dev/deeprelay.git"
|
|
10
|
+
},
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"bin": {
|
|
15
|
+
"deeprelay-mcp": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
20
|
+
],
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc",
|
|
26
|
+
"typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
27
|
+
"lint": "tsc --noEmit -p tsconfig.typecheck.json",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"smoke:inspector": "bash scripts/inspector-smoke.sh"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@deeprelay/sdk": "0.2.1",
|
|
33
|
+
"@modelcontextprotocol/sdk": "1.30.0",
|
|
34
|
+
"zod": "4.4.3"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@modelcontextprotocol/inspector": "2.2.0",
|
|
38
|
+
"@types/node": "22.20.1",
|
|
39
|
+
"typescript": "5.9.3",
|
|
40
|
+
"vitest": "4.1.11"
|
|
41
|
+
}
|
|
6
42
|
}
|