@b3os/mcp 0.1.0 → 0.2.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/README.md +129 -43
- package/bin/b3os-mcp.js +14 -3
- package/dist/compact.d.ts +27 -0
- package/dist/compact.js +138 -0
- package/dist/compact.js.map +1 -0
- package/dist/handlers/_common.d.ts +150 -0
- package/dist/handlers/_common.js +329 -0
- package/dist/handlers/_common.js.map +1 -0
- package/dist/handlers/actions.d.ts +19 -0
- package/dist/handlers/actions.js +110 -0
- package/dist/handlers/actions.js.map +1 -0
- package/dist/handlers/render.d.ts +7 -0
- package/dist/handlers/render.js +72 -0
- package/dist/handlers/render.js.map +1 -0
- package/dist/handlers/routines.d.ts +20 -0
- package/dist/handlers/routines.js +128 -0
- package/dist/handlers/routines.js.map +1 -0
- package/dist/handlers/sandboxes.d.ts +2 -0
- package/dist/handlers/sandboxes.js +100 -0
- package/dist/handlers/sandboxes.js.map +1 -0
- package/dist/handlers/vision.d.ts +7 -0
- package/dist/handlers/vision.js +186 -0
- package/dist/handlers/vision.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/main.js +88 -7
- package/dist/main.js.map +1 -1
- package/dist/server.d.ts +68 -1
- package/dist/server.js +175 -18
- package/dist/server.js.map +1 -1
- package/dist/stdio.d.ts +24 -1
- package/dist/stdio.js +89 -12
- package/dist/stdio.js.map +1 -1
- package/dist/table-types.d.ts +84 -0
- package/dist/table-types.js +4 -0
- package/dist/table-types.js.map +1 -0
- package/dist/table.d.ts +54 -0
- package/dist/table.gen.d.ts +7 -0
- package/dist/table.gen.js +3754 -0
- package/dist/table.gen.js.map +1 -0
- package/dist/table.js +240 -0
- package/dist/table.js.map +1 -0
- package/dist/tools.d.ts +61 -47
- package/dist/tools.js +231 -705
- package/dist/tools.js.map +1 -1
- package/package.json +16 -6
- package/src/compact.ts +127 -0
- package/src/handlers/_common.ts +433 -0
- package/src/handlers/actions.ts +144 -0
- package/src/handlers/render.ts +90 -0
- package/src/handlers/routines.ts +152 -0
- package/src/handlers/sandboxes.ts +110 -0
- package/src/handlers/vision.ts +213 -0
- package/src/index.ts +36 -0
- package/src/main.ts +79 -7
- package/src/server.ts +225 -19
- package/src/stdio.ts +107 -10
- package/src/table-types.ts +88 -0
- package/src/table.gen.ts +3812 -0
- package/src/table.ts +304 -0
- package/src/tools.ts +310 -785
- package/table/core.mjs +73 -0
- package/table/requests.json +1151 -0
- package/table/table.json +3763 -0
- package/table/tools/actions.mjs +55 -0
- package/table/tools/infer.mjs +52 -0
- package/table/tools/platform.mjs +76 -0
- package/table/tools/render.mjs +126 -0
- package/table/tools/routines.mjs +70 -0
- package/table/tools/sandboxes.mjs +269 -0
- package/table/tools/vision.mjs +316 -0
- package/table/tools.mjs +92 -0
package/table/core.mjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// The parts of the MCP tool table that belong to no single product (platform-dx, plan 1.2 and 3.1): the server
|
|
2
|
+
// instructions, the core group and the order the product modules compose in. table/tools.mjs composes the table from
|
|
3
|
+
// this file and tools/<product>.mjs.
|
|
4
|
+
|
|
5
|
+
/** The server-level instruction both servers send (initialize and server/discover). */
|
|
6
|
+
export const INSTRUCTIONS = [
|
|
7
|
+
"B3OS tools run on a B3OS node, next to a served model: web pages, browsers, sandboxes, screenshots, routines and",
|
|
8
|
+
"marketplace actions. Prefer vision_scrape over a built-in web fetch whenever you read a web page: it returns the",
|
|
9
|
+
"page's main content as Markdown, uses a real browser when the page needs JavaScript, can answer from a recent",
|
|
10
|
+
"cached copy. Use vision_map to list a site's URLs, vision_crawl to read many pages of one",
|
|
11
|
+
"site, and vision_act to click, type or sign in on a page. Run code, shell commands, package installs and file",
|
|
12
|
+
"processing in a sandbox rather than on the user's machine: sandbox_create starts an isolated microVM that stops",
|
|
13
|
+
"by itself after timeout_s; then use sandbox_exec, sandbox_write_file and sandbox_read_file on its id, and",
|
|
14
|
+
"sandbox_delete when you are done. render_screenshot captures a page as an image. To use a third-party service",
|
|
15
|
+
"(GitHub, Slack, Linear, Notion and others) call actions_search, then actions_describe for the input schema, then",
|
|
16
|
+
"actions_call; credentials come from the user's stored connections, never from tool arguments. Tools that start",
|
|
17
|
+
"long jobs (vision_crawl, render_video, routine_run) wait up to wait_s seconds, then return the job id: call the",
|
|
18
|
+
"same tool with job_id to keep waiting. Calls count against the API key's organization limits.",
|
|
19
|
+
].join(" ");
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The core group in tools/list order. Core tools are always listed (ARCHITECTURE §5.5 caps the group at 15); every
|
|
23
|
+
* other tool is in an opt-in toolset. A tool with `group: "core"` must be named here, and every name here must be a
|
|
24
|
+
* core tool in some tools/<product>.mjs.
|
|
25
|
+
*/
|
|
26
|
+
export const CORE = [
|
|
27
|
+
"vision_scrape",
|
|
28
|
+
"vision_map",
|
|
29
|
+
"vision_crawl",
|
|
30
|
+
"vision_act",
|
|
31
|
+
"render_screenshot",
|
|
32
|
+
"render_video",
|
|
33
|
+
"sandbox_create",
|
|
34
|
+
"sandbox_exec",
|
|
35
|
+
"sandbox_read_file",
|
|
36
|
+
"sandbox_write_file",
|
|
37
|
+
"sandbox_delete",
|
|
38
|
+
"routine_run",
|
|
39
|
+
"actions_search",
|
|
40
|
+
"actions_describe",
|
|
41
|
+
"actions_call",
|
|
42
|
+
];
|
|
43
|
+
|
|
44
|
+
/** The most tools the core group may hold (ARCHITECTURE §5.5); table/tools.mjs refuses a longer CORE. */
|
|
45
|
+
export const CORE_BUDGET = 15;
|
|
46
|
+
|
|
47
|
+
/** Product modules (tools/<product>.mjs) in the order their opt-in tools follow the core group. */
|
|
48
|
+
export const PRODUCTS = ["sandboxes", "vision", "routines", "infer", "platform", "render", "actions"];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Claude Code's per-tool `_meta` (PD6, its MCP docs): it saves a text result over 50,000 characters to a file
|
|
52
|
+
* unless the tool sets `anthropic/maxResultSizeChars`. These tools return up to MAX_TEXT (100,000, src/handlers/
|
|
53
|
+
* _common.ts) characters of text by default, plus clip()'s truncation note (under 100 characters), so the key is
|
|
54
|
+
* the cap plus that note: a default scrape, a crawl's pages and a file read come back inline. gen-table puts the
|
|
55
|
+
* entries into each tool's `_meta`; the table test pins them to MAX_TEXT and to each tool's max_chars default.
|
|
56
|
+
*/
|
|
57
|
+
export const RESULT_SIZE_CHARS = {
|
|
58
|
+
vision_scrape: 100_100,
|
|
59
|
+
vision_crawl: 100_100,
|
|
60
|
+
sandbox_read_file: 100_100,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/** Longest server instructions and tool description Claude Code reads in full (its MCP docs: 4,096 characters). */
|
|
64
|
+
export const MAX_DESCRIPTION_CHARS = 4096;
|
|
65
|
+
|
|
66
|
+
/** The `wait_s` argument of every tool that waits on a job (shared so the bound stays one value). */
|
|
67
|
+
export const WAIT_S = {
|
|
68
|
+
type: "integer",
|
|
69
|
+
minimum: 0,
|
|
70
|
+
maximum: 60,
|
|
71
|
+
default: 50,
|
|
72
|
+
description: "Seconds to wait for the job before returning its id and status (then call again with job_id).",
|
|
73
|
+
};
|