@atlassian/mcp-compressor 0.22.1 → 0.23.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.
@@ -0,0 +1,21 @@
1
+ import type { ExecutableTool } from "./adapters.js";
2
+ import type { ToolSpec } from "./rust_core.js";
3
+ export interface ExecutableToolBridgeServer {
4
+ name: string;
5
+ tools: ToolSpec[];
6
+ bridgeUrl: string;
7
+ }
8
+ export interface ExecutableToolBridgeRuntime {
9
+ serverName: string;
10
+ server: ExecutableToolBridgeServer;
11
+ invokeTool(toolName: string, input?: Record<string, unknown>): Promise<unknown>;
12
+ }
13
+ export interface ExecutableToolBridge extends ExecutableToolBridgeRuntime {
14
+ bridgeUrl: string;
15
+ token: string;
16
+ close(): void;
17
+ }
18
+ export interface CreateExecutableToolBridgeOptions {
19
+ serverName: string;
20
+ }
21
+ export declare function createExecutableToolBridge(tools: Record<string, ExecutableTool<unknown>>, options: CreateExecutableToolBridgeOptions): Promise<ExecutableToolBridge>;
@@ -0,0 +1,33 @@
1
+ import { startLocalToolBridge } from "./local_tool_bridge.js";
2
+ import { executableToolsToSpecs } from "./tool_specs.js";
3
+ export async function createExecutableToolBridge(tools, options) {
4
+ const bridge = await startLocalToolBridge(tools);
5
+ const server = {
6
+ name: options.serverName,
7
+ tools: executableToolsToSpecs(tools),
8
+ bridgeUrl: bridge.bridgeUrl,
9
+ };
10
+ return {
11
+ serverName: options.serverName,
12
+ server,
13
+ bridgeUrl: bridge.bridgeUrl,
14
+ token: bridge.token,
15
+ close: bridge.close,
16
+ invokeTool: async (toolName, input = {}) => invokeBridgeTool(bridge.bridgeUrl, bridge.token, toolName, input),
17
+ };
18
+ }
19
+ async function invokeBridgeTool(bridgeUrl, token, toolName, input) {
20
+ const response = await fetch(`${bridgeUrl}/exec`, {
21
+ method: "POST",
22
+ headers: {
23
+ authorization: `Bearer ${token}`,
24
+ "content-type": "application/json",
25
+ },
26
+ body: JSON.stringify({ tool: toolName, input }),
27
+ });
28
+ const payload = (await response.json());
29
+ if (!response.ok) {
30
+ throw new Error(typeof payload.error === "string" ? payload.error : JSON.stringify(payload.error));
31
+ }
32
+ return payload.result;
33
+ }
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export * from "./local_tools.js";
7
7
  export * from "./generated_clients.js";
8
8
  export * from "./just_bash_commands.js";
9
9
  export * from "./local_tool_bridge.js";
10
+ export * from "./executable_tool_bridge.js";
10
11
  export * from "./tool_specs.js";
11
12
  export * from "./transforms.js";
12
13
  export { interpolateString, interpolateRecord, interpolateMCPConfig, parseServerConfigJson, normalizeConfigServer, } from "./config.js";
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ export * from "./local_tools.js";
7
7
  export * from "./generated_clients.js";
8
8
  export * from "./just_bash_commands.js";
9
9
  export * from "./local_tool_bridge.js";
10
+ export * from "./executable_tool_bridge.js";
10
11
  export * from "./tool_specs.js";
11
12
  export * from "./transforms.js";
12
13
  export { interpolateString, interpolateRecord, interpolateMCPConfig, parseServerConfigJson, normalizeConfigServer, } from "./config.js";
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlassian/mcp-compressor",
3
- "version": "0.22.1",
3
+ "version": "0.23.0",
4
4
  "description": "TypeScript MCP server wrapper for reducing tokens consumed by MCP tools.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/atlassian-labs/mcp-compressor",