@beeper/desktop-mcp 4.2.2 → 4.6.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/LICENSE +1 -1
- package/README.md +28 -173
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +37 -0
- package/auth.js.map +1 -0
- package/auth.mjs +32 -0
- package/auth.mjs.map +1 -0
- package/code-tool-types.d.mts +7 -7
- package/code-tool-types.d.mts.map +1 -1
- package/code-tool-types.d.ts +7 -7
- package/code-tool-types.d.ts.map +1 -1
- package/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +215 -13
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +215 -13
- package/code-tool-worker.mjs.map +1 -1
- package/code-tool.d.mts +13 -4
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +13 -4
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +279 -100
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +276 -100
- package/code-tool.mjs.map +1 -1
- package/http.d.mts +6 -9
- package/http.d.mts.map +1 -1
- package/http.d.ts +6 -9
- package/http.d.ts.map +1 -1
- package/http.js +81 -47
- package/http.js.map +1 -1
- package/http.mjs +80 -43
- package/http.mjs.map +1 -1
- package/index.js +19 -50
- package/index.js.map +1 -1
- package/index.mjs +19 -50
- package/index.mjs.map +1 -1
- package/instructions.d.mts +2 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +2 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +48 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +45 -0
- package/instructions.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +203 -0
- package/methods.js.map +1 -0
- package/methods.mjs +199 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +9 -10
- package/options.d.mts.map +1 -1
- package/options.d.ts +9 -10
- package/options.d.ts.map +1 -1
- package/options.js +52 -360
- package/options.js.map +1 -1
- package/options.mjs +52 -360
- package/options.mjs.map +1 -1
- package/package.json +70 -82
- package/server.d.mts +10 -16
- package/server.d.mts.map +1 -1
- package/server.d.ts +10 -16
- package/server.d.ts.map +1 -1
- package/server.js +82 -105
- package/server.js.map +1 -1
- package/server.mjs +81 -100
- package/server.mjs.map +1 -1
- package/src/auth.ts +42 -0
- package/src/code-tool-types.ts +8 -5
- package/src/code-tool-worker.ts +265 -18
- package/src/code-tool.ts +360 -118
- package/src/http.ts +99 -50
- package/src/index.ts +22 -63
- package/src/instructions.ts +67 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +224 -0
- package/src/options.ts +70 -384
- package/src/server.ts +95 -121
- package/src/stdio.ts +6 -5
- package/src/{tools/types.ts → types.ts} +25 -5
- package/src/util.ts +25 -0
- package/stdio.d.mts +1 -1
- package/stdio.d.mts.map +1 -1
- package/stdio.d.ts +1 -1
- package/stdio.d.ts.map +1 -1
- package/stdio.js +5 -4
- package/stdio.js.map +1 -1
- package/stdio.mjs +5 -4
- package/stdio.mjs.map +1 -1
- package/{tools/types.d.mts → types.d.mts} +10 -2
- package/types.d.mts.map +1 -0
- package/{tools/types.d.ts → types.d.ts} +10 -2
- package/types.d.ts.map +1 -0
- package/{tools/types.js → types.js} +12 -0
- package/types.js.map +1 -0
- package/{tools/types.mjs → types.mjs} +11 -0
- package/types.mjs.map +1 -0
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
- package/compat.d.mts +0 -58
- package/compat.d.mts.map +0 -1
- package/compat.d.ts +0 -58
- package/compat.d.ts.map +0 -1
- package/compat.js +0 -387
- package/compat.js.map +0 -1
- package/compat.mjs +0 -378
- package/compat.mjs.map +0 -1
- package/docs-search-tool.d.mts +0 -44
- package/docs-search-tool.d.mts.map +0 -1
- package/docs-search-tool.d.ts +0 -44
- package/docs-search-tool.d.ts.map +0 -1
- package/docs-search-tool.js +0 -43
- package/docs-search-tool.js.map +0 -1
- package/docs-search-tool.mjs +0 -39
- package/docs-search-tool.mjs.map +0 -1
- package/dynamic-tools.d.mts +0 -12
- package/dynamic-tools.d.mts.map +0 -1
- package/dynamic-tools.d.ts +0 -12
- package/dynamic-tools.d.ts.map +0 -1
- package/dynamic-tools.js +0 -135
- package/dynamic-tools.js.map +0 -1
- package/dynamic-tools.mjs +0 -132
- package/dynamic-tools.mjs.map +0 -1
- package/filtering.d.mts +0 -2
- package/filtering.d.mts.map +0 -1
- package/filtering.d.ts +0 -2
- package/filtering.d.ts.map +0 -1
- package/filtering.js +0 -20
- package/filtering.js.map +0 -1
- package/filtering.mjs +0 -13
- package/filtering.mjs.map +0 -1
- package/handlers/get-accounts.d.mts +0 -3
- package/handlers/get-accounts.d.mts.map +0 -1
- package/handlers/get-accounts.d.ts +0 -3
- package/handlers/get-accounts.d.ts.map +0 -1
- package/handlers/get-accounts.js +0 -32
- package/handlers/get-accounts.js.map +0 -1
- package/handlers/get-accounts.mjs +0 -28
- package/handlers/get-accounts.mjs.map +0 -1
- package/handlers/get-chat.d.mts +0 -3
- package/handlers/get-chat.d.mts.map +0 -1
- package/handlers/get-chat.d.ts +0 -3
- package/handlers/get-chat.d.ts.map +0 -1
- package/handlers/get-chat.js +0 -20
- package/handlers/get-chat.js.map +0 -1
- package/handlers/get-chat.mjs +0 -16
- package/handlers/get-chat.mjs.map +0 -1
- package/handlers/index.d.mts +0 -3
- package/handlers/index.d.mts.map +0 -1
- package/handlers/index.d.ts +0 -3
- package/handlers/index.d.ts.map +0 -1
- package/handlers/index.js +0 -30
- package/handlers/index.js.map +0 -1
- package/handlers/index.mjs +0 -27
- package/handlers/index.mjs.map +0 -1
- package/handlers/list-chats.d.mts +0 -3
- package/handlers/list-chats.d.mts.map +0 -1
- package/handlers/list-chats.d.ts +0 -3
- package/handlers/list-chats.d.ts.map +0 -1
- package/handlers/list-chats.js +0 -46
- package/handlers/list-chats.js.map +0 -1
- package/handlers/list-chats.mjs +0 -42
- package/handlers/list-chats.mjs.map +0 -1
- package/handlers/list-messages.d.mts +0 -3
- package/handlers/list-messages.d.mts.map +0 -1
- package/handlers/list-messages.d.ts +0 -3
- package/handlers/list-messages.d.ts.map +0 -1
- package/handlers/list-messages.js +0 -34
- package/handlers/list-messages.js.map +0 -1
- package/handlers/list-messages.mjs +0 -30
- package/handlers/list-messages.mjs.map +0 -1
- package/handlers/open-app.d.mts +0 -3
- package/handlers/open-app.d.mts.map +0 -1
- package/handlers/open-app.d.ts +0 -3
- package/handlers/open-app.d.ts.map +0 -1
- package/handlers/open-app.js +0 -26
- package/handlers/open-app.js.map +0 -1
- package/handlers/open-app.mjs +0 -22
- package/handlers/open-app.mjs.map +0 -1
- package/handlers/search-chats.d.mts +0 -3
- package/handlers/search-chats.d.mts.map +0 -1
- package/handlers/search-chats.d.ts +0 -3
- package/handlers/search-chats.d.ts.map +0 -1
- package/handlers/search-chats.js +0 -38
- package/handlers/search-chats.js.map +0 -1
- package/handlers/search-chats.mjs +0 -34
- package/handlers/search-chats.mjs.map +0 -1
- package/handlers/search-messages.d.mts +0 -3
- package/handlers/search-messages.d.mts.map +0 -1
- package/handlers/search-messages.d.ts +0 -3
- package/handlers/search-messages.d.ts.map +0 -1
- package/handlers/search-messages.js +0 -11
- package/handlers/search-messages.js.map +0 -1
- package/handlers/search-messages.mjs +0 -7
- package/handlers/search-messages.mjs.map +0 -1
- package/handlers/search.d.mts +0 -3
- package/handlers/search.d.mts.map +0 -1
- package/handlers/search.d.ts +0 -3
- package/handlers/search.d.ts.map +0 -1
- package/handlers/search.js +0 -29
- package/handlers/search.js.map +0 -1
- package/handlers/search.mjs +0 -25
- package/handlers/search.mjs.map +0 -1
- package/handlers/send-message.d.mts +0 -3
- package/handlers/send-message.d.mts.map +0 -1
- package/handlers/send-message.d.ts +0 -3
- package/handlers/send-message.d.ts.map +0 -1
- package/handlers/send-message.js +0 -20
- package/handlers/send-message.js.map +0 -1
- package/handlers/send-message.mjs +0 -16
- package/handlers/send-message.mjs.map +0 -1
- package/handlers/utils.d.mts +0 -29
- package/handlers/utils.d.mts.map +0 -1
- package/handlers/utils.d.ts +0 -29
- package/handlers/utils.d.ts.map +0 -1
- package/handlers/utils.js +0 -296
- package/handlers/utils.js.map +0 -1
- package/handlers/utils.mjs +0 -282
- package/handlers/utils.mjs.map +0 -1
- package/headers.d.mts +0 -4
- package/headers.d.mts.map +0 -1
- package/headers.d.ts +0 -4
- package/headers.d.ts.map +0 -1
- package/headers.js +0 -22
- package/headers.js.map +0 -1
- package/headers.mjs +0 -18
- package/headers.mjs.map +0 -1
- package/src/compat.ts +0 -483
- package/src/docs-search-tool.ts +0 -48
- package/src/dynamic-tools.ts +0 -159
- package/src/filtering.ts +0 -14
- package/src/handlers/get-accounts.ts +0 -28
- package/src/handlers/get-chat.ts +0 -18
- package/src/handlers/index.ts +0 -29
- package/src/handlers/list-chats.ts +0 -47
- package/src/handlers/list-messages.ts +0 -33
- package/src/handlers/open-app.ts +0 -20
- package/src/handlers/search-chats.ts +0 -39
- package/src/handlers/search-messages.ts +0 -8
- package/src/handlers/search.ts +0 -24
- package/src/handlers/send-message.ts +0 -17
- package/src/handlers/utils.ts +0 -381
- package/src/headers.ts +0 -23
- package/src/tools/accounts/get-accounts.ts +0 -34
- package/src/tools/chats/archive-chat.ts +0 -43
- package/src/tools/chats/get-chat.ts +0 -45
- package/src/tools/chats/reminders/clear-chat-reminder.ts +0 -41
- package/src/tools/chats/reminders/set-chat-reminder.ts +0 -54
- package/src/tools/chats/search-chats.ts +0 -104
- package/src/tools/index.ts +0 -92
- package/src/tools/messages/list-messages.ts +0 -51
- package/src/tools/messages/search-messages.ts +0 -123
- package/src/tools/messages/send-message.ts +0 -47
- package/src/tools/top-level/focus-app.ts +0 -52
- package/src/tools/top-level/search.ts +0 -41
- package/src/tools.ts +0 -1
- package/tools/accounts/get-accounts.d.mts +0 -45
- package/tools/accounts/get-accounts.d.mts.map +0 -1
- package/tools/accounts/get-accounts.d.ts +0 -45
- package/tools/accounts/get-accounts.d.ts.map +0 -1
- package/tools/accounts/get-accounts.js +0 -31
- package/tools/accounts/get-accounts.js.map +0 -1
- package/tools/accounts/get-accounts.mjs +0 -27
- package/tools/accounts/get-accounts.mjs.map +0 -1
- package/tools/chats/archive-chat.d.mts +0 -45
- package/tools/chats/archive-chat.d.mts.map +0 -1
- package/tools/chats/archive-chat.d.ts +0 -45
- package/tools/chats/archive-chat.d.ts.map +0 -1
- package/tools/chats/archive-chat.js +0 -40
- package/tools/chats/archive-chat.js.map +0 -1
- package/tools/chats/archive-chat.mjs +0 -36
- package/tools/chats/archive-chat.mjs.map +0 -1
- package/tools/chats/get-chat.d.mts +0 -45
- package/tools/chats/get-chat.d.mts.map +0 -1
- package/tools/chats/get-chat.d.ts +0 -45
- package/tools/chats/get-chat.d.ts.map +0 -1
- package/tools/chats/get-chat.js +0 -41
- package/tools/chats/get-chat.js.map +0 -1
- package/tools/chats/get-chat.mjs +0 -37
- package/tools/chats/get-chat.mjs.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.d.mts +0 -45
- package/tools/chats/reminders/clear-chat-reminder.d.mts.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.d.ts +0 -45
- package/tools/chats/reminders/clear-chat-reminder.d.ts.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.js +0 -38
- package/tools/chats/reminders/clear-chat-reminder.js.map +0 -1
- package/tools/chats/reminders/clear-chat-reminder.mjs +0 -34
- package/tools/chats/reminders/clear-chat-reminder.mjs.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.d.mts +0 -45
- package/tools/chats/reminders/set-chat-reminder.d.mts.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.d.ts +0 -45
- package/tools/chats/reminders/set-chat-reminder.d.ts.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.js +0 -51
- package/tools/chats/reminders/set-chat-reminder.js.map +0 -1
- package/tools/chats/reminders/set-chat-reminder.mjs +0 -47
- package/tools/chats/reminders/set-chat-reminder.mjs.map +0 -1
- package/tools/chats/search-chats.d.mts +0 -45
- package/tools/chats/search-chats.d.mts.map +0 -1
- package/tools/chats/search-chats.d.ts +0 -45
- package/tools/chats/search-chats.d.ts.map +0 -1
- package/tools/chats/search-chats.js +0 -92
- package/tools/chats/search-chats.js.map +0 -1
- package/tools/chats/search-chats.mjs +0 -88
- package/tools/chats/search-chats.mjs.map +0 -1
- package/tools/index.d.mts +0 -10
- package/tools/index.d.mts.map +0 -1
- package/tools/index.d.ts +0 -10
- package/tools/index.d.ts.map +0 -1
- package/tools/index.js +0 -76
- package/tools/index.js.map +0 -1
- package/tools/index.mjs +0 -69
- package/tools/index.mjs.map +0 -1
- package/tools/messages/list-messages.d.mts +0 -45
- package/tools/messages/list-messages.d.mts.map +0 -1
- package/tools/messages/list-messages.d.ts +0 -45
- package/tools/messages/list-messages.d.ts.map +0 -1
- package/tools/messages/list-messages.js +0 -47
- package/tools/messages/list-messages.js.map +0 -1
- package/tools/messages/list-messages.mjs +0 -43
- package/tools/messages/list-messages.mjs.map +0 -1
- package/tools/messages/search-messages.d.mts +0 -45
- package/tools/messages/search-messages.d.mts.map +0 -1
- package/tools/messages/search-messages.d.ts +0 -45
- package/tools/messages/search-messages.d.ts.map +0 -1
- package/tools/messages/search-messages.js +0 -110
- package/tools/messages/search-messages.js.map +0 -1
- package/tools/messages/search-messages.mjs +0 -106
- package/tools/messages/search-messages.mjs.map +0 -1
- package/tools/messages/send-message.d.mts +0 -45
- package/tools/messages/send-message.d.mts.map +0 -1
- package/tools/messages/send-message.d.ts +0 -45
- package/tools/messages/send-message.d.ts.map +0 -1
- package/tools/messages/send-message.js +0 -43
- package/tools/messages/send-message.js.map +0 -1
- package/tools/messages/send-message.mjs +0 -39
- package/tools/messages/send-message.mjs.map +0 -1
- package/tools/top-level/focus-app.d.mts +0 -45
- package/tools/top-level/focus-app.d.mts.map +0 -1
- package/tools/top-level/focus-app.d.ts +0 -45
- package/tools/top-level/focus-app.d.ts.map +0 -1
- package/tools/top-level/focus-app.js +0 -47
- package/tools/top-level/focus-app.js.map +0 -1
- package/tools/top-level/focus-app.mjs +0 -43
- package/tools/top-level/focus-app.mjs.map +0 -1
- package/tools/top-level/search.d.mts +0 -45
- package/tools/top-level/search.d.mts.map +0 -1
- package/tools/top-level/search.d.ts +0 -45
- package/tools/top-level/search.d.ts.map +0 -1
- package/tools/top-level/search.js +0 -37
- package/tools/top-level/search.js.map +0 -1
- package/tools/top-level/search.mjs +0 -33
- package/tools/top-level/search.mjs.map +0 -1
- package/tools/types.d.mts.map +0 -1
- package/tools/types.d.ts.map +0 -1
- package/tools/types.js.map +0 -1
- package/tools/types.mjs.map +0 -1
- package/tools.d.mts +0 -2
- package/tools.d.mts.map +0 -1
- package/tools.d.ts +0 -2
- package/tools.d.ts.map +0 -1
- package/tools.js +0 -18
- package/tools.js.map +0 -1
- package/tools.mjs +0 -2
- package/tools.mjs.map +0 -1
package/code-tool.js
CHANGED
|
@@ -33,125 +33,304 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.codeTool = codeTool;
|
|
38
|
-
const
|
|
39
|
-
const
|
|
41
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
42
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
43
|
+
const node_url_1 = __importDefault(require("node:url"));
|
|
44
|
+
const deno_http_worker_1 = require("@valtown/deno-http-worker");
|
|
45
|
+
const code_tool_paths_cjs_1 = require("./code-tool-paths.cjs");
|
|
46
|
+
const types_1 = require("./types.js");
|
|
47
|
+
const util_1 = require("./util.js");
|
|
48
|
+
const logger_1 = require("./logger.js");
|
|
49
|
+
const prompt = `Runs JavaScript code to interact with the Beeper Desktop API.
|
|
50
|
+
|
|
51
|
+
You are a skilled TypeScript programmer writing code to interface with the service.
|
|
52
|
+
Define an async function named "run" that takes a single parameter of an initialized SDK client and it will be run.
|
|
53
|
+
For example:
|
|
54
|
+
|
|
55
|
+
\`\`\`
|
|
56
|
+
async function run(client) {
|
|
57
|
+
const page = await client.chats.search({
|
|
58
|
+
includeMuted: true,
|
|
59
|
+
limit: 3,
|
|
60
|
+
type: 'single',
|
|
61
|
+
});
|
|
62
|
+
const chat = page.items[0]
|
|
63
|
+
|
|
64
|
+
console.log(chat.id);
|
|
65
|
+
}
|
|
66
|
+
\`\`\`
|
|
67
|
+
|
|
68
|
+
You will be returned anything that your function returns, plus the results of any console.log statements.
|
|
69
|
+
Do not add try-catch blocks for single API calls. The tool will handle errors for you.
|
|
70
|
+
Do not add comments unless necessary for generating better code.
|
|
71
|
+
Code will run in a container, and cannot interact with the network outside of the given SDK client.
|
|
72
|
+
Variables will not persist between calls, so make sure to return or log any data you might need later.
|
|
73
|
+
Remember that you are writing TypeScript code, so you need to be careful with your types.
|
|
74
|
+
Always type dynamic key-value stores explicitly as Record<string, YourValueType> instead of {}.`;
|
|
40
75
|
/**
|
|
41
76
|
* A tool that runs code against a copy of the SDK.
|
|
42
77
|
*
|
|
43
|
-
* Instead of exposing every endpoint as
|
|
78
|
+
* Instead of exposing every endpoint as its own tool, which uses up too many tokens for LLMs to use at once,
|
|
44
79
|
* we expose a single tool that can be used to search for endpoints by name, resource, operation, or tag, and then
|
|
45
80
|
* a generic endpoint that can be used to invoke any endpoint with the provided arguments.
|
|
46
81
|
*
|
|
47
|
-
* @param
|
|
82
|
+
* @param blockedMethods - The methods to block for code execution. Blocking is done by simple string
|
|
83
|
+
* matching, so it is not secure against obfuscation. For stronger security, block in the downstream API
|
|
84
|
+
* with limited API keys.
|
|
85
|
+
* @param codeExecutionMode - Whether to execute code in a local Deno environment or in a remote
|
|
86
|
+
* sandbox environment hosted by Stainless.
|
|
48
87
|
*/
|
|
49
|
-
|
|
88
|
+
function codeTool({ blockedMethods, codeExecutionMode, }) {
|
|
50
89
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
51
90
|
const tool = {
|
|
52
91
|
name: 'execute',
|
|
53
|
-
description:
|
|
54
|
-
inputSchema: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
|
|
66
|
-
`--allow-net=${baseURLHostname}`,
|
|
67
|
-
// Allow environment variables because instantiating the client will try to read from them,
|
|
68
|
-
// even though they are not set.
|
|
69
|
-
'--allow-env',
|
|
70
|
-
],
|
|
71
|
-
printOutput: true,
|
|
72
|
-
spawnOptions: {
|
|
73
|
-
cwd: (0, node_path_1.dirname)(workerPath),
|
|
92
|
+
description: prompt,
|
|
93
|
+
inputSchema: {
|
|
94
|
+
type: 'object',
|
|
95
|
+
properties: {
|
|
96
|
+
code: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'Code to execute.',
|
|
99
|
+
},
|
|
100
|
+
intent: {
|
|
101
|
+
type: 'string',
|
|
102
|
+
description: 'Task you are trying to perform. Used for improving the service.',
|
|
103
|
+
},
|
|
74
104
|
},
|
|
75
|
-
|
|
105
|
+
required: ['code'],
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
const logger = (0, logger_1.getLogger)();
|
|
109
|
+
const handler = async ({ reqContext, args, }) => {
|
|
110
|
+
const code = args.code;
|
|
111
|
+
// Do very basic blocking of code that includes forbidden method names.
|
|
112
|
+
//
|
|
113
|
+
// WARNING: This is not secure against obfuscation and other evasion methods. If
|
|
114
|
+
// stronger security blocks are required, then these should be enforced in the downstream
|
|
115
|
+
// API (e.g., by having users call the MCP server with API keys with limited permissions).
|
|
116
|
+
if (blockedMethods) {
|
|
117
|
+
const blockedMatches = blockedMethods.filter((method) => code.includes(method.fullyQualifiedName));
|
|
118
|
+
if (blockedMatches.length > 0) {
|
|
119
|
+
return (0, types_1.asErrorResult)(`The following methods have been blocked by the MCP server and cannot be used in code execution: ${blockedMatches
|
|
120
|
+
.map((m) => m.fullyQualifiedName)
|
|
121
|
+
.join(', ')}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
let result;
|
|
125
|
+
const startTime = Date.now();
|
|
126
|
+
if (codeExecutionMode === 'local') {
|
|
127
|
+
logger.debug('Executing code in local Deno environment');
|
|
128
|
+
result = await localDenoHandler({ reqContext, args });
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
logger.debug('Executing code in remote Stainless environment');
|
|
132
|
+
result = await remoteStainlessHandler({ reqContext, args });
|
|
133
|
+
}
|
|
134
|
+
logger.info({
|
|
135
|
+
codeExecutionMode,
|
|
136
|
+
durationMs: Date.now() - startTime,
|
|
137
|
+
isError: result.isError,
|
|
138
|
+
contentRows: result.content?.length ?? 0,
|
|
139
|
+
}, 'Got code tool execution result');
|
|
140
|
+
return result;
|
|
141
|
+
};
|
|
142
|
+
return { metadata, tool, handler };
|
|
143
|
+
}
|
|
144
|
+
const remoteStainlessHandler = async ({ reqContext, args, }) => {
|
|
145
|
+
const code = args.code;
|
|
146
|
+
const intent = args.intent;
|
|
147
|
+
const client = reqContext.client;
|
|
148
|
+
const codeModeEndpoint = (0, util_1.readEnv)('CODE_MODE_ENDPOINT_URL') ?? 'https://api.stainless.com/api/ai/code-tool';
|
|
149
|
+
// Setting a Stainless API key authenticates requests to the code tool endpoint.
|
|
150
|
+
const res = await fetch(codeModeEndpoint, {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
headers: {
|
|
153
|
+
...(reqContext.stainlessApiKey && { Authorization: reqContext.stainlessApiKey }),
|
|
154
|
+
'Content-Type': 'application/json',
|
|
155
|
+
'x-stainless-mcp-client-envs': JSON.stringify({
|
|
156
|
+
BEEPER_ACCESS_TOKEN: (0, util_1.requireValue)((0, util_1.readEnv)('BEEPER_ACCESS_TOKEN') ?? client.accessToken, 'set BEEPER_ACCESS_TOKEN environment variable or provide accessToken client option'),
|
|
157
|
+
BEEPER_DESKTOP_BASE_URL: (0, util_1.readEnv)('BEEPER_DESKTOP_BASE_URL') ?? client.baseURL ?? undefined,
|
|
158
|
+
}),
|
|
159
|
+
},
|
|
160
|
+
body: JSON.stringify({
|
|
161
|
+
project_name: 'beeper-desktop-api',
|
|
162
|
+
code,
|
|
163
|
+
intent,
|
|
164
|
+
client_opts: {},
|
|
165
|
+
}),
|
|
166
|
+
});
|
|
167
|
+
if (!res.ok) {
|
|
168
|
+
if (res.status === 404 && !reqContext.stainlessApiKey) {
|
|
169
|
+
throw new Error('Could not access code tool for this project. You may need to provide a Stainless API key via the STAINLESS_API_KEY environment variable, the --stainless-api-key flag, or the x-stainless-api-key HTTP header.');
|
|
170
|
+
}
|
|
171
|
+
throw new Error(`${res.status}: ${res.statusText} error when trying to contact Code Tool server. Details: ${await res.text()}`);
|
|
172
|
+
}
|
|
173
|
+
const { is_error, result, log_lines, err_lines } = (await res.json());
|
|
174
|
+
const hasLogs = log_lines.length > 0 || err_lines.length > 0;
|
|
175
|
+
const output = {
|
|
176
|
+
result,
|
|
177
|
+
...(log_lines.length > 0 && { log_lines }),
|
|
178
|
+
...(err_lines.length > 0 && { err_lines }),
|
|
179
|
+
};
|
|
180
|
+
if (is_error) {
|
|
181
|
+
return (0, types_1.asErrorResult)(typeof result === 'string' && !hasLogs ? result : JSON.stringify(output, null, 2));
|
|
182
|
+
}
|
|
183
|
+
return (0, types_1.asTextContentResult)(output);
|
|
184
|
+
};
|
|
185
|
+
const localDenoHandler = async ({ reqContext, args, }) => {
|
|
186
|
+
const client = reqContext.client;
|
|
187
|
+
const baseURLHostname = new URL(client.baseURL).hostname;
|
|
188
|
+
const { code } = args;
|
|
189
|
+
let denoPath;
|
|
190
|
+
const packageRoot = node_path_1.default.resolve(node_path_1.default.dirname(code_tool_paths_cjs_1.workerPath), '..');
|
|
191
|
+
const packageNodeModulesPath = node_path_1.default.resolve(packageRoot, 'node_modules');
|
|
192
|
+
// Check if deno is in PATH
|
|
193
|
+
const { execSync } = await Promise.resolve().then(() => __importStar(require('node:child_process')));
|
|
194
|
+
try {
|
|
195
|
+
execSync('command -v deno', { stdio: 'ignore' });
|
|
196
|
+
denoPath = 'deno';
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
76
199
|
try {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
200
|
+
// Use deno binary in node_modules if it's found
|
|
201
|
+
const denoNodeModulesPath = node_path_1.default.resolve(packageNodeModulesPath, 'deno', 'bin.cjs');
|
|
202
|
+
await node_fs_1.default.promises.access(denoNodeModulesPath, node_fs_1.default.constants.X_OK);
|
|
203
|
+
denoPath = denoNodeModulesPath;
|
|
204
|
+
}
|
|
205
|
+
catch {
|
|
206
|
+
return (0, types_1.asErrorResult)('Deno is required for code execution but was not found. ' +
|
|
207
|
+
'Install it from https://deno.land or run: npm install deno');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const allowReadPaths = [
|
|
211
|
+
'code-tool-worker.mjs',
|
|
212
|
+
`${code_tool_paths_cjs_1.workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
|
|
213
|
+
packageRoot,
|
|
214
|
+
];
|
|
215
|
+
// Follow symlinks in node_modules to allow read access to workspace-linked packages
|
|
216
|
+
try {
|
|
217
|
+
const sdkPkgName = '@beeper/desktop-api';
|
|
218
|
+
const sdkDir = node_path_1.default.resolve(packageNodeModulesPath, sdkPkgName);
|
|
219
|
+
const realSdkDir = node_fs_1.default.realpathSync(sdkDir);
|
|
220
|
+
if (realSdkDir !== sdkDir) {
|
|
221
|
+
allowReadPaths.push(realSdkDir);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
// Ignore if symlink resolution fails
|
|
226
|
+
}
|
|
227
|
+
const allowRead = allowReadPaths.join(',');
|
|
228
|
+
const worker = await (0, deno_http_worker_1.newDenoHTTPWorker)(node_url_1.default.pathToFileURL(code_tool_paths_cjs_1.workerPath), {
|
|
229
|
+
denoExecutable: denoPath,
|
|
230
|
+
runFlags: [
|
|
231
|
+
`--node-modules-dir=manual`,
|
|
232
|
+
`--allow-read=${allowRead}`,
|
|
233
|
+
`--allow-net=${baseURLHostname}`,
|
|
234
|
+
// Allow environment variables because instantiating the client will try to read from them,
|
|
235
|
+
// even though they are not set.
|
|
236
|
+
'--allow-env',
|
|
237
|
+
],
|
|
238
|
+
printOutput: true,
|
|
239
|
+
spawnOptions: {
|
|
240
|
+
cwd: node_path_1.default.dirname(code_tool_paths_cjs_1.workerPath),
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
try {
|
|
244
|
+
const resp = await new Promise((resolve, reject) => {
|
|
245
|
+
worker.addEventListener('exit', (exitCode) => {
|
|
246
|
+
reject(new Error(`Worker exited with code ${exitCode}`));
|
|
247
|
+
});
|
|
248
|
+
const opts = {
|
|
249
|
+
baseURL: client.baseURL,
|
|
250
|
+
accessToken: client.accessToken,
|
|
251
|
+
defaultHeaders: {
|
|
252
|
+
'X-Stainless-MCP': 'true',
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
const req = worker.request('http://localhost', {
|
|
256
|
+
headers: {
|
|
257
|
+
'content-type': 'application/json',
|
|
258
|
+
},
|
|
259
|
+
method: 'POST',
|
|
260
|
+
}, (resp) => {
|
|
261
|
+
const body = [];
|
|
262
|
+
resp.on('error', (err) => {
|
|
263
|
+
reject(err);
|
|
107
264
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
code,
|
|
265
|
+
resp.on('data', (chunk) => {
|
|
266
|
+
body.push(chunk);
|
|
111
267
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
268
|
+
resp.on('end', () => {
|
|
269
|
+
resolve(new Response(Buffer.concat(body).toString(), {
|
|
270
|
+
status: resp.statusCode ?? 200,
|
|
271
|
+
headers: resp.headers,
|
|
272
|
+
}));
|
|
116
273
|
});
|
|
117
|
-
req.end();
|
|
118
274
|
});
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
275
|
+
const body = JSON.stringify({
|
|
276
|
+
opts,
|
|
277
|
+
code,
|
|
278
|
+
});
|
|
279
|
+
req.write(body, (err) => {
|
|
280
|
+
if (err != null) {
|
|
281
|
+
reject(err);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
284
|
+
req.end();
|
|
285
|
+
});
|
|
286
|
+
if (resp.status === 200) {
|
|
287
|
+
const { result, log_lines, err_lines } = (await resp.json());
|
|
288
|
+
const returnOutput = result == null ? null : ({
|
|
289
|
+
type: 'text',
|
|
290
|
+
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
291
|
+
});
|
|
292
|
+
const logOutput = log_lines.length === 0 ?
|
|
293
|
+
null
|
|
294
|
+
: {
|
|
295
|
+
type: 'text',
|
|
296
|
+
text: log_lines.join('\n'),
|
|
141
297
|
};
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
298
|
+
const errOutput = err_lines.length === 0 ?
|
|
299
|
+
null
|
|
300
|
+
: {
|
|
301
|
+
type: 'text',
|
|
302
|
+
text: 'Error output:\n' + err_lines.join('\n'),
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
content: [returnOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
306
|
+
};
|
|
150
307
|
}
|
|
151
|
-
|
|
152
|
-
|
|
308
|
+
else {
|
|
309
|
+
const { result, log_lines, err_lines } = (await resp.json());
|
|
310
|
+
const messageOutput = result == null ? null : ({
|
|
311
|
+
type: 'text',
|
|
312
|
+
text: typeof result === 'string' ? result : JSON.stringify(result),
|
|
313
|
+
});
|
|
314
|
+
const logOutput = log_lines.length === 0 ?
|
|
315
|
+
null
|
|
316
|
+
: {
|
|
317
|
+
type: 'text',
|
|
318
|
+
text: log_lines.join('\n'),
|
|
319
|
+
};
|
|
320
|
+
const errOutput = err_lines.length === 0 ?
|
|
321
|
+
null
|
|
322
|
+
: {
|
|
323
|
+
type: 'text',
|
|
324
|
+
text: 'Error output:\n' + err_lines.join('\n'),
|
|
325
|
+
};
|
|
326
|
+
return {
|
|
327
|
+
content: [messageOutput, logOutput, errOutput].filter((block) => block !== null),
|
|
328
|
+
isError: true,
|
|
329
|
+
};
|
|
153
330
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
331
|
+
}
|
|
332
|
+
finally {
|
|
333
|
+
worker.terminate();
|
|
334
|
+
}
|
|
335
|
+
};
|
|
157
336
|
//# sourceMappingURL=code-tool.js.map
|
package/code-tool.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF
|
|
1
|
+
{"version":3,"file":"code-tool.js","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEtF,4BA6EC;AA3ID,sDAAyB;AACzB,0DAA6B;AAC7B,wDAA2B;AAC3B,gEAA8D;AAC9D,+DAAmD;AACnD,sCAQiB;AAEjB,oCAA+C;AAE/C,wCAAqC;AAKrC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;gGAyBiF,CAAC;AAEjG;;;;;;;;;;;;GAYG;AACH,SAAgB,QAAQ,CAAC,EACvB,cAAc,EACd,iBAAiB,GAIlB;IACC,MAAM,QAAQ,GAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC7E,MAAM,IAAI,GAAS;QACjB,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kBAAkB;iBAChC;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,iEAAiE;iBAC/E;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,IAAA,kBAAS,GAAE,CAAC;IAE3B,MAAM,OAAO,GAAG,KAA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