@scribed/cli 0.0.0-stage → 0.1.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/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@scribed/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
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
+ },
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "bin": {
22
+ "scribed": "bin/scribed.mjs"
23
+ },
24
+ "exports": {
25
+ "./mcp": {
26
+ "types": "./types/mcp.d.ts",
27
+ "bun": "./src/mcp/server.ts",
28
+ "default": "./dist/mcp/server.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "bin",
33
+ "dist",
34
+ "types"
35
+ ],
36
+ "scripts": {
37
+ "test": "bun test",
38
+ "type-check": "NODE_OPTIONS=--max-old-space-size=12288 tsc --noEmit",
39
+ "build": "bun build src/index.ts src/mcp/server.ts --target=node --outdir=dist --root=src",
40
+ "verify:stdio": "bun run build && bun scripts/verify-stdio.ts",
41
+ "verify:bundle": "bun run build && bun scripts/verify-bundle.ts",
42
+ "verify:files": "bun run build && bun scripts/verify-files.ts",
43
+ "verify:catalog": "bun scripts/verify-catalog.ts",
44
+ "smoke": "bun scripts/smoke-tools.ts",
45
+ "smoke:companions": "bun scripts/smoke-companions.ts",
46
+ "prepack": "bun run type-check && bun run test && bun run build && bun scripts/verify-bundle.ts && bun scripts/verify-stdio.ts && bun scripts/verify-files.ts"
47
+ },
48
+ "dependencies": {
49
+ "@modelcontextprotocol/sdk": "^1.29.0",
50
+ "@vercel/blob": "^2.5.0",
51
+ "commander": "^15.0.0",
52
+ "zod": "4.4.3"
53
+ },
54
+ "devDependencies": {
55
+ "@types/bun": "^1.3.14",
56
+ "@types/node": "^26.0.1",
57
+ "typescript": "^6.0.3"
58
+ }
59
+ }
package/types/mcp.d.ts ADDED
@@ -0,0 +1,140 @@
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 }
39
+
40
+ export interface CatalogToolError {
41
+ error: true;
42
+ message: string;
43
+ code?: string;
44
+ status?: number | null;
45
+ retryAfterSeconds?: number;
46
+ }
47
+
48
+ export interface CatalogToolInvocation {
49
+ id: string;
50
+ name: string;
51
+ feature: string;
52
+ classification: 'paid' | 'usage_only' | 'overhead' | 'byok';
53
+ owner: 'agent' | 'app-worker' | 'downstream-worker' | 'user-provider';
54
+ providerCost: 'platform' | 'zero_byok' | 'none';
55
+ platformInfrastructure: true;
56
+ outcome: 'completed' | 'failed' | 'cancelled';
57
+ durationMs: number;
58
+ status?: number;
59
+ }
60
+
61
+ export interface CatalogCallContext {
62
+ apiUrl: string;
63
+ /** Better Auth bearer session token or hosted-MCP OAuth access token. */
64
+ token?: string;
65
+ /** Personal API key (`scribed_api_…`): executes through POST /v1/tools/:name. */
66
+ apiKey?: string;
67
+ /** Selected workspace: X-Workspace-Id (bearer / API key) or ?workspace= (hosted MCP). */
68
+ workspaceId?: string;
69
+ /** Browser-OAuth CLI sessions execute through the hosted MCP resource. */
70
+ remoteMcpUrl?: string;
71
+ /** Hosted Scribed API only; never accepted from CLI flags or environment. */
72
+ mcpSigningKey?: string;
73
+ uploads?: ReadonlyMap<string, ToolUpload>;
74
+ signal?: AbortSignal;
75
+ uploadApiUrl?: string;
76
+ billing?: {
77
+ consumerApp: 'scribed';
78
+ userId: string;
79
+ tenantId: string;
80
+ traceId: string;
81
+ feature: string;
82
+ };
83
+ }
84
+
85
+ export interface CatalogExecutionResult {
86
+ result: unknown;
87
+ toolInvocations: CatalogToolInvocation[];
88
+ }
89
+
90
+ export interface McpServerOptions {
91
+ apiUrl: string;
92
+ token?: string;
93
+ /** "core" (default), "all", or comma-separated category slugs. */
94
+ categories?: string;
95
+ /** Hosted Scribed API only; signs catalog-derived loopback requests. */
96
+ internalSigningKey?: string;
97
+ /** Hosted Scribed API only; omit state-changing tools. */
98
+ readOnly?: boolean;
99
+ /** Pin every tool call to one workspace. */
100
+ workspaceId?: string;
101
+ /** Local stdio only; resolves/refreshes its execution credentials per call. */
102
+ contextProvider?: () => Promise<CatalogCallContext>;
103
+ }
104
+
105
+ export declare const SERVER_INSTRUCTIONS: string;
106
+
107
+ export declare function createMcpServer(options: McpServerOptions): McpServer;
108
+
109
+ export declare function resolveCategorySelection(
110
+ selection?: string
111
+ ): ReadonlySet<string>;
112
+
113
+ export declare function catalogItems(): PublicToolCatalogItem[];
114
+ export declare function catalogRegistry(): Record<string, CatalogToolDefinition>;
115
+ export declare function catalogCategories(): string[];
116
+ export declare function catalogCounts(): {
117
+ total: number;
118
+ eligible: number;
119
+ excluded: number;
120
+ };
121
+ export declare function toolArgsJsonSchema(name: string): Record<string, unknown>;
122
+ export declare function mcpToolDescription(name: string): string;
123
+ export declare function isCatalogToolError(value: unknown): value is CatalogToolError;
124
+ export declare function executeCatalogTool(
125
+ name: string,
126
+ args: unknown,
127
+ context: CatalogCallContext
128
+ ): Promise<unknown>;
129
+ export declare function executeCatalogToolWithTrace(
130
+ name: string,
131
+ args: unknown,
132
+ context: CatalogCallContext
133
+ ): Promise<CatalogExecutionResult>;
134
+ export declare function shapeMcpToolResult(name: string, value: unknown): unknown;
135
+
136
+ export declare function runMcpServer(
137
+ apiUrlFlag?: string,
138
+ categories?: string,
139
+ workspaceIdFlag?: string
140
+ ): Promise<void>;