@scribed/cli 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +24 -0
- package/README.md +603 -2
- package/bin/scribed.mjs +4 -0
- package/dist/index.js +100614 -0
- package/dist/mcp/server.js +91610 -0
- package/package.json +45 -4
- package/types/mcp.d.ts +163 -0
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scribed/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Command-line client + MCP server for Scribed — CRM records, phone + texting, inbox, calendar + booking, transcriptions, HR, Vault, automations, Creative Studio, and Documents, derived from the scribed-agent tool catalog.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"homepage": "https://scribed.ai",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"scribed",
|
|
10
|
+
"mcp",
|
|
11
|
+
"cli",
|
|
12
|
+
"crm",
|
|
13
|
+
"agent"
|
|
14
|
+
],
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"registry": "https://registry.npmjs.org"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
},
|
|
22
|
+
"bin": {
|
|
23
|
+
"scribed": "bin/scribed.mjs"
|
|
24
|
+
},
|
|
25
|
+
"exports": {
|
|
26
|
+
"./mcp": {
|
|
27
|
+
"types": "./types/mcp.d.ts",
|
|
28
|
+
"bun": "./dist/mcp/server.js",
|
|
29
|
+
"default": "./dist/mcp/server.js"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin",
|
|
34
|
+
"dist",
|
|
35
|
+
"types"
|
|
36
|
+
],
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/q6th/scribed-web.git",
|
|
40
|
+
"directory": "scribed-cli"
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "d4ccf0b5a26adb950280324ff4624e34d7cffb43",
|
|
43
|
+
"scribedRelease": {
|
|
44
|
+
"repository": "q6th/scribed-web",
|
|
45
|
+
"commit": "d4ccf0b5a26adb950280324ff4624e34d7cffb43"
|
|
46
|
+
}
|
|
47
|
+
}
|
package/types/mcp.d.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Public surface of `@scribed/cli/mcp` — the catalog adapter + MCP server
|
|
6
|
+
* factory the hosted scribed-api `/mcp` and `/v1/tools` routes build on.
|
|
7
|
+
* Hand-maintained to match `src/mcp/server.ts`.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface PublicToolCatalogItem {
|
|
11
|
+
name: string;
|
|
12
|
+
category: string;
|
|
13
|
+
description: string;
|
|
14
|
+
access: 'Standard' | 'AI-powered' | 'Storage/processing' | 'Connected account';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface CatalogToolDefinition {
|
|
18
|
+
description: string;
|
|
19
|
+
inputSchema: z.ZodType;
|
|
20
|
+
execute: (
|
|
21
|
+
args: unknown,
|
|
22
|
+
options: { toolCallId: string; messages: never[] }
|
|
23
|
+
) => unknown;
|
|
24
|
+
httpMethod?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
binaryUpload?: BinaryUploadDescriptor;
|
|
27
|
+
/** Complete image results are rendered as native MCP image content. */
|
|
28
|
+
outputKind?: 'image';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface BinaryUploadDescriptor {
|
|
32
|
+
argumentName: string;
|
|
33
|
+
maxBytes: number;
|
|
34
|
+
inlineMaxBytes?: number;
|
|
35
|
+
allowEmpty?: boolean;
|
|
36
|
+
directUpload?: { provider: 'vercel-blob'; startTool: string; completeTool: string; cancelTool: string };
|
|
37
|
+
}
|
|
38
|
+
export interface ToolUpload { stream: ReadableStream<Uint8Array>; size: number; name: string; mimeType: string; maxBytes: number; contentSha256?: string }
|
|
39
|
+
|
|
40
|
+
export interface ToolExecutionReceipt {
|
|
41
|
+
state: 'running' | 'completed' | 'failed' | 'unknown' | 'retryable';
|
|
42
|
+
requestId: string;
|
|
43
|
+
startedAt: string;
|
|
44
|
+
completedAt: string | null;
|
|
45
|
+
duplicateSuppressed: boolean;
|
|
46
|
+
resultAvailable: false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface CatalogToolError {
|
|
50
|
+
error: true;
|
|
51
|
+
message: string;
|
|
52
|
+
code?: string;
|
|
53
|
+
status?: number | null;
|
|
54
|
+
retryAfterSeconds?: number;
|
|
55
|
+
receipt?: ToolExecutionReceipt;
|
|
56
|
+
requestId?: string;
|
|
57
|
+
idempotencyKey?: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CatalogToolInvocation {
|
|
61
|
+
id: string;
|
|
62
|
+
name: string;
|
|
63
|
+
feature: string;
|
|
64
|
+
classification: 'paid' | 'usage_only' | 'overhead' | 'byok';
|
|
65
|
+
owner: 'agent' | 'app-worker' | 'downstream-worker' | 'user-provider';
|
|
66
|
+
providerCost: 'platform' | 'zero_byok' | 'none';
|
|
67
|
+
platformInfrastructure: true;
|
|
68
|
+
outcome: 'completed' | 'failed' | 'cancelled';
|
|
69
|
+
durationMs: number;
|
|
70
|
+
status?: number;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface CatalogCallContext {
|
|
74
|
+
apiUrl: string;
|
|
75
|
+
/** Better Auth bearer session token or hosted-MCP OAuth access token. */
|
|
76
|
+
token?: string;
|
|
77
|
+
/** Personal API key (`scribed_api_…`): executes through POST /v1/tools/:name. */
|
|
78
|
+
apiKey?: string;
|
|
79
|
+
/** Selected workspace: X-Workspace-Id (bearer / API key) or ?workspace= (hosted MCP). */
|
|
80
|
+
workspaceId?: string;
|
|
81
|
+
/** Browser-OAuth CLI sessions execute through the hosted MCP resource. */
|
|
82
|
+
remoteMcpUrl?: string;
|
|
83
|
+
/** Hosted Scribed API only; never accepted from CLI flags or environment. */
|
|
84
|
+
mcpSigningKey?: string;
|
|
85
|
+
uploads?: ReadonlyMap<string, ToolUpload>;
|
|
86
|
+
signal?: AbortSignal;
|
|
87
|
+
uploadApiUrl?: string;
|
|
88
|
+
idempotencyKey?: string;
|
|
89
|
+
billing?: {
|
|
90
|
+
consumerApp: 'scribed';
|
|
91
|
+
userId: string;
|
|
92
|
+
tenantId: string;
|
|
93
|
+
traceId: string;
|
|
94
|
+
feature: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface CatalogExecutionResult {
|
|
99
|
+
result: unknown;
|
|
100
|
+
toolInvocations: CatalogToolInvocation[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface McpServerOptions {
|
|
104
|
+
apiUrl: string;
|
|
105
|
+
token?: string;
|
|
106
|
+
/** "core" (default), "all", or comma-separated category slugs. */
|
|
107
|
+
categories?: string;
|
|
108
|
+
/** Hosted Scribed API only; signs catalog-derived loopback requests. */
|
|
109
|
+
internalSigningKey?: string;
|
|
110
|
+
/** Hosted Scribed API only; omit state-changing tools. */
|
|
111
|
+
readOnly?: boolean;
|
|
112
|
+
/** Local API-key discovery: exact tool names allowed by the deployment. */
|
|
113
|
+
allowedTools?: readonly string[];
|
|
114
|
+
/** Pin every tool call to one workspace. */
|
|
115
|
+
workspaceId?: string;
|
|
116
|
+
/** Local stdio only; resolves/refreshes its execution credentials per call. */
|
|
117
|
+
contextProvider?: () => Promise<CatalogCallContext>;
|
|
118
|
+
/** Hosted API only: wraps validated calls in its durable execution receipt. */
|
|
119
|
+
executeTool?: (name: string, args: unknown, context: CatalogCallContext, extra: McpToolCallExtra) => Promise<unknown>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface McpToolCallExtra {
|
|
123
|
+
signal: AbortSignal;
|
|
124
|
+
_meta?: Record<string, unknown>;
|
|
125
|
+
requestId?: string | number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export declare const SERVER_INSTRUCTIONS: string;
|
|
129
|
+
|
|
130
|
+
export declare function createMcpServer(options: McpServerOptions): McpServer;
|
|
131
|
+
|
|
132
|
+
export declare function resolveCategorySelection(
|
|
133
|
+
selection?: string
|
|
134
|
+
): ReadonlySet<string>;
|
|
135
|
+
|
|
136
|
+
export declare function catalogItems(): PublicToolCatalogItem[];
|
|
137
|
+
export declare function catalogRegistry(): Record<string, CatalogToolDefinition>;
|
|
138
|
+
export declare function catalogCategories(): string[];
|
|
139
|
+
export declare function catalogCounts(): {
|
|
140
|
+
total: number;
|
|
141
|
+
eligible: number;
|
|
142
|
+
excluded: number;
|
|
143
|
+
};
|
|
144
|
+
export declare function toolArgsJsonSchema(name: string): Record<string, unknown>;
|
|
145
|
+
export declare function mcpToolDescription(name: string): string;
|
|
146
|
+
export declare function isCatalogToolError(value: unknown): value is CatalogToolError;
|
|
147
|
+
export declare function executeCatalogTool(
|
|
148
|
+
name: string,
|
|
149
|
+
args: unknown,
|
|
150
|
+
context: CatalogCallContext
|
|
151
|
+
): Promise<unknown>;
|
|
152
|
+
export declare function executeCatalogToolWithTrace(
|
|
153
|
+
name: string,
|
|
154
|
+
args: unknown,
|
|
155
|
+
context: CatalogCallContext
|
|
156
|
+
): Promise<CatalogExecutionResult>;
|
|
157
|
+
export declare function shapeMcpToolResult(name: string, value: unknown): unknown;
|
|
158
|
+
|
|
159
|
+
export declare function runMcpServer(
|
|
160
|
+
apiUrlFlag?: string,
|
|
161
|
+
categories?: string,
|
|
162
|
+
workspaceIdFlag?: string
|
|
163
|
+
): Promise<void>;
|