@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/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAE1G,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAwC,MAAM,aAAa,CAAC;AAY9E,iHAAiH;AACjH,SAAS,SAAS,CAAC,CAAU;IAC3B,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,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AAG,OAAO,CAAC,CAAC,CAAC;IACvC,IAAI,CAAC,IAAI,CAAC,MAAM;QAAE,MAAM,CAAC,KAAK,EAAE,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface JsonSchemaObject {
|
|
2
|
+
type: "object";
|
|
3
|
+
properties: Record<string, unknown>;
|
|
4
|
+
required?: string[];
|
|
5
|
+
additionalProperties?: boolean;
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ToolAnnotations {
|
|
9
|
+
title?: string;
|
|
10
|
+
readOnlyHint?: boolean;
|
|
11
|
+
destructiveHint?: boolean;
|
|
12
|
+
idempotentHint?: boolean;
|
|
13
|
+
openWorldHint?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/** An API operation a tool calls. */
|
|
16
|
+
export interface McpTableOperation {
|
|
17
|
+
method: string;
|
|
18
|
+
path: string;
|
|
19
|
+
pathParams: readonly string[];
|
|
20
|
+
scope: string;
|
|
21
|
+
servedBy: string;
|
|
22
|
+
/** Takes `Idempotency-Key` (routes.json `idempotent_key`). */
|
|
23
|
+
idempotent: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** A query parameter of the tool's operation: an argument of the same name, or filled from a tool argument. */
|
|
26
|
+
export interface McpTableQueryParam {
|
|
27
|
+
name: string;
|
|
28
|
+
/** Filled from this tool argument instead (`wait` from `wait_s`). */
|
|
29
|
+
from?: string;
|
|
30
|
+
/** The argument is a boolean sent as `1` / `0` (the API's integer flag). */
|
|
31
|
+
encode?: "01";
|
|
32
|
+
}
|
|
33
|
+
/** An operation the tool calls after the main one when an argument is present (`job_id` continues a job). */
|
|
34
|
+
export interface McpTableContinuation {
|
|
35
|
+
arg: string;
|
|
36
|
+
operationId: string;
|
|
37
|
+
method: string;
|
|
38
|
+
path: string;
|
|
39
|
+
pathParam: string;
|
|
40
|
+
/** A paginated companion read after the job (a crawl's pages). */
|
|
41
|
+
pages?: {
|
|
42
|
+
operationId: string;
|
|
43
|
+
method: string;
|
|
44
|
+
path: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface McpTableTool {
|
|
48
|
+
name: string;
|
|
49
|
+
/** `core` tools are always listed; other groups are opt-in toolsets. */
|
|
50
|
+
group: string;
|
|
51
|
+
title: string;
|
|
52
|
+
description: string;
|
|
53
|
+
annotations: ToolAnnotations;
|
|
54
|
+
inputSchema: JsonSchemaObject;
|
|
55
|
+
/** The operation the tool calls (operationId in packages/spec/dist/openapi.json). */
|
|
56
|
+
operationId: string;
|
|
57
|
+
method: string;
|
|
58
|
+
path: string;
|
|
59
|
+
/** `x-b3os-scope`: the edge lists a tool only to credentials that hold it. */
|
|
60
|
+
scope: string;
|
|
61
|
+
servedBy: string;
|
|
62
|
+
/**
|
|
63
|
+
* `preview`: the operation is `x-b3os-stage: preview` (common.yaml). The tool is listed only to an organization
|
|
64
|
+
* with `flag` on (selectTools); absent for every other stage.
|
|
65
|
+
*/
|
|
66
|
+
stage?: "preview";
|
|
67
|
+
/** The operation's `x-b3os-flag`, set with `stage: "preview"`. */
|
|
68
|
+
flag?: string;
|
|
69
|
+
/** Path parameters, each an argument of the same name. */
|
|
70
|
+
pathParams: readonly string[];
|
|
71
|
+
queryParams: readonly McpTableQueryParam[];
|
|
72
|
+
/** `json`: `bodyFields` arguments become the JSON body; `raw`: `content` (+ `encoding`) is the binary body. */
|
|
73
|
+
body: "none" | "json" | "raw";
|
|
74
|
+
bodyFields: readonly string[];
|
|
75
|
+
rawFields: readonly string[];
|
|
76
|
+
/** Arguments the tool consumes itself; never sent to the API. */
|
|
77
|
+
toolArgs: readonly string[];
|
|
78
|
+
/** Sent when the caller leaves them out. */
|
|
79
|
+
bodyDefaults: Readonly<Record<string, unknown>>;
|
|
80
|
+
queryDefaults: Readonly<Record<string, unknown>>;
|
|
81
|
+
continueWith?: McpTableContinuation;
|
|
82
|
+
/** Client-specific keys for tools/list `_meta` (Claude Code's `anthropic/maxResultSizeChars`, PD6). */
|
|
83
|
+
meta?: Readonly<Record<string, unknown>>;
|
|
84
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-types.js","sourceRoot":"","sources":["../src/table-types.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,qFAAqF"}
|
package/dist/table.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Obj, type Runner, type ToolContext, type ToolIO, type ToolResult } from "./handlers/_common.ts";
|
|
2
|
+
import { type RoutineTool } from "./handlers/routines.ts";
|
|
3
|
+
import { MCP_INSTRUCTIONS, MCP_OPERATIONS, MCP_TOOLS } from "./table.gen.ts";
|
|
4
|
+
import type { McpTableTool } from "./table-types.ts";
|
|
5
|
+
export type { ContentBlock, JobLike, ToolContext, ToolIO, ToolRequest, ToolResult } from "./handlers/_common.ts";
|
|
6
|
+
export { buildRequest, errorResult, fromBase64, MAX_TEXT, requestFor, ToolCallError, toBase64, toolError, } from "./handlers/_common.ts";
|
|
7
|
+
export { type PackTool, packToolFromDescription, runPackTool } from "./handlers/actions.ts";
|
|
8
|
+
export { type RoutineTool, routineToolFromDefinition } from "./handlers/routines.ts";
|
|
9
|
+
export type * from "./table-types.ts";
|
|
10
|
+
export { MCP_INSTRUCTIONS, MCP_OPERATIONS, MCP_TOOLS };
|
|
11
|
+
/**
|
|
12
|
+
* The tools a server lists from `tools`: the core set plus the named opt-in toolsets (`all`: every group), in table
|
|
13
|
+
* order. A tool of a preview operation (`stage: "preview"`, W3-0b-8) is left out unless its flag is in `flags`, the
|
|
14
|
+
* flags that are on for the caller's organization: the default tools/list never shows one, `all` included.
|
|
15
|
+
*/
|
|
16
|
+
export declare function selectTools<T extends Pick<McpTableTool, "group" | "stage" | "flag">>(tools: readonly T[], toolsets?: readonly string[], flags?: readonly string[]): T[];
|
|
17
|
+
/** The tools a server lists: the core set plus the named opt-in toolsets, in table order (selectTools). */
|
|
18
|
+
export declare function toolsFor(toolsets?: readonly string[], flags?: readonly string[]): McpTableTool[];
|
|
19
|
+
/** The flags that gate a preview tool of the table; a server needs the caller's flags only when this is non-empty. */
|
|
20
|
+
export declare function previewFlags(tools?: readonly Pick<McpTableTool, "stage" | "flag">[]): string[];
|
|
21
|
+
/** The toolset names the table defines (`core` first). */
|
|
22
|
+
export declare function toolsets(): string[];
|
|
23
|
+
export declare function findTool(name: string): McpTableTool | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Checks the arguments' top level against the tool's input schema: no unknown arguments, required ones present,
|
|
26
|
+
* primitive types and enums right. Deeper checks are the API's (its 400 comes back as a readable tool error).
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkArgs(tool: McpTableTool, args: Obj): void;
|
|
29
|
+
/** Runs one table tool: checks its arguments, makes its requests through `io`, and formats the answer. */
|
|
30
|
+
export declare function runTool(tool: McpTableTool | string, args: Obj, io: ToolIO, ctx?: ToolContext): Promise<ToolResult>;
|
|
31
|
+
/**
|
|
32
|
+
* The handler modules' RUNNERS merged, refusing a tool name two modules both handle (review L1, W3-0b-3): a plain
|
|
33
|
+
* spread let the later module take over the other product's handler without touching that product's file.
|
|
34
|
+
*/
|
|
35
|
+
export declare function mergeRunners(modules: Readonly<Record<string, Readonly<Record<string, Runner>>>>): Record<string, Runner>;
|
|
36
|
+
export interface HttpIOOptions {
|
|
37
|
+
/** Sends a request (the edge passes its sub-request dispatcher). */
|
|
38
|
+
fetch: (req: Request) => Promise<Response>;
|
|
39
|
+
/** `https://beta-api.b3os.org`, a node URL, or a test server. */
|
|
40
|
+
baseUrl: string;
|
|
41
|
+
/** Sent on every API request: `authorization`, `traceparent`. */
|
|
42
|
+
headers?: Record<string, string>;
|
|
43
|
+
/** Fetches artifact URLs (another host); defaults to the global fetch. */
|
|
44
|
+
fetchArtifact?: (url: string, init: {
|
|
45
|
+
signal?: AbortSignal;
|
|
46
|
+
}) => Promise<Response>;
|
|
47
|
+
/** A fresh Idempotency-Key for operations that take one; defaults to crypto.randomUUID(). */
|
|
48
|
+
idempotencyKey?: () => string;
|
|
49
|
+
}
|
|
50
|
+
/** The parsed `data` of each event in a finished `text/event-stream` body (comments and non-JSON data skipped). */
|
|
51
|
+
export declare function sseEvents(body: string): unknown[];
|
|
52
|
+
export declare function httpIO(opts: HttpIOOptions): ToolIO;
|
|
53
|
+
/** Runs a routine tool: the arguments are the run's input; the result is routine_run's. */
|
|
54
|
+
export declare function runRoutineTool(t: RoutineTool, args: Obj, io: ToolIO, ctx?: ToolContext): Promise<ToolResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { McpTableOperation, McpTableTool } from "./table-types.ts";
|
|
2
|
+
/** The server-level instruction both MCP servers send. */
|
|
3
|
+
export declare const MCP_INSTRUCTIONS: string;
|
|
4
|
+
/** Every tool, core first, in a fixed order (a deterministic tools/list keeps prompt caches warm). */
|
|
5
|
+
export declare const MCP_TOOLS: readonly McpTableTool[];
|
|
6
|
+
/** Every operation the tools call, by operationId. */
|
|
7
|
+
export declare const MCP_OPERATIONS: Readonly<Record<string, McpTableOperation>>;
|