@beeper/desktop-mcp 0.1.4 → 4.1.293
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 +10 -14
- package/code-tool.d.mts +1 -1
- package/code-tool.d.mts.map +1 -1
- package/code-tool.d.ts +1 -1
- package/code-tool.d.ts.map +1 -1
- package/code-tool.js +40 -6
- package/code-tool.js.map +1 -1
- package/code-tool.mjs +4 -3
- package/code-tool.mjs.map +1 -1
- package/docs-search-tool.d.mts +44 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +44 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +43 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +39 -0
- package/docs-search-tool.mjs.map +1 -0
- package/http.d.mts +5 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts +5 -1
- package/http.d.ts.map +1 -1
- package/http.js +7 -9
- package/http.js.map +1 -1
- package/http.mjs +7 -9
- package/http.mjs.map +1 -1
- package/index.js +3 -3
- package/index.js.map +1 -1
- package/index.mjs +3 -3
- package/index.mjs.map +1 -1
- package/options.d.mts +1 -0
- package/options.d.mts.map +1 -1
- package/options.d.ts +1 -0
- package/options.d.ts.map +1 -1
- package/options.js +15 -8
- package/options.js.map +1 -1
- package/options.mjs +15 -8
- package/options.mjs.map +1 -1
- package/package.json +12 -2
- package/server.d.mts +1 -1
- package/server.d.mts.map +1 -1
- package/server.d.ts +1 -1
- package/server.d.ts.map +1 -1
- package/server.js +39 -13
- package/server.js.map +1 -1
- package/server.mjs +40 -14
- package/server.mjs.map +1 -1
- package/src/code-tool.ts +5 -3
- package/src/docs-search-tool.ts +48 -0
- package/src/http.ts +35 -23
- package/src/index.ts +3 -3
- package/src/options.ts +19 -9
- package/src/server.ts +42 -15
- package/src/tools/accounts/get-accounts.ts +3 -3
- package/src/tools/chats/archive-chat.ts +6 -6
- package/src/tools/chats/get-chat.ts +6 -7
- package/src/tools/chats/reminders/clear-chat-reminder.ts +10 -8
- package/src/tools/chats/reminders/set-chat-reminder.ts +6 -5
- package/src/tools/chats/search-chats.ts +14 -12
- package/src/tools/index.ts +6 -4
- package/src/tools/messages/list-messages.ts +51 -0
- package/src/tools/messages/search-messages.ts +15 -26
- package/src/tools/messages/send-message.ts +5 -6
- package/src/tools/{app/open-in-app.ts → top-level/focus-app.ts} +13 -8
- package/src/tools/top-level/search.ts +41 -0
- package/tools/accounts/get-accounts.js +3 -3
- package/tools/accounts/get-accounts.js.map +1 -1
- package/tools/accounts/get-accounts.mjs +3 -3
- package/tools/accounts/get-accounts.mjs.map +1 -1
- package/tools/chats/archive-chat.d.mts.map +1 -1
- package/tools/chats/archive-chat.d.ts.map +1 -1
- package/tools/chats/archive-chat.js +6 -5
- package/tools/chats/archive-chat.js.map +1 -1
- package/tools/chats/archive-chat.mjs +6 -5
- package/tools/chats/archive-chat.mjs.map +1 -1
- package/tools/chats/get-chat.d.mts.map +1 -1
- package/tools/chats/get-chat.d.ts.map +1 -1
- package/tools/chats/get-chat.js +6 -6
- package/tools/chats/get-chat.js.map +1 -1
- package/tools/chats/get-chat.mjs +6 -6
- package/tools/chats/get-chat.mjs.map +1 -1
- package/tools/chats/reminders/clear-chat-reminder.d.mts.map +1 -1
- package/tools/chats/reminders/clear-chat-reminder.d.ts.map +1 -1
- package/tools/chats/reminders/clear-chat-reminder.js +10 -7
- package/tools/chats/reminders/clear-chat-reminder.js.map +1 -1
- package/tools/chats/reminders/clear-chat-reminder.mjs +10 -7
- package/tools/chats/reminders/clear-chat-reminder.mjs.map +1 -1
- package/tools/chats/reminders/set-chat-reminder.d.mts.map +1 -1
- package/tools/chats/reminders/set-chat-reminder.d.ts.map +1 -1
- package/tools/chats/reminders/set-chat-reminder.js +6 -5
- package/tools/chats/reminders/set-chat-reminder.js.map +1 -1
- package/tools/chats/reminders/set-chat-reminder.mjs +6 -5
- package/tools/chats/reminders/set-chat-reminder.mjs.map +1 -1
- package/tools/chats/search-chats.d.mts.map +1 -1
- package/tools/chats/search-chats.d.ts.map +1 -1
- package/tools/chats/search-chats.js +13 -12
- package/tools/chats/search-chats.js.map +1 -1
- package/tools/chats/search-chats.mjs +13 -12
- package/tools/chats/search-chats.mjs.map +1 -1
- package/tools/index.d.mts.map +1 -1
- package/tools/index.d.ts.map +1 -1
- package/tools/index.js +6 -4
- package/tools/index.js.map +1 -1
- package/tools/index.mjs +6 -4
- package/tools/index.mjs.map +1 -1
- package/tools/messages/{attachments/download-attachment.d.ts → list-messages.d.mts} +1 -1
- package/tools/messages/list-messages.d.mts.map +1 -0
- package/tools/messages/{attachments/download-attachment.d.mts → list-messages.d.ts} +1 -1
- package/tools/messages/list-messages.d.ts.map +1 -0
- package/tools/messages/list-messages.js +47 -0
- package/tools/messages/list-messages.js.map +1 -0
- package/tools/messages/list-messages.mjs +43 -0
- package/tools/messages/list-messages.mjs.map +1 -0
- package/tools/messages/search-messages.d.mts.map +1 -1
- package/tools/messages/search-messages.d.ts.map +1 -1
- package/tools/messages/search-messages.js +14 -26
- package/tools/messages/search-messages.js.map +1 -1
- package/tools/messages/search-messages.mjs +14 -26
- package/tools/messages/search-messages.mjs.map +1 -1
- package/tools/messages/send-message.d.mts.map +1 -1
- package/tools/messages/send-message.d.ts.map +1 -1
- package/tools/messages/send-message.js +5 -5
- package/tools/messages/send-message.js.map +1 -1
- package/tools/messages/send-message.mjs +5 -5
- package/tools/messages/send-message.mjs.map +1 -1
- package/tools/{app/open-in-app.d.ts → top-level/focus-app.d.mts} +1 -1
- package/tools/top-level/focus-app.d.mts.map +1 -0
- package/tools/{app/open-in-app.d.mts → top-level/focus-app.d.ts} +1 -1
- package/tools/top-level/focus-app.d.ts.map +1 -0
- package/tools/{app/open-in-app.js → top-level/focus-app.js} +13 -9
- package/tools/top-level/focus-app.js.map +1 -0
- package/tools/{app/open-in-app.mjs → top-level/focus-app.mjs} +13 -9
- package/tools/top-level/focus-app.mjs.map +1 -0
- package/tools/top-level/search.d.mts +45 -0
- package/tools/top-level/search.d.mts.map +1 -0
- package/tools/top-level/search.d.ts +45 -0
- package/tools/top-level/search.d.ts.map +1 -0
- package/tools/top-level/search.js +37 -0
- package/tools/top-level/search.js.map +1 -0
- package/tools/top-level/search.mjs +33 -0
- package/tools/top-level/search.mjs.map +1 -0
- package/src/tools/messages/attachments/download-attachment.ts +0 -42
- package/tools/app/open-in-app.d.mts.map +0 -1
- package/tools/app/open-in-app.d.ts.map +0 -1
- package/tools/app/open-in-app.js.map +0 -1
- package/tools/app/open-in-app.mjs.map +0 -1
- package/tools/messages/attachments/download-attachment.d.mts.map +0 -1
- package/tools/messages/attachments/download-attachment.d.ts.map +0 -1
- package/tools/messages/attachments/download-attachment.js +0 -39
- package/tools/messages/attachments/download-attachment.js.map +0 -1
- package/tools/messages/attachments/download-attachment.mjs +0 -35
- package/tools/messages/attachments/download-attachment.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -180,7 +180,7 @@ http://localhost:3000?client=cursor&capability=tool-name-length%3D40
|
|
|
180
180
|
import { server, endpoints, init } from "@beeper/desktop-mcp/server";
|
|
181
181
|
|
|
182
182
|
// import a specific tool
|
|
183
|
-
import
|
|
183
|
+
import focusApp from "@beeper/desktop-mcp/tools/top-level/focus-app";
|
|
184
184
|
|
|
185
185
|
// initialize the server and all endpoints
|
|
186
186
|
init({ server, endpoints });
|
|
@@ -205,26 +205,27 @@ const myCustomEndpoint = {
|
|
|
205
205
|
};
|
|
206
206
|
|
|
207
207
|
// initialize the server with your custom endpoints
|
|
208
|
-
init({ server: myServer, endpoints: [
|
|
208
|
+
init({ server: myServer, endpoints: [focusApp, myCustomEndpoint] });
|
|
209
209
|
```
|
|
210
210
|
|
|
211
211
|
## Available Tools
|
|
212
212
|
|
|
213
213
|
The following tools are available in this MCP server.
|
|
214
214
|
|
|
215
|
-
### Resource
|
|
215
|
+
### Resource `$client`:
|
|
216
216
|
|
|
217
|
-
- `
|
|
217
|
+
- `focus_app` (`write`) tags: [app]: Focus Beeper Desktop and optionally navigate to a specific chat, message, or pre-fill draft text and attachment.
|
|
218
|
+
- `search` (`read`) tags: [app]: Search for chats, participant name matches in groups, and the first page of messages in one call. Use this when the user asks for a specific chat, group, or person.
|
|
218
219
|
|
|
219
|
-
### Resource `
|
|
220
|
+
### Resource `accounts`:
|
|
220
221
|
|
|
221
|
-
- `
|
|
222
|
+
- `get_accounts` (`read`) tags: [accounts]: List connected accounts on this device.
|
|
222
223
|
|
|
223
224
|
### Resource `chats`:
|
|
224
225
|
|
|
225
226
|
- `get_chat` (`read`) tags: [chats]: Get chat details: metadata, participants (limited), last activity.
|
|
226
227
|
- `archive_chat` (`write`) tags: [chats]: Archive or unarchive a chat.
|
|
227
|
-
- `search_chats` (`read`) tags: [chats]: Search chats by
|
|
228
|
+
- `search_chats` (`read`) tags: [chats]: Search chats by title/network or participants using Beeper Desktop's renderer algorithm. Optional 'scope'.
|
|
228
229
|
|
|
229
230
|
### Resource `chats.reminders`:
|
|
230
231
|
|
|
@@ -233,23 +234,18 @@ The following tools are available in this MCP server.
|
|
|
233
234
|
|
|
234
235
|
### Resource `messages`:
|
|
235
236
|
|
|
237
|
+
- `list_messages` (`read`) tags: [messages]: List messages from a specific chat with pagination support.
|
|
236
238
|
- `search_messages` (`read`) tags: [messages]: Search messages across chats using Beeper's message index.
|
|
237
239
|
- When to use: find messages by text and/or filters (chatIDs, accountIDs, chatType, media type filters, sender, date ranges).
|
|
238
240
|
- CRITICAL: Query is LITERAL WORD MATCHING, NOT semantic search! Only finds messages containing these EXACT words.
|
|
239
241
|
• ✅ RIGHT: query="dinner" or query="sick" or query="error" (single words users type)
|
|
240
242
|
• ❌ WRONG: query="dinner plans tonight" or query="health issues" (phrases/concepts)
|
|
241
243
|
• The query matches ALL words provided (in any order). Example: query="flight booking" finds messages with both "flight" AND "booking".
|
|
242
|
-
- Media filters: Use onlyWithMedia for any media, or specific filters like onlyWithVideo, onlyWithImage, onlyWithLink, onlyWithFile for specific types.
|
|
243
|
-
- Pagination: use 'oldestCursor' + direction='before' for older; 'newestCursor' + direction='after' for newer.
|
|
244
244
|
- Performance: provide chatIDs/accountIDs when known. Omitted 'query' returns results based on filters only. Partial matches enabled; 'excludeLowPriority' defaults to true.
|
|
245
245
|
- Workflow tip: To search messages in specific conversations: 1) Use find-chats to get chatIDs, 2) Use search-messages with those chatIDs.
|
|
246
246
|
- IMPORTANT: Chat names vary widely. ASK the user for clarification:
|
|
247
247
|
• "Which chat do you mean by family?" (could be "The Smiths", "Mom Dad Kids", etc.)
|
|
248
248
|
• "What's the name of your work chat?" (could be "Team", company name, project name)
|
|
249
|
-
• "Who are the participants?" (use
|
|
249
|
+
• "Who are the participants?" (use scope="participants" in search-chats)
|
|
250
250
|
Returns: matching messages and referenced chats.
|
|
251
251
|
- `send_message` (`write`) tags: [messages]: Send a text message to a specific chat. Supports replying to existing messages. Returns the sent message ID and a deeplink to the chat
|
|
252
|
-
|
|
253
|
-
### Resource `messages.attachments`:
|
|
254
|
-
|
|
255
|
-
- `download_attachment` (`write`) tags: [messages]: Download a message attachment and return the local file path.
|
package/code-tool.d.mts
CHANGED
package/code-tool.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;
|
|
1
|
+
{"version":3,"file":"code-tool.d.mts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
|
package/code-tool.d.ts
CHANGED
package/code-tool.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;
|
|
1
|
+
{"version":3,"file":"code-tool.d.ts","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"OAKO,EAAE,QAAQ,EAA0B;AAM3C;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,CA6HlD"}
|
package/code-tool.js
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
exports.codeTool = codeTool;
|
|
5
38
|
const node_path_1 = require("node:path");
|
|
6
39
|
const node_url_1 = require("node:url");
|
|
7
|
-
const deno_http_worker_1 = require("@valtown/deno-http-worker");
|
|
8
|
-
const code_tool_paths_cjs_1 = require("./code-tool-paths.cjs");
|
|
9
40
|
/**
|
|
10
41
|
* A tool that runs code against a copy of the SDK.
|
|
11
42
|
*
|
|
@@ -15,20 +46,23 @@ const code_tool_paths_cjs_1 = require("./code-tool-paths.cjs");
|
|
|
15
46
|
*
|
|
16
47
|
* @param endpoints - The endpoints to include in the list.
|
|
17
48
|
*/
|
|
18
|
-
function codeTool() {
|
|
49
|
+
async function codeTool() {
|
|
19
50
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
20
51
|
const tool = {
|
|
21
52
|
name: 'execute',
|
|
22
53
|
description: 'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
23
54
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
24
55
|
};
|
|
56
|
+
// Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
|
|
57
|
+
const { newDenoHTTPWorker } = await Promise.resolve().then(() => __importStar(require('@valtown/deno-http-worker')));
|
|
58
|
+
const { workerPath } = await Promise.resolve().then(() => __importStar(require('./code-tool-paths.cjs')));
|
|
25
59
|
const handler = async (client, args) => {
|
|
26
60
|
const baseURLHostname = new URL(client.baseURL).hostname;
|
|
27
61
|
const { code } = args;
|
|
28
|
-
const worker = await
|
|
62
|
+
const worker = await newDenoHTTPWorker((0, node_url_1.pathToFileURL)(workerPath), {
|
|
29
63
|
runFlags: [
|
|
30
64
|
`--node-modules-dir=manual`,
|
|
31
|
-
`--allow-read=code-tool-worker.mjs,${
|
|
65
|
+
`--allow-read=code-tool-worker.mjs,${workerPath.replace(/([\/\\]node_modules)[\/\\].+$/, '$1')}/`,
|
|
32
66
|
`--allow-net=${baseURLHostname}`,
|
|
33
67
|
// Allow environment variables because instantiating the client will try to read from them,
|
|
34
68
|
// even though they are not set.
|
|
@@ -36,7 +70,7 @@ function codeTool() {
|
|
|
36
70
|
],
|
|
37
71
|
printOutput: true,
|
|
38
72
|
spawnOptions: {
|
|
39
|
-
cwd: (0, node_path_1.dirname)(
|
|
73
|
+
cwd: (0, node_path_1.dirname)(workerPath),
|
|
40
74
|
},
|
|
41
75
|
});
|
|
42
76
|
try {
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBtF,4BA6HC;AA/ID,yCAAoC;AACpC,uCAAyC;AAQzC;;;;;;;;GAQG;AACI,KAAK,UAAU,QAAQ;IAC5B,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,EAC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AAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
package/code-tool.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
import { dirname } from 'node:path';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { newDenoHTTPWorker } from '@valtown/deno-http-worker';
|
|
5
|
-
import { workerPath } from './code-tool-paths.cjs';
|
|
6
4
|
/**
|
|
7
5
|
* A tool that runs code against a copy of the SDK.
|
|
8
6
|
*
|
|
@@ -12,13 +10,16 @@ import { workerPath } from './code-tool-paths.cjs';
|
|
|
12
10
|
*
|
|
13
11
|
* @param endpoints - The endpoints to include in the list.
|
|
14
12
|
*/
|
|
15
|
-
export function codeTool() {
|
|
13
|
+
export async function codeTool() {
|
|
16
14
|
const metadata = { resource: 'all', operation: 'write', tags: [] };
|
|
17
15
|
const tool = {
|
|
18
16
|
name: 'execute',
|
|
19
17
|
description: 'Runs Typescript code to interact with the API.\nYou are a skilled programmer writing code to interface with the service.\nDefine an async function named "run" that takes a single parameter of an initialized client, and it will be run.\nDo not initialize a client, but instead use the client that you are given as a parameter.\nYou will be returned anything that your function returns, plus the results of any console.log statements.\nIf any code triggers an error, the tool will return an error response, so you do not need to add error handling unless you want to output something more helpful than the raw error.\nIt is not necessary to add comments to code, unless by adding those comments you believe that you can generate better code.\nThis code will run in a container, and you will not be able to use fetch or otherwise interact with the network calls other than through the client you are given.\nAny variables you define won\'t live between successive uses of this call, so make sure to return or log any data you might need later.',
|
|
20
18
|
inputSchema: { type: 'object', properties: { code: { type: 'string' } } },
|
|
21
19
|
};
|
|
20
|
+
// Import dynamically to avoid failing at import time in cases where the environment is not well-supported.
|
|
21
|
+
const { newDenoHTTPWorker } = await import('@valtown/deno-http-worker');
|
|
22
|
+
const { workerPath } = await import('./code-tool-paths.cjs');
|
|
22
23
|
const handler = async (client, args) => {
|
|
23
24
|
const baseURLHostname = new URL(client.baseURL).hostname;
|
|
24
25
|
const { code } = args;
|
package/code-tool.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,EAAE,MAAM,WAAW;OAC5B,EAAE,aAAa,EAAE,MAAM,UAAU;
|
|
1
|
+
{"version":3,"file":"code-tool.mjs","sourceRoot":"","sources":["src/code-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,OAAO,EAAE,MAAM,WAAW;OAC5B,EAAE,aAAa,EAAE,MAAM,UAAU;AAQxC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ;IAC5B,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,EACT,khCAAkhC;QACphC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC1E,CAAC;IAEF,2GAA2G;IAC3G,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,MAAM,CAAC,2BAA2B,CAAC,CAAC;IACxE,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;IAE7D,MAAM,OAAO,GAAG,KAAK,EAAE,MAAqB,EAAE,IAAa,EAAE,EAAE;QAC7D,M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E,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAE,MAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;yBAC/E,CAAC;gBACN,MAAM,SAAS,GACb,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;oBACrB,IAAI;oBACN,CAAC,CAAC;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;qBAC1B,CAAC;gBACN,MAAM,SAAS,GACb,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC;oBACrB,IAAI;oBACN,CAAC,CAAC;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,iBAAiB,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;qBAC9C,CAAC;gBACN,OAAO;oBACL,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC;iBAChF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,MAAM,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAgB,CAAC;gBACvD,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,MAAM,CAAC,SAAS,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Metadata } from "./tools/types.mjs";
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
export declare const metadata: Metadata;
|
|
4
|
+
export declare const tool: Tool;
|
|
5
|
+
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
metadata: Metadata;
|
|
8
|
+
tool: {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
name: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
[x: string]: unknown;
|
|
13
|
+
type: "object";
|
|
14
|
+
properties?: {
|
|
15
|
+
[x: string]: unknown;
|
|
16
|
+
} | undefined;
|
|
17
|
+
required?: string[] | undefined;
|
|
18
|
+
};
|
|
19
|
+
title?: string | undefined;
|
|
20
|
+
description?: string | undefined;
|
|
21
|
+
outputSchema?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
type: "object";
|
|
24
|
+
properties?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
} | undefined;
|
|
27
|
+
required?: string[] | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
annotations?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
title?: string | undefined;
|
|
32
|
+
readOnlyHint?: boolean | undefined;
|
|
33
|
+
destructiveHint?: boolean | undefined;
|
|
34
|
+
idempotentHint?: boolean | undefined;
|
|
35
|
+
openWorldHint?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
};
|
|
41
|
+
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
//# sourceMappingURL=docs-search-tool.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.mts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAsBlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,oDAKlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAL+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAOnF,wBAA2C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Metadata } from "./tools/types.js";
|
|
2
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
export declare const metadata: Metadata;
|
|
4
|
+
export declare const tool: Tool;
|
|
5
|
+
export declare const handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
6
|
+
declare const _default: {
|
|
7
|
+
metadata: Metadata;
|
|
8
|
+
tool: {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
name: string;
|
|
11
|
+
inputSchema: {
|
|
12
|
+
[x: string]: unknown;
|
|
13
|
+
type: "object";
|
|
14
|
+
properties?: {
|
|
15
|
+
[x: string]: unknown;
|
|
16
|
+
} | undefined;
|
|
17
|
+
required?: string[] | undefined;
|
|
18
|
+
};
|
|
19
|
+
title?: string | undefined;
|
|
20
|
+
description?: string | undefined;
|
|
21
|
+
outputSchema?: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
type: "object";
|
|
24
|
+
properties?: {
|
|
25
|
+
[x: string]: unknown;
|
|
26
|
+
} | undefined;
|
|
27
|
+
required?: string[] | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
annotations?: {
|
|
30
|
+
[x: string]: unknown;
|
|
31
|
+
title?: string | undefined;
|
|
32
|
+
readOnlyHint?: boolean | undefined;
|
|
33
|
+
destructiveHint?: boolean | undefined;
|
|
34
|
+
idempotentHint?: boolean | undefined;
|
|
35
|
+
openWorldHint?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
_meta?: {
|
|
38
|
+
[x: string]: unknown;
|
|
39
|
+
} | undefined;
|
|
40
|
+
};
|
|
41
|
+
handler: (_: unknown, args: Record<string, unknown> | undefined) => Promise<import("./tools/types").ToolCallResult>;
|
|
42
|
+
};
|
|
43
|
+
export default _default;
|
|
44
|
+
//# sourceMappingURL=docs-search-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-search-tool.d.ts","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"OAEO,EAAE,QAAQ,EAAuB;OAEjC,EAAE,IAAI,EAAE,MAAM,oCAAoC;AAEzD,eAAO,MAAM,QAAQ,EAAE,QAKtB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,IAsBlB,CAAC;AAKF,eAAO,MAAM,OAAO,GAAU,GAAG,OAAO,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,oDAKlF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAL+B,OAAO,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;AAOnF,wBAA2C"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.handler = exports.tool = exports.metadata = void 0;
|
|
5
|
+
const types_1 = require("./tools/types.js");
|
|
6
|
+
exports.metadata = {
|
|
7
|
+
resource: 'all',
|
|
8
|
+
operation: 'read',
|
|
9
|
+
tags: [],
|
|
10
|
+
httpMethod: 'get',
|
|
11
|
+
};
|
|
12
|
+
exports.tool = {
|
|
13
|
+
name: 'search_docs',
|
|
14
|
+
description: 'Search for documentation for how to use the client to interact with the API.\nThe tool will return an array of Markdown-formatted documentation pages.',
|
|
15
|
+
inputSchema: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
query: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'The query to search for.',
|
|
21
|
+
},
|
|
22
|
+
language: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'The language for the SDK to search for.',
|
|
25
|
+
enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ['query', 'language'],
|
|
29
|
+
},
|
|
30
|
+
annotations: {
|
|
31
|
+
readOnlyHint: true,
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const docsSearchURL = process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/beeper-desktop-api/docs/search';
|
|
35
|
+
const handler = async (_, args) => {
|
|
36
|
+
const body = args;
|
|
37
|
+
const query = new URLSearchParams(body).toString();
|
|
38
|
+
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
39
|
+
return (0, types_1.asTextContentResult)(await result.json());
|
|
40
|
+
};
|
|
41
|
+
exports.handler = handler;
|
|
42
|
+
exports.default = { metadata: exports.metadata, tool: exports.tool, handler: exports.handler };
|
|
43
|
+
//# sourceMappingURL=docs-search-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-search-tool.js","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,4CAA8D;AAIjD,QAAA,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,wJAAwJ;IAC1J,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;gBACtD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;aACpF;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;KAChC;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,uEAAuE,CAAC;AAErG,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAyC,EAAE,EAAE;IACrF,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC,CAAC;IACxD,OAAO,IAAA,2BAAmB,EAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AALW,QAAA,OAAO,WAKlB;AAEF,kBAAe,EAAE,QAAQ,EAAR,gBAAQ,EAAE,IAAI,EAAJ,YAAI,EAAE,OAAO,EAAP,eAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { asTextContentResult } from "./tools/types.mjs";
|
|
3
|
+
export const metadata = {
|
|
4
|
+
resource: 'all',
|
|
5
|
+
operation: 'read',
|
|
6
|
+
tags: [],
|
|
7
|
+
httpMethod: 'get',
|
|
8
|
+
};
|
|
9
|
+
export const tool = {
|
|
10
|
+
name: 'search_docs',
|
|
11
|
+
description: 'Search for documentation for how to use the client to interact with the API.\nThe tool will return an array of Markdown-formatted documentation pages.',
|
|
12
|
+
inputSchema: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
query: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
description: 'The query to search for.',
|
|
18
|
+
},
|
|
19
|
+
language: {
|
|
20
|
+
type: 'string',
|
|
21
|
+
description: 'The language for the SDK to search for.',
|
|
22
|
+
enum: ['http', 'python', 'go', 'typescript', 'terraform', 'ruby', 'java', 'kotlin'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
required: ['query', 'language'],
|
|
26
|
+
},
|
|
27
|
+
annotations: {
|
|
28
|
+
readOnlyHint: true,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
const docsSearchURL = process.env['DOCS_SEARCH_URL'] || 'https://api.stainless.com/api/projects/beeper-desktop-api/docs/search';
|
|
32
|
+
export const handler = async (_, args) => {
|
|
33
|
+
const body = args;
|
|
34
|
+
const query = new URLSearchParams(body).toString();
|
|
35
|
+
const result = await fetch(`${docsSearchURL}?${query}`);
|
|
36
|
+
return asTextContentResult(await result.json());
|
|
37
|
+
};
|
|
38
|
+
export default { metadata, tool, handler };
|
|
39
|
+
//# sourceMappingURL=docs-search-tool.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-search-tool.mjs","sourceRoot":"","sources":["src/docs-search-tool.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAY,mBAAmB,EAAE;AAIxC,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,QAAQ,EAAE,KAAK;IACf,SAAS,EAAE,MAAM;IACjB,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAS;IACxB,IAAI,EAAE,aAAa;IACnB,WAAW,EACT,wJAAwJ;IAC1J,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,0BAA0B;aACxC;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,yCAAyC;gBACtD,IAAI,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC;aACpF;SACF;QACD,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC;KAChC;IACD,WAAW,EAAE;QACX,YAAY,EAAE,IAAI;KACnB;CACF,CAAC;AAEF,MAAM,aAAa,GACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,uEAAuE,CAAC;AAE5G,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,CAAU,EAAE,IAAyC,EAAE,EAAE;IACrF,MAAM,IAAI,GAAG,IAAW,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,aAAa,IAAI,KAAK,EAAE,CAAC,CAAC;IACxD,OAAO,mBAAmB,CAAC,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,CAAC,CAAC;AAEF,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
|
package/http.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { McpOptions } from "./options.mjs";
|
|
3
|
-
|
|
3
|
+
import { ClientOptions } from "./server.mjs";
|
|
4
|
+
export declare const streamableHTTPApp: ({ clientOptions, mcpOptions, }: {
|
|
5
|
+
clientOptions?: ClientOptions;
|
|
6
|
+
mcpOptions?: McpOptions;
|
|
7
|
+
}) => express.Express;
|
|
4
8
|
export declare const launchStreamableHTTPServer: (options: McpOptions, port: number | string | undefined) => Promise<void>;
|
|
5
9
|
//# sourceMappingURL=http.d.mts.map
|
package/http.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.mts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAMO,OAAO,MAAM,SAAS;OAEtB,EAAE,UAAU,EAAqB;
|
|
1
|
+
{"version":3,"file":"http.d.mts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAMO,OAAO,MAAM,SAAS;OAEtB,EAAE,UAAU,EAAqB;OACjC,EAAE,aAAa,EAA+B;AA4GrD,eAAO,MAAM,iBAAiB,GAAI,gCAG/B;IACD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,OAAO,CAAC,OAWX,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,SAAS,UAAU,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,kBAYtG,CAAC"}
|
package/http.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { McpOptions } from "./options.js";
|
|
3
|
-
|
|
3
|
+
import { ClientOptions } from "./server.js";
|
|
4
|
+
export declare const streamableHTTPApp: ({ clientOptions, mcpOptions, }: {
|
|
5
|
+
clientOptions?: ClientOptions;
|
|
6
|
+
mcpOptions?: McpOptions;
|
|
7
|
+
}) => express.Express;
|
|
4
8
|
export declare const launchStreamableHTTPServer: (options: McpOptions, port: number | string | undefined) => Promise<void>;
|
|
5
9
|
//# sourceMappingURL=http.d.ts.map
|
package/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAMO,OAAO,MAAM,SAAS;OAEtB,EAAE,UAAU,EAAqB;
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"OAMO,OAAO,MAAM,SAAS;OAEtB,EAAE,UAAU,EAAqB;OACjC,EAAE,aAAa,EAA+B;AA4GrD,eAAO,MAAM,iBAAiB,GAAI,gCAG/B;IACD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,KAAG,OAAO,CAAC,OAWX,CAAC;AAEF,eAAO,MAAM,0BAA0B,GAAU,SAAS,UAAU,EAAE,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,kBAYtG,CAAC"}
|
package/http.js
CHANGED
|
@@ -16,7 +16,7 @@ const oauthResourceIdentifier = (req) => {
|
|
|
16
16
|
const protocol = req.headers['x-forwarded-proto'] ?? req.protocol;
|
|
17
17
|
return `${protocol}://${req.get('host')}/`;
|
|
18
18
|
};
|
|
19
|
-
const newServer = (defaultMcpOptions, req, res) => {
|
|
19
|
+
const newServer = ({ clientOptions, mcpOptions: defaultMcpOptions, req, res, }) => {
|
|
20
20
|
const server = (0, server_1.newMcpServer)();
|
|
21
21
|
let mcpOptions;
|
|
22
22
|
try {
|
|
@@ -37,10 +37,8 @@ const newServer = (defaultMcpOptions, req, res) => {
|
|
|
37
37
|
(0, server_1.initMcpServer)({
|
|
38
38
|
server: server,
|
|
39
39
|
clientOptions: {
|
|
40
|
+
...clientOptions,
|
|
40
41
|
...authOptions,
|
|
41
|
-
defaultHeaders: {
|
|
42
|
-
'X-Stainless-MCP': 'true',
|
|
43
|
-
},
|
|
44
42
|
},
|
|
45
43
|
mcpOptions,
|
|
46
44
|
});
|
|
@@ -59,8 +57,8 @@ const newServer = (defaultMcpOptions, req, res) => {
|
|
|
59
57
|
}
|
|
60
58
|
return server;
|
|
61
59
|
};
|
|
62
|
-
const post = (
|
|
63
|
-
const server = newServer(
|
|
60
|
+
const post = (options) => async (req, res) => {
|
|
61
|
+
const server = newServer({ ...options, req, res });
|
|
64
62
|
// If we return null, we already set the authorization error.
|
|
65
63
|
if (server === null)
|
|
66
64
|
return;
|
|
@@ -98,19 +96,19 @@ const oauthMetadata = (req, res) => {
|
|
|
98
96
|
scopes_supported: 'read write',
|
|
99
97
|
});
|
|
100
98
|
};
|
|
101
|
-
const streamableHTTPApp = (
|
|
99
|
+
const streamableHTTPApp = ({ clientOptions = {}, mcpOptions = {}, }) => {
|
|
102
100
|
const app = (0, express_1.default)();
|
|
103
101
|
app.set('query parser', 'extended');
|
|
104
102
|
app.use(express_1.default.json());
|
|
105
103
|
app.get('/.well-known/oauth-protected-resource', (0, cors_1.default)(), oauthMetadata);
|
|
106
104
|
app.get('/', get);
|
|
107
|
-
app.post('/', post(
|
|
105
|
+
app.post('/', post({ clientOptions, mcpOptions }));
|
|
108
106
|
app.delete('/', del);
|
|
109
107
|
return app;
|
|
110
108
|
};
|
|
111
109
|
exports.streamableHTTPApp = streamableHTTPApp;
|
|
112
110
|
const launchStreamableHTTPServer = async (options, port) => {
|
|
113
|
-
const app = (0, exports.streamableHTTPApp)(options);
|
|
111
|
+
const app = (0, exports.streamableHTTPApp)({ mcpOptions: options });
|
|
114
112
|
const server = app.listen(port);
|
|
115
113
|
const address = server.address();
|
|
116
114
|
if (typeof address === 'string') {
|
package/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAGtF,0FAAmG;AAEnG,gDAAwB;AACxB,sDAA8B;AAC9B,gDAAoD;AACpD,0CAA0D;AAC1D,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;AAGtF,0FAAmG;AAEnG,gDAAwB;AACxB,sDAA8B;AAC9B,gDAAoD;AACpD,0CAA0D;AAC1D,wCAAsE;AACtE,0CAA6C;AAE7C,MAAM,uBAAuB,GAAG,CAAC,GAAoB,EAAU,EAAE;I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,CAAC,OAAO,EAAE,CAAC;IAEjC,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,4CAA4C,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;SAAM,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QAC5B,OAAO,CAAC,KAAK,CAAC,iDAAiD,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IACjF,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,KAAK,CAAC,iDAAiD,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,0BAA0B,8BAYrC"}
|
package/http.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const oauthResourceIdentifier = (req) => {
|
|
|
10
10
|
const protocol = req.headers['x-forwarded-proto'] ?? req.protocol;
|
|
11
11
|
return `${protocol}://${req.get('host')}/`;
|
|
12
12
|
};
|
|
13
|
-
const newServer = (defaultMcpOptions, req, res) => {
|
|
13
|
+
const newServer = ({ clientOptions, mcpOptions: defaultMcpOptions, req, res, }) => {
|
|
14
14
|
const server = newMcpServer();
|
|
15
15
|
let mcpOptions;
|
|
16
16
|
try {
|
|
@@ -31,10 +31,8 @@ const newServer = (defaultMcpOptions, req, res) => {
|
|
|
31
31
|
initMcpServer({
|
|
32
32
|
server: server,
|
|
33
33
|
clientOptions: {
|
|
34
|
+
...clientOptions,
|
|
34
35
|
...authOptions,
|
|
35
|
-
defaultHeaders: {
|
|
36
|
-
'X-Stainless-MCP': 'true',
|
|
37
|
-
},
|
|
38
36
|
},
|
|
39
37
|
mcpOptions,
|
|
40
38
|
});
|
|
@@ -53,8 +51,8 @@ const newServer = (defaultMcpOptions, req, res) => {
|
|
|
53
51
|
}
|
|
54
52
|
return server;
|
|
55
53
|
};
|
|
56
|
-
const post = (
|
|
57
|
-
const server = newServer(
|
|
54
|
+
const post = (options) => async (req, res) => {
|
|
55
|
+
const server = newServer({ ...options, req, res });
|
|
58
56
|
// If we return null, we already set the authorization error.
|
|
59
57
|
if (server === null)
|
|
60
58
|
return;
|
|
@@ -92,18 +90,18 @@ const oauthMetadata = (req, res) => {
|
|
|
92
90
|
scopes_supported: 'read write',
|
|
93
91
|
});
|
|
94
92
|
};
|
|
95
|
-
export const streamableHTTPApp = (
|
|
93
|
+
export const streamableHTTPApp = ({ clientOptions = {}, mcpOptions = {}, }) => {
|
|
96
94
|
const app = express();
|
|
97
95
|
app.set('query parser', 'extended');
|
|
98
96
|
app.use(express.json());
|
|
99
97
|
app.get('/.well-known/oauth-protected-resource', cors(), oauthMetadata);
|
|
100
98
|
app.get('/', get);
|
|
101
|
-
app.post('/', post(
|
|
99
|
+
app.post('/', post({ clientOptions, mcpOptions }));
|
|
102
100
|
app.delete('/', del);
|
|
103
101
|
return app;
|
|
104
102
|
};
|
|
105
103
|
export const launchStreamableHTTPServer = async (options, port) => {
|
|
106
|
-
const app = streamableHTTPApp(options);
|
|
104
|
+
const app = streamableHTTPApp({ mcpOptions: options });
|
|
107
105
|
const server = app.listen(port);
|
|
108
106
|
const address = server.address();
|
|
109
107
|
if (typeof address === 'string') {
|
package/http.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.mjs","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,6BAA6B,EAAE,MAAM,oDAAoD;OAE3F,IAAI,MAAM,MAAM;OAChB,OAAO,MAAM,SAAS;OACtB,EAAE,SAAS,EAAE,MAAM,yBAAyB;OAC5C,EAAc,iBAAiB,EAAE;OACjC,
|
|
1
|
+
{"version":3,"file":"http.mjs","sourceRoot":"","sources":["src/http.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,6BAA6B,EAAE,MAAM,oDAAoD;OAE3F,IAAI,MAAM,MAAM;OAChB,OAAO,MAAM,SAAS;OACtB,EAAE,SAAS,EAAE,MAAM,yBAAyB;OAC5C,EAAc,iBAAiB,E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