@atlassian/mcp-compressor 0.0.2

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/dist/config.js ADDED
@@ -0,0 +1,102 @@
1
+ import { InvalidConfigurationError } from "./errors.js";
2
+ /**
3
+ * Interpolate environment variables in a single string using ${VAR_NAME} or $VAR_NAME syntax.
4
+ * If a referenced variable is not set, the placeholder is left as-is (matching Python behaviour).
5
+ */
6
+ export function interpolateString(value) {
7
+ if (!value.includes("$")) {
8
+ return value;
9
+ }
10
+ return value.replace(/\$\{([^}]+)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g, (match, braced, bare) => {
11
+ const varName = braced ?? bare ?? "";
12
+ const envValue = process.env[varName];
13
+ return envValue !== undefined ? envValue : match;
14
+ });
15
+ }
16
+ export function interpolateRecord(record) {
17
+ if (!record)
18
+ return record;
19
+ const result = {};
20
+ for (const [key, value] of Object.entries(record)) {
21
+ result[key] = interpolateString(value);
22
+ }
23
+ return result;
24
+ }
25
+ /**
26
+ * Interpolate environment variables in all string values of an MCP config object or JSON string.
27
+ *
28
+ * Accepts either a parsed `MCPConfigShape` object or a raw JSON string and returns an interpolated
29
+ * copy with `${VAR_NAME}` and `$VAR_NAME` placeholders replaced by their environment variable
30
+ * values. Unset variables are left as-is.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const config = interpolateMCPConfig({
35
+ * mcpServers: {
36
+ * myServer: { url: "https://example.com", headers: { Authorization: "Bearer $MY_TOKEN" } },
37
+ * },
38
+ * });
39
+ * ```
40
+ */
41
+ export function interpolateMCPConfig(config) {
42
+ const parsed = typeof config === "string" ? JSON.parse(config) : config;
43
+ const interpolated = { mcpServers: {} };
44
+ for (const [name, entry] of Object.entries(parsed.mcpServers ?? {})) {
45
+ interpolated.mcpServers[name] = {
46
+ ...entry,
47
+ ...(entry.url !== undefined ? { url: interpolateString(String(entry.url)) } : {}),
48
+ ...(entry.args ? { args: entry.args.map(interpolateString) } : {}),
49
+ ...(entry.env ? { env: interpolateRecord(entry.env) } : {}),
50
+ ...(entry.headers ? { headers: interpolateRecord(entry.headers) } : {}),
51
+ };
52
+ }
53
+ return interpolated;
54
+ }
55
+ /**
56
+ * Parse an MCP config JSON string containing one or more servers.
57
+ *
58
+ * Returns an array of `{ backend, serverName }` entries — one per server in `mcpServers` — or
59
+ * `null` if the input is not a JSON object string. Throws {@link InvalidConfigurationError} for
60
+ * malformed JSON or an empty `mcpServers` map.
61
+ */
62
+ export function parseServerConfigJson(input) {
63
+ const trimmed = input.trim();
64
+ if (!trimmed.startsWith("{")) {
65
+ return null;
66
+ }
67
+ let parsed;
68
+ try {
69
+ parsed = JSON.parse(trimmed);
70
+ }
71
+ catch (error) {
72
+ throw new InvalidConfigurationError(`Invalid MCP config JSON: ${error.message}`);
73
+ }
74
+ const names = Object.keys(parsed.mcpServers ?? {});
75
+ if (names.length === 0) {
76
+ throw new InvalidConfigurationError("MCP config JSON must contain at least one server in mcpServers.");
77
+ }
78
+ return names.map((serverName) => ({
79
+ backend: normalizeConfigServer(parsed.mcpServers[serverName]),
80
+ serverName,
81
+ }));
82
+ }
83
+ export function normalizeConfigServer(entry) {
84
+ const interpolated = interpolateMCPConfig({ mcpServers: { _: entry } }).mcpServers["_"];
85
+ if (interpolated.command) {
86
+ return {
87
+ type: "stdio",
88
+ command: interpolated.command,
89
+ args: interpolated.args,
90
+ cwd: interpolated.cwd,
91
+ env: interpolated.env,
92
+ };
93
+ }
94
+ if (!interpolated.url) {
95
+ throw new InvalidConfigurationError("Server config must contain either command or url.");
96
+ }
97
+ return {
98
+ type: interpolated.transport === "sse" ? "sse" : "http",
99
+ url: interpolated.url.toString(),
100
+ headers: interpolated.headers,
101
+ };
102
+ }
@@ -0,0 +1,6 @@
1
+ export declare class ToolNotFoundError extends Error {
2
+ constructor(toolName: string, availableTools: string[]);
3
+ }
4
+ export declare class InvalidConfigurationError extends Error {
5
+ constructor(message: string);
6
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,12 @@
1
+ export class ToolNotFoundError extends Error {
2
+ constructor(toolName, availableTools) {
3
+ super(`Tool not found: ${toolName}. Available tools: ${availableTools.sort().join(", ")}`);
4
+ this.name = "ToolNotFoundError";
5
+ }
6
+ }
7
+ export class InvalidConfigurationError extends Error {
8
+ constructor(message) {
9
+ super(message);
10
+ this.name = "InvalidConfigurationError";
11
+ }
12
+ }
@@ -0,0 +1,3 @@
1
+ import { type ToolSpec } from "./rust_core.js";
2
+ import type { CompressionLevel } from "./types.js";
3
+ export declare function formatToolDescription(tool: ToolSpec, compressionLevel: CompressionLevel): string;
@@ -0,0 +1,4 @@
1
+ import { compressToolListing } from "./rust_core.js";
2
+ export function formatToolDescription(tool, compressionLevel) {
3
+ return compressToolListing(compressionLevel, [tool]);
4
+ }
@@ -0,0 +1,8 @@
1
+ export { VERSION } from "./version.js";
2
+ export * from "./errors.js";
3
+ export * from "./rust_core.js";
4
+ export * from "./just_bash_host.js";
5
+ export * from "./adapters.js";
6
+ export { interpolateString, interpolateRecord, interpolateMCPConfig, parseServerConfigJson, normalizeConfigServer, } from "./config.js";
7
+ export type { BackendConfig, HttpBackendConfig, JsonConfigServerEntry, MCPConfigShape, SseBackendConfig, StdioBackendConfig, } from "./types.js";
8
+ export { type GeneratedClientKind, type GeneratedCodeClient, type JustBashCommand, type JustBashProvider, type CompressorClientOptions, type NativeCompressorMode as CompressorMode, type NativeServersInput as ServersInput, CompressorClient, CompressorProxy, type NormalizedBackendConfig, type ProxyResponse, type ProxyTool, normalizeServers, } from "./native_client.js";
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { VERSION } from "./version.js";
2
+ export * from "./errors.js";
3
+ export * from "./rust_core.js";
4
+ export * from "./just_bash_host.js";
5
+ export * from "./adapters.js";
6
+ export { interpolateString, interpolateRecord, interpolateMCPConfig, parseServerConfigJson, normalizeConfigServer, } from "./config.js";
7
+ export { CompressorClient, CompressorProxy, normalizeServers, } from "./native_client.js";
@@ -0,0 +1,11 @@
1
+ import type { Command } from "just-bash";
2
+ import type { CompressorProxy } from "./native_client.js";
3
+ export interface JustBashCommandRegistration {
4
+ providerName: string;
5
+ commandName: string;
6
+ backendToolName: string;
7
+ helpToolName: string;
8
+ command: Command;
9
+ }
10
+ export declare function installJustBashCommands(bash: unknown, proxy: CompressorProxy): JustBashCommandRegistration[];
11
+ export declare function createJustBashCommands(proxy: CompressorProxy): JustBashCommandRegistration[];
@@ -0,0 +1,63 @@
1
+ import { defineCommand } from "just-bash";
2
+ import { parseToolArgv } from "./rust_core.js";
3
+ function commandToToolSpec(command) {
4
+ return {
5
+ name: command.backendToolName,
6
+ description: command.description,
7
+ inputSchema: command.inputSchema,
8
+ };
9
+ }
10
+ function output(text) {
11
+ return { stdout: text, stderr: "", exitCode: 0 };
12
+ }
13
+ function failure(error) {
14
+ const message = error instanceof Error ? error.message : String(error);
15
+ return { stdout: "", stderr: `${message}\n`, exitCode: 1 };
16
+ }
17
+ export function installJustBashCommands(bash, proxy) {
18
+ const registrations = createJustBashCommands(proxy);
19
+ const host = bash;
20
+ if (typeof host.registerCommand === "function") {
21
+ for (const registration of registrations) {
22
+ host.registerCommand(registration.command);
23
+ }
24
+ }
25
+ else {
26
+ host.customCommands = [
27
+ ...(host.customCommands ?? []),
28
+ ...registrations.map((item) => item.command),
29
+ ];
30
+ }
31
+ return registrations;
32
+ }
33
+ export function createJustBashCommands(proxy) {
34
+ const rawNames = proxy.justBashProviders.flatMap((provider) => provider.tools.map((tool) => tool.commandName));
35
+ const duplicateNames = new Set(rawNames.filter((name, index) => rawNames.indexOf(name) !== index));
36
+ const registrations = [];
37
+ for (const provider of proxy.justBashProviders) {
38
+ for (const tool of provider.tools) {
39
+ const spec = commandToToolSpec(tool);
40
+ const registeredCommandName = duplicateNames.has(tool.commandName)
41
+ ? `${provider.providerName}_${tool.commandName}`
42
+ : tool.commandName;
43
+ registrations.push({
44
+ providerName: provider.providerName,
45
+ commandName: registeredCommandName,
46
+ backendToolName: tool.backendToolName,
47
+ helpToolName: provider.helpToolName,
48
+ command: defineCommand(registeredCommandName, async (args) => {
49
+ try {
50
+ const toolInput = parseToolArgv(spec, args);
51
+ return output(await proxy.invoke(tool.backendToolName, toolInput, {
52
+ server: provider.providerName,
53
+ }));
54
+ }
55
+ catch (error) {
56
+ return failure(error);
57
+ }
58
+ }),
59
+ });
60
+ }
61
+ }
62
+ return registrations;
63
+ }
@@ -0,0 +1,75 @@
1
+ /**
2
+ * AST-level pipe/redirection detection for just-bash custom commands.
3
+ *
4
+ * Registers a ``TransformPlugin`` that walks the parsed AST and injects
5
+ * ``MCP_TOONIFY=true|false`` env-var prefixes onto each invocation of one
6
+ * of our wrapper commands, based on whether its stdout is piped
7
+ * (``cmd | jq``) or redirected (``cmd > out.json``). The wrapper command
8
+ * in ``bash_commands.ts`` reads ``ctx.env.MCP_TOONIFY`` to choose between
9
+ * TOON and raw JSON output. User-supplied ``MCP_TOONIFY=...`` prefixes
10
+ * are preserved.
11
+ */
12
+ import type { Bash } from "just-bash";
13
+ /** Env var injected into wrapper invocations: "true" -> TOON, "false" -> JSON. */
14
+ export declare const MCP_TOONIFY_ENV_VAR = "MCP_TOONIFY";
15
+ interface WordPart {
16
+ type: string;
17
+ value?: string;
18
+ }
19
+ interface WordNode {
20
+ type: "Word";
21
+ parts: WordPart[];
22
+ }
23
+ interface AssignmentNode {
24
+ type: "Assignment";
25
+ name: string;
26
+ value: WordNode | null;
27
+ append: boolean;
28
+ array: WordNode[] | null;
29
+ }
30
+ interface RedirectionNode {
31
+ type: "Redirection";
32
+ fd: number | null;
33
+ fdVariable?: string;
34
+ operator: string;
35
+ target: unknown;
36
+ }
37
+ interface SimpleCommandNode {
38
+ type: "SimpleCommand";
39
+ assignments: AssignmentNode[];
40
+ name: WordNode | null;
41
+ args: WordNode[];
42
+ redirections: RedirectionNode[];
43
+ line?: number;
44
+ }
45
+ interface PipelineNode {
46
+ type: "Pipeline";
47
+ commands: AnyCommandNode[];
48
+ }
49
+ interface StatementNode {
50
+ type: "Statement";
51
+ pipelines: PipelineNode[];
52
+ }
53
+ interface ScriptNode {
54
+ type: "Script";
55
+ statements: StatementNode[];
56
+ }
57
+ type AnyCommandNode = SimpleCommandNode | Record<string, unknown>;
58
+ interface TransformInput {
59
+ ast: ScriptNode;
60
+ metadata: Record<string, unknown>;
61
+ }
62
+ interface TransformOutput {
63
+ ast: ScriptNode;
64
+ metadata?: Record<string, unknown>;
65
+ }
66
+ interface TransformPlugin {
67
+ transform(input: TransformInput): TransformOutput;
68
+ }
69
+ /** Build a ``TransformPlugin`` that injects ``MCP_TOONIFY`` prefixes (in-place AST mutation). */
70
+ export declare function createPipingHintPlugin(customCommandNames: readonly string[]): TransformPlugin;
71
+ /** Read ``MCP_TOONIFY`` from *env*, returning *defaultValue* if absent/invalid. */
72
+ export declare function resolveToonifyFromEnv(env: Map<string, string> | Record<string, string> | undefined, defaultValue: boolean): boolean;
73
+ /** Register :func:`createPipingHintPlugin` on *bash*. */
74
+ export declare function installPipingHintPlugin(bash: Bash, customCommandNames: readonly string[]): void;
75
+ export {};
@@ -0,0 +1,167 @@
1
+ /**
2
+ * AST-level pipe/redirection detection for just-bash custom commands.
3
+ *
4
+ * Registers a ``TransformPlugin`` that walks the parsed AST and injects
5
+ * ``MCP_TOONIFY=true|false`` env-var prefixes onto each invocation of one
6
+ * of our wrapper commands, based on whether its stdout is piped
7
+ * (``cmd | jq``) or redirected (``cmd > out.json``). The wrapper command
8
+ * in ``bash_commands.ts`` reads ``ctx.env.MCP_TOONIFY`` to choose between
9
+ * TOON and raw JSON output. User-supplied ``MCP_TOONIFY=...`` prefixes
10
+ * are preserved.
11
+ */
12
+ /** Env var injected into wrapper invocations: "true" -> TOON, "false" -> JSON. */
13
+ export const MCP_TOONIFY_ENV_VAR = "MCP_TOONIFY";
14
+ /** Redirection operators that move stdout off the caller's pipe. */
15
+ const OUTPUT_REDIR_OPERATORS = new Set([">", ">>", ">|", "&>", "&>>", "<>"]);
16
+ // --- helpers ----------------------------------------------------------------
17
+ function isLiteralPart(part) {
18
+ return part.type === "Literal" && typeof part.value === "string";
19
+ }
20
+ /** Return *cmd*'s literal name, or ``null`` for dynamic invocations. */
21
+ function simpleCommandName(cmd) {
22
+ if (cmd.name === null) {
23
+ return null;
24
+ }
25
+ const pieces = [];
26
+ for (const part of cmd.name.parts) {
27
+ if (!isLiteralPart(part)) {
28
+ return null;
29
+ }
30
+ pieces.push(part.value);
31
+ }
32
+ const joined = pieces.join("");
33
+ return joined.length > 0 ? joined : null;
34
+ }
35
+ /** Return ``true`` if *cmd* redirects fd 1 (stdout) somewhere else. */
36
+ function hasStdoutRedirection(cmd) {
37
+ for (const redir of cmd.redirections ?? []) {
38
+ if (!OUTPUT_REDIR_OPERATORS.has(redir.operator)) {
39
+ continue;
40
+ }
41
+ // fd defaults to 1 for >/>>/>|; &>/&>> always cover stdout.
42
+ if (redir.fd === null ||
43
+ redir.fd === 1 ||
44
+ redir.operator === "&>" ||
45
+ redir.operator === "&>>") {
46
+ return true;
47
+ }
48
+ }
49
+ return false;
50
+ }
51
+ function makeAssignment(name, value) {
52
+ return {
53
+ type: "Assignment",
54
+ name,
55
+ value: { type: "Word", parts: [{ type: "Literal", value }] },
56
+ append: false,
57
+ array: null,
58
+ };
59
+ }
60
+ function isSimpleCommand(node) {
61
+ return (typeof node === "object" &&
62
+ node !== null &&
63
+ node.type === "SimpleCommand");
64
+ }
65
+ function injectToonify(cmd, toonify) {
66
+ // Preserve user-set MCP_TOONIFY assignments.
67
+ for (const assignment of cmd.assignments ?? []) {
68
+ if (assignment.name === MCP_TOONIFY_ENV_VAR) {
69
+ return;
70
+ }
71
+ }
72
+ cmd.assignments = [
73
+ makeAssignment(MCP_TOONIFY_ENV_VAR, toonify ? "true" : "false"),
74
+ ...(cmd.assignments ?? []),
75
+ ];
76
+ }
77
+ function transformPipeline(pipeline, names) {
78
+ const n = pipeline.commands.length;
79
+ pipeline.commands.forEach((cmd, index) => {
80
+ if (isSimpleCommand(cmd)) {
81
+ const name = simpleCommandName(cmd);
82
+ if (name !== null && names.has(name)) {
83
+ const isLast = index === n - 1;
84
+ const isPiped = !isLast || hasStdoutRedirection(cmd);
85
+ injectToonify(cmd, !isPiped);
86
+ }
87
+ }
88
+ else {
89
+ transformCompound(cmd, names);
90
+ }
91
+ });
92
+ }
93
+ function transformStatements(statements, names) {
94
+ for (const stmt of statements) {
95
+ for (const pipeline of stmt.pipelines) {
96
+ transformPipeline(pipeline, names);
97
+ }
98
+ }
99
+ }
100
+ /** Recurse into compound nodes (``if``/``for``/``while``/subshell/etc.) by shape. */
101
+ function transformCompound(node, names) {
102
+ for (const value of Object.values(node)) {
103
+ if (Array.isArray(value)) {
104
+ for (const item of value) {
105
+ if (item && typeof item === "object") {
106
+ const t = item.type;
107
+ if (t === "Statement") {
108
+ transformStatements(value, names);
109
+ break;
110
+ }
111
+ if ("body" in item ||
112
+ "condition" in item ||
113
+ "patterns" in item ||
114
+ "clauses" in item ||
115
+ "elseBody" in item) {
116
+ transformCompound(item, names);
117
+ }
118
+ }
119
+ }
120
+ }
121
+ else if (value && typeof value === "object") {
122
+ transformCompound(value, names);
123
+ }
124
+ }
125
+ }
126
+ // --- public plugin factory --------------------------------------------------
127
+ /** Build a ``TransformPlugin`` that injects ``MCP_TOONIFY`` prefixes (in-place AST mutation). */
128
+ export function createPipingHintPlugin(customCommandNames) {
129
+ const names = new Set(customCommandNames);
130
+ return {
131
+ transform({ ast, metadata }) {
132
+ if (names.size === 0) {
133
+ return { ast, metadata };
134
+ }
135
+ transformStatements(ast.statements, names);
136
+ return { ast, metadata };
137
+ },
138
+ };
139
+ }
140
+ /** Read ``MCP_TOONIFY`` from *env*, returning *defaultValue* if absent/invalid. */
141
+ export function resolveToonifyFromEnv(env, defaultValue) {
142
+ if (!env) {
143
+ return defaultValue;
144
+ }
145
+ let raw;
146
+ if (env instanceof Map) {
147
+ raw = env.get(MCP_TOONIFY_ENV_VAR);
148
+ }
149
+ else {
150
+ raw = env[MCP_TOONIFY_ENV_VAR];
151
+ }
152
+ if (raw === undefined) {
153
+ return defaultValue;
154
+ }
155
+ const normalized = raw.trim().toLowerCase();
156
+ if (normalized === "true") {
157
+ return true;
158
+ }
159
+ if (normalized === "false") {
160
+ return false;
161
+ }
162
+ return defaultValue;
163
+ }
164
+ /** Register :func:`createPipingHintPlugin` on *bash*. */
165
+ export function installPipingHintPlugin(bash, customCommandNames) {
166
+ bash.registerTransformPlugin(createPipingHintPlugin(customCommandNames));
167
+ }
@@ -0,0 +1,25 @@
1
+ export interface NativeToolSpec {
2
+ name: string;
3
+ description?: string | null;
4
+ input_schema: Record<string, unknown>;
5
+ }
6
+ export interface NativeCore {
7
+ compressToolListingJson(level: string, toolsJson: string): string;
8
+ formatToolSchemaResponseJson(toolJson: string): string;
9
+ parseToolArgvJson(toolJson: string, argvJson: string): string;
10
+ generateClientArtifactsJson(kind: string, configJson: string): string;
11
+ normalizeServersJson(serversJson: string): string;
12
+ parseMcpConfigJson(configJson: string): string;
13
+ rememberOauthBackendJson(backendUri: string, backendName: string, storeDir: string): void;
14
+ listOauthCredentialsJson(): string;
15
+ clearOauthCredentialsJson(target?: string | null): string;
16
+ startCompressedSessionJson(configJson: string, backendsJson: string): Promise<NativeCompressedSession>;
17
+ startCompressedSessionWithProviderBackendsJson(configJson: string, backendsJson: string, providersJson: string): Promise<NativeCompressedSession>;
18
+ startCompressedSessionFromMcpConfigJson(configJson: string, mcpConfigJson: string): Promise<NativeCompressedSession>;
19
+ }
20
+ export interface NativeCompressedSession {
21
+ infoJson(): string;
22
+ close(): void;
23
+ updateAuthProviderHeadersJson(providerIndex: number, headersJson: string): void;
24
+ }
25
+ export declare function loadNativeCore(): NativeCore;
package/dist/native.js ADDED
@@ -0,0 +1,11 @@
1
+ import { createRequire } from "node:module";
2
+ const require = createRequire(import.meta.url);
3
+ export function loadNativeCore() {
4
+ try {
5
+ return require("../native/index.js");
6
+ }
7
+ catch (error) {
8
+ const message = error instanceof Error ? error.message : String(error);
9
+ throw new Error(`Rust native addon is not available. Run \`bun run build:native\` before using Rust-backed helpers. Cause: ${message}`);
10
+ }
11
+ }
@@ -0,0 +1,96 @@
1
+ import type { ExecutableTool } from "./adapters.js";
2
+ import type { BackendConfig as LegacyBackendConfig, JsonConfigServerEntry } from "./types.js";
3
+ import type { CompressedSession, CompressedSessionInfo } from "./rust_core.js";
4
+ export type NativeCompressorMode = "compressed" | "cli" | "bash" | "python" | "typescript";
5
+ export type AuthProvider = () => Record<string, string> | Promise<Record<string, string>>;
6
+ export type NativeServerObjectConfig = (LegacyBackendConfig | JsonConfigServerEntry) & {
7
+ authProvider?: AuthProvider;
8
+ auth_provider?: AuthProvider;
9
+ oauthAppName?: string;
10
+ oauth_app_name?: string;
11
+ };
12
+ export type NativeServerConfig = NativeServerObjectConfig | string;
13
+ export type NativeServersInput = Record<string, NativeServerConfig> | LegacyBackendConfig | string;
14
+ export interface CompressorClientOptions {
15
+ servers: NativeServersInput;
16
+ mode?: NativeCompressorMode;
17
+ compressionLevel?: string;
18
+ serverName?: string | null;
19
+ includeTools?: string[];
20
+ excludeTools?: string[];
21
+ toonify?: boolean;
22
+ }
23
+ export interface ProxyTool {
24
+ name: string;
25
+ description?: string | null;
26
+ inputSchema: Record<string, unknown>;
27
+ }
28
+ export interface ProxyResponse {
29
+ text: string;
30
+ }
31
+ export interface JustBashCommand {
32
+ commandName: string;
33
+ backendToolName: string;
34
+ description?: string | null;
35
+ inputSchema: Record<string, unknown>;
36
+ invokeToolName: string;
37
+ }
38
+ export interface JustBashProvider {
39
+ providerName: string;
40
+ helpToolName: string;
41
+ tools: JustBashCommand[];
42
+ }
43
+ export type GeneratedClientKind = "cli" | "python" | "typescript";
44
+ export interface NormalizedBackendConfig {
45
+ name: string;
46
+ commandOrUrl: string;
47
+ args?: string[];
48
+ oauth_app_name?: string;
49
+ }
50
+ export interface GeneratedCodeClient {
51
+ language: "python" | "typescript";
52
+ outputDir: string;
53
+ files: string[];
54
+ environment: Record<string, string>;
55
+ }
56
+ export declare function normalizeServers(servers: NativeServersInput): Promise<NormalizedBackendConfig[] | string>;
57
+ export declare class CompressorProxy {
58
+ private readonly session;
59
+ private readonly defaultServer;
60
+ private readonly authProviders;
61
+ private closed;
62
+ constructor(session: CompressedSession, defaultServer: string | null, authProviders?: AuthProvider[]);
63
+ private refreshAuthProviders;
64
+ info(): CompressedSessionInfo;
65
+ get bridgeUrl(): string;
66
+ get token(): string;
67
+ get tools(): ProxyTool[];
68
+ get justBashProviders(): JustBashProvider[];
69
+ invokeWrapper(wrapperTool: string, toolInput: Record<string, unknown>): Promise<ProxyResponse>;
70
+ schema(tool: string, options?: {
71
+ server?: string;
72
+ }): Record<string, unknown>;
73
+ invoke(tool: string, toolInput?: Record<string, unknown>, options?: {
74
+ server?: string;
75
+ }): Promise<string>;
76
+ close(): void;
77
+ toExecutableTools(): Record<string, ExecutableTool>;
78
+ writeClient(kind: GeneratedClientKind, outputDir: string, options?: {
79
+ name?: string;
80
+ }): string[];
81
+ writeCodeClient(options: {
82
+ language: "python" | "typescript";
83
+ outputDir: string;
84
+ name?: string;
85
+ }): GeneratedCodeClient;
86
+ }
87
+ export declare class CompressorClient {
88
+ private readonly options;
89
+ private session;
90
+ private readonly mode;
91
+ private authProviders;
92
+ constructor(options: CompressorClientOptions);
93
+ connect(): Promise<CompressorProxy>;
94
+ close(): Promise<void>;
95
+ private defaultServer;
96
+ }