@intentrax/sdk 1.7.0 → 1.8.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 +17 -2
- package/cli/intentrax.mjs +45 -1
- package/mcp/README.md +138 -0
- package/mcp/canonical.d.ts +12 -0
- package/mcp/canonical.mjs +70 -0
- package/mcp/cli.d.ts +16 -0
- package/mcp/cli.mjs +214 -0
- package/mcp/client.d.ts +131 -0
- package/mcp/client.mjs +955 -0
- package/mcp/commands.d.ts +113 -0
- package/mcp/commands.mjs +575 -0
- package/mcp/index.d.ts +12 -0
- package/mcp/index.mjs +12 -0
- package/mcp/proxy.d.ts +47 -0
- package/mcp/proxy.mjs +434 -0
- package/mcp/receipt-meta.d.ts +59 -0
- package/mcp/receipt-meta.mjs +178 -0
- package/mcp/tool-manifest.d.ts +74 -0
- package/mcp/tool-manifest.mjs +154 -0
- package/package.json +16 -1
- package/readback/README.md +352 -0
- package/readback/bridge.mjs +71 -0
- package/readback/cli.mjs +150 -0
- package/readback/confirm.mjs +404 -0
- package/readback/index.mjs +12 -0
- package/readback/recipe-worker.mjs +33 -0
- package/readback/recipes/_shared.mjs +126 -0
- package/readback/recipes/email-delivery.mjs +136 -0
- package/readback/recipes/github-issue.mjs +88 -0
- package/readback/recipes/http-json.mjs +109 -0
- package/readback/recipes/sql-row.mjs +96 -0
- package/readback/recipes/stripe-refund.mjs +73 -0
- package/readback/redact.mjs +68 -0
- package/scan/README.md +211 -0
- package/scan/classify.mjs +276 -0
- package/scan/cli.mjs +102 -0
- package/scan/configs.mjs +261 -0
- package/scan/credentials.mjs +121 -0
- package/scan/extract.mjs +323 -0
- package/scan/gates.mjs +94 -0
- package/scan/report.mjs +58 -0
- package/scan/scan.mjs +571 -0
- package/scan/text.mjs +186 -0
package/mcp/client.d.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Types for client.mjs: the minimal, dependency-free MCP client used by
|
|
2
|
+
// `intentrax mcp pin|check|proxy`.
|
|
3
|
+
|
|
4
|
+
import type { McpToolDefinition } from "./tool-manifest.js";
|
|
5
|
+
|
|
6
|
+
export const MODERN_PROTOCOL_VERSION: "2026-07-28";
|
|
7
|
+
export const LEGACY_PROTOCOL_VERSIONS: readonly ["2025-11-25", "2025-06-18", "2025-03-26"];
|
|
8
|
+
export const SUPPORTED_PROTOCOL_VERSIONS: readonly ["2026-07-28", "2025-11-25", "2025-06-18", "2025-03-26"];
|
|
9
|
+
export type ProtocolVersion = (typeof SUPPORTED_PROTOCOL_VERSIONS)[number];
|
|
10
|
+
export const DEFAULT_TIMEOUT_MS: number;
|
|
11
|
+
export const DEFAULT_DISCOVER_TIMEOUT_MS: number;
|
|
12
|
+
export const DEFAULT_MAX_PAGES: number;
|
|
13
|
+
export const MAX_MESSAGE_BYTES: number;
|
|
14
|
+
export const CLIENT_INFO: Readonly<{ name: string; version: string }>;
|
|
15
|
+
export const META_PROTOCOL_VERSION: "io.modelcontextprotocol/protocolVersion";
|
|
16
|
+
export const META_CLIENT_CAPABILITIES: "io.modelcontextprotocol/clientCapabilities";
|
|
17
|
+
export const META_CLIENT_INFO: "io.modelcontextprotocol/clientInfo";
|
|
18
|
+
export const META_SERVER_INFO: "io.modelcontextprotocol/serverInfo";
|
|
19
|
+
|
|
20
|
+
export type McpClientErrorCode =
|
|
21
|
+
| "invalid_spec"
|
|
22
|
+
| "env_missing"
|
|
23
|
+
| "spawn_failed"
|
|
24
|
+
| "transport_closed"
|
|
25
|
+
| "unreachable"
|
|
26
|
+
| "timeout"
|
|
27
|
+
| "http_status"
|
|
28
|
+
| "protocol"
|
|
29
|
+
| "pagination"
|
|
30
|
+
| "rpc_error"
|
|
31
|
+
| "unsupported_version";
|
|
32
|
+
|
|
33
|
+
/** Messages never contain expanded ${ENV} values, URL queries, user-info or header values. */
|
|
34
|
+
export class McpClientError extends Error {
|
|
35
|
+
constructor(code: McpClientErrorCode, message: string, details?: unknown);
|
|
36
|
+
readonly code: McpClientErrorCode;
|
|
37
|
+
readonly details?: { status?: number; rpc?: { code?: number; message?: string } };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** UNEXPANDED server spec. `${NAME}` placeholders are expanded from the environment only when connecting. */
|
|
41
|
+
export type StdioServerSpec = { transport: "stdio"; command: string[]; env?: Record<string, string>; cwd?: string };
|
|
42
|
+
export type HttpServerSpec = { transport: "streamable-http"; url: string; headers?: Record<string, string> };
|
|
43
|
+
export type ServerSpec = StdioServerSpec | HttpServerSpec;
|
|
44
|
+
/** A URL, a command line, an argv array, or a spec object. */
|
|
45
|
+
export type ServerInput = string | string[] | ServerSpec | { url: string; headers?: Record<string, string> } | { command: string | string[]; env?: Record<string, string>; cwd?: string };
|
|
46
|
+
|
|
47
|
+
export interface ClientOptions {
|
|
48
|
+
env?: Record<string, string | undefined>;
|
|
49
|
+
timeoutMs?: number;
|
|
50
|
+
discoverTimeoutMs?: number;
|
|
51
|
+
protocolVersions?: readonly ProtocolVersion[];
|
|
52
|
+
clientInfo?: { name: string; version: string };
|
|
53
|
+
/** Diagnostics (never contain credentials). The CLI points this at stderr. */
|
|
54
|
+
log?: (line: string) => void;
|
|
55
|
+
/** Allow plain http:// to a non-loopback host. Default false. */
|
|
56
|
+
allowInsecureHttp?: boolean;
|
|
57
|
+
/** stdio server stderr: "ignore" (default), "inherit", or a sink. */
|
|
58
|
+
stderr?: "ignore" | "inherit" | ((chunk: Buffer) => void);
|
|
59
|
+
fetchImpl?: typeof fetch;
|
|
60
|
+
maxPages?: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function splitCommandLine(line: string): string[];
|
|
64
|
+
export function parseServerSpec(input: ServerInput): ServerSpec;
|
|
65
|
+
export function expandEnv(text: string, env?: Record<string, string | undefined>): string;
|
|
66
|
+
/** Log-safe description of an UNEXPANDED spec (query, user-info and secret-looking arguments redacted). */
|
|
67
|
+
export function describeServer(input: ServerInput): string;
|
|
68
|
+
/** Credentials that would be WRITTEN to a pin file (names only), plus warnings. */
|
|
69
|
+
export function findStoredSecrets(input: ServerInput): { problems: string[]; warnings: string[] };
|
|
70
|
+
export function createLineSplitter(onLine: (line: string) => void, options?: { maxBytes?: number; onOverflow?: () => void }): (chunk: string | Buffer) => void;
|
|
71
|
+
|
|
72
|
+
export interface Transport {
|
|
73
|
+
readonly kind: "stdio" | "streamable-http";
|
|
74
|
+
start(): Promise<void>;
|
|
75
|
+
send(message: unknown): Promise<void>;
|
|
76
|
+
close(): Promise<void>;
|
|
77
|
+
onmessage: ((message: unknown) => void) | null;
|
|
78
|
+
onclose: ((info: { code: number | null; signal: string | null; error?: string }) => void) | null;
|
|
79
|
+
onnoise: ((kind: string) => void) | null;
|
|
80
|
+
openNotificationStream?(): Promise<boolean>;
|
|
81
|
+
}
|
|
82
|
+
export class StdioTransport implements Transport {
|
|
83
|
+
constructor(spec: StdioServerSpec, options?: ClientOptions);
|
|
84
|
+
readonly kind: "stdio";
|
|
85
|
+
start(): Promise<void>;
|
|
86
|
+
send(message: unknown): Promise<void>;
|
|
87
|
+
close(): Promise<void>;
|
|
88
|
+
onmessage: ((message: unknown) => void) | null;
|
|
89
|
+
onclose: ((info: { code: number | null; signal: string | null; error?: string }) => void) | null;
|
|
90
|
+
onnoise: ((kind: string) => void) | null;
|
|
91
|
+
}
|
|
92
|
+
export class HttpTransport implements Transport {
|
|
93
|
+
constructor(spec: HttpServerSpec, options?: ClientOptions);
|
|
94
|
+
readonly kind: "streamable-http";
|
|
95
|
+
readonly sessionId: string | null;
|
|
96
|
+
readonly negotiatedVersion: string | null;
|
|
97
|
+
start(): Promise<void>;
|
|
98
|
+
send(message: unknown): Promise<void>;
|
|
99
|
+
close(): Promise<void>;
|
|
100
|
+
openNotificationStream(): Promise<boolean>;
|
|
101
|
+
onmessage: ((message: unknown) => void) | null;
|
|
102
|
+
onclose: ((info: { code: number | null; signal: string | null; error?: string }) => void) | null;
|
|
103
|
+
onnoise: ((kind: string) => void) | null;
|
|
104
|
+
}
|
|
105
|
+
export function openTransport(input: ServerInput, options?: ClientOptions): Promise<Transport>;
|
|
106
|
+
|
|
107
|
+
export class McpClient {
|
|
108
|
+
constructor(transport: Transport, options?: ClientOptions & { meta?: Record<string, unknown> });
|
|
109
|
+
era: "modern" | "legacy" | null;
|
|
110
|
+
protocolVersion: ProtocolVersion | null;
|
|
111
|
+
serverInfo: { name?: string; version?: string; [key: string]: unknown } | null;
|
|
112
|
+
serverCapabilities: Record<string, unknown> | null;
|
|
113
|
+
request(method: string, params?: Record<string, unknown>, options?: { timeoutMs?: number; modern?: boolean }): Promise<any>;
|
|
114
|
+
notify(method: string, params?: Record<string, unknown>): Promise<void>;
|
|
115
|
+
onNotification(handler: (message: { method: string; params?: unknown }) => void): () => void;
|
|
116
|
+
close(): Promise<void>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** 2026-07-28 `server/discover`, falling back to legacy `initialize`. */
|
|
120
|
+
export function connect(server: ServerInput, options?: ClientOptions): Promise<McpClient>;
|
|
121
|
+
/** Follows every nextCursor; a partial, looping or malformed list throws. */
|
|
122
|
+
export function listAllTools(client: Pick<McpClient, "request">, options?: { maxPages?: number; timeoutMs?: number }): Promise<{ tools: McpToolDefinition[]; pages: number }>;
|
|
123
|
+
|
|
124
|
+
export interface ListedTools {
|
|
125
|
+
tools: McpToolDefinition[];
|
|
126
|
+
pages: number;
|
|
127
|
+
era: "modern" | "legacy";
|
|
128
|
+
protocolVersion: ProtocolVersion;
|
|
129
|
+
serverInfo: { name?: string; version?: string; [key: string]: unknown } | null;
|
|
130
|
+
}
|
|
131
|
+
export function listServerTools(server: ServerInput, options?: ClientOptions): Promise<ListedTools>;
|