@atlassian/mcp-compressor 0.33.0 → 0.33.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/README.md +1 -1
- package/dist/cli.js +3 -4
- package/dist/native.d.ts +1 -1
- package/dist/native_client.d.ts +1 -3
- package/dist/native_client.js +3 -16
- package/dist/rust_core.js +8 -2
- package/dist/transforms.d.ts +9 -3
- package/dist/transforms.js +3 -3
- package/native/index.d.ts +1 -1
- package/native/index.darwin-arm64.node +0 -0
- package/native/index.darwin-x64.node +0 -0
- package/native/index.linux-arm64-gnu.node +0 -0
- package/native/index.linux-x64-gnu.node +0 -0
- package/native/index.win32-x64-msvc.node +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ atlassian search-confluence --query oauth
|
|
|
72
72
|
atlassian get-jira-issue --issue-url https://jira.example.com/browse/PROJ-123
|
|
73
73
|
```
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
Tool output is returned verbatim in CLI mode. Pass `--toonify` to opt in to TOON conversion of JSON, CSV and YAML results.
|
|
76
76
|
|
|
77
77
|
### Bash mode
|
|
78
78
|
|
package/dist/cli.js
CHANGED
|
@@ -64,12 +64,11 @@ function buildProgram(options = {}) {
|
|
|
64
64
|
.option("--toonify", "Convert JSON, CSV and YAML tool responses to TOON format automatically.")
|
|
65
65
|
.option("--cli-mode", "Start in CLI mode: expose a single help MCP tool, start a local HTTP\n" +
|
|
66
66
|
"bridge, and generate a shell script for interacting with the wrapped\n" +
|
|
67
|
-
"server via CLI.
|
|
67
|
+
"server via CLI.")
|
|
68
68
|
.option("--cli-port <port>", "Port for the local CLI bridge HTTP server (default: random free port).")
|
|
69
69
|
.option("--just-bash", "Start in just-bash mode: expose a single 'bash' MCP tool powered by\n" +
|
|
70
70
|
"just-bash, with all backend server tools available as custom commands.\n" +
|
|
71
|
-
"Requires the 'just-bash' package to be installed.
|
|
72
|
-
"automatically enabled in this mode.")
|
|
71
|
+
"Requires the 'just-bash' package to be installed.")
|
|
73
72
|
.option("--include-tool <tool>", "Wrapped server tool name to expose. Can be used multiple times.\n" +
|
|
74
73
|
"If omitted, all tools are included.", collect, [])
|
|
75
74
|
.option("--exclude-tool <tool>", "Wrapped server tool name to hide. Can be used multiple times.", collect, []);
|
|
@@ -85,7 +84,7 @@ function parseCliArgsWithOptions(argv, parseOptions = {}) {
|
|
|
85
84
|
const backend = parseBackendArg(program.args);
|
|
86
85
|
const justBash = parsedOptions.justBash ?? false;
|
|
87
86
|
const cliMode = parsedOptions.cliMode ?? false;
|
|
88
|
-
const toonify =
|
|
87
|
+
const toonify = parsedOptions.toonify ?? false;
|
|
89
88
|
return {
|
|
90
89
|
backend,
|
|
91
90
|
justBash,
|
package/dist/native.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface NativeCore {
|
|
|
20
20
|
listOauthCredentialsJson(): string;
|
|
21
21
|
clearOauthCredentialsJson(target?: string | null): string;
|
|
22
22
|
startCompressedSessionJson(configJson: string, backendsJson: string): Promise<NativeCompressedSession>;
|
|
23
|
-
startCompressedSessionWithProviderBackendsJson(configJson: string, backendsJson: string, providersJson: string): Promise<NativeCompressedSession>;
|
|
23
|
+
startCompressedSessionWithProviderBackendsJson(configJson: string, backendsJson: string, providersJson: string, refreshProviders: () => Promise<string>): Promise<NativeCompressedSession>;
|
|
24
24
|
startCompressedSessionFromMcpConfigJson(configJson: string, mcpConfigJson: string): Promise<NativeCompressedSession>;
|
|
25
25
|
}
|
|
26
26
|
export interface NativeCompressedSession {
|
package/dist/native_client.d.ts
CHANGED
|
@@ -70,10 +70,8 @@ export declare function adoptNativeSession<T>(session: {
|
|
|
70
70
|
export declare class CompressorProxy {
|
|
71
71
|
private readonly session;
|
|
72
72
|
private readonly defaultServer;
|
|
73
|
-
private readonly authProviders;
|
|
74
73
|
private closed;
|
|
75
|
-
constructor(session: CompressedSession, defaultServer: string | null
|
|
76
|
-
private refreshAuthProviders;
|
|
74
|
+
constructor(session: CompressedSession, defaultServer: string | null);
|
|
77
75
|
info(): CompressedSessionInfo;
|
|
78
76
|
get bridgeUrl(): string;
|
|
79
77
|
get token(): string;
|
package/dist/native_client.js
CHANGED
|
@@ -46,7 +46,7 @@ async function normalizeServersWithProviders(servers) {
|
|
|
46
46
|
for (const [name, config] of Object.entries(servers)) {
|
|
47
47
|
if (typeof config === "object" && config !== null && "url" in config) {
|
|
48
48
|
const provider = providerFromConfig(config);
|
|
49
|
-
const backend = await sdkObjectToNative(name, config, { includeProvider:
|
|
49
|
+
const backend = await sdkObjectToNative(name, config, { includeProvider: provider === undefined });
|
|
50
50
|
if (provider !== undefined) {
|
|
51
51
|
backend.providerIndex = providers.length;
|
|
52
52
|
providers.push(provider);
|
|
@@ -180,22 +180,10 @@ export function adoptNativeSession(session, build) {
|
|
|
180
180
|
export class CompressorProxy {
|
|
181
181
|
session;
|
|
182
182
|
defaultServer;
|
|
183
|
-
authProviders;
|
|
184
183
|
closed = false;
|
|
185
|
-
constructor(session, defaultServer
|
|
184
|
+
constructor(session, defaultServer) {
|
|
186
185
|
this.session = session;
|
|
187
186
|
this.defaultServer = defaultServer;
|
|
188
|
-
this.authProviders = authProviders;
|
|
189
|
-
}
|
|
190
|
-
async refreshAuthProviders() {
|
|
191
|
-
await Promise.all(this.authProviders.map(async (provider, index) => {
|
|
192
|
-
const headers = await provider();
|
|
193
|
-
const materialized = {};
|
|
194
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
195
|
-
materialized[key] = String(value);
|
|
196
|
-
}
|
|
197
|
-
this.session.updateAuthProviderHeaders(index, materialized);
|
|
198
|
-
}));
|
|
199
187
|
}
|
|
200
188
|
info() {
|
|
201
189
|
return this.session.info();
|
|
@@ -233,7 +221,6 @@ export class CompressorProxy {
|
|
|
233
221
|
if (this.closed) {
|
|
234
222
|
throw new Error("Compressor proxy is closed");
|
|
235
223
|
}
|
|
236
|
-
await this.refreshAuthProviders();
|
|
237
224
|
const response = await fetch(`${this.bridgeUrl}/exec`, {
|
|
238
225
|
method: "POST",
|
|
239
226
|
headers: {
|
|
@@ -372,7 +359,7 @@ export class CompressorClient {
|
|
|
372
359
|
? await startCompressedSessionWithAuthProviders(config, normalized.backends, normalized.providers)
|
|
373
360
|
: await startCompressedSession(config, normalized.backends);
|
|
374
361
|
const proxy = adoptNativeSession(session, () => {
|
|
375
|
-
const adopted = new CompressorProxy(session, this.defaultServer()
|
|
362
|
+
const adopted = new CompressorProxy(session, this.defaultServer());
|
|
376
363
|
proxyCloseCallbacks.set(adopted, () => {
|
|
377
364
|
if (this.proxy === adopted) {
|
|
378
365
|
this.proxy = null;
|
package/dist/rust_core.js
CHANGED
|
@@ -88,13 +88,19 @@ export async function startCompressedSession(config, backends) {
|
|
|
88
88
|
const session = await loadNativeCore().startCompressedSessionJson(stringify(toNativeSessionConfig(config)), stringify(backends.map(toNativeBackendConfig)));
|
|
89
89
|
return new CompressedSession(session);
|
|
90
90
|
}
|
|
91
|
+
async function materializeAuthProviderHeaders(providers) {
|
|
92
|
+
return Promise.all(providers.map(async (provider) => {
|
|
93
|
+
const headers = await provider();
|
|
94
|
+
return Object.fromEntries(Object.entries(headers).map(([key, value]) => [key, String(value)]));
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
91
97
|
export async function startCompressedSessionWithAuthProviders(config, backends, providers) {
|
|
92
98
|
const nativeBackends = backends.map((backend) => ({
|
|
93
99
|
...toNativeBackendConfig(backend),
|
|
94
100
|
provider_index: backend.providerIndex ?? null,
|
|
95
101
|
}));
|
|
96
|
-
const initialHeaders = await
|
|
97
|
-
const session = await loadNativeCore().startCompressedSessionWithProviderBackendsJson(stringify(toNativeSessionConfig(config)), stringify(nativeBackends), stringify(initialHeaders));
|
|
102
|
+
const initialHeaders = await materializeAuthProviderHeaders(providers);
|
|
103
|
+
const session = await loadNativeCore().startCompressedSessionWithProviderBackendsJson(stringify(toNativeSessionConfig(config)), stringify(nativeBackends), stringify(initialHeaders), async () => stringify(await materializeAuthProviderHeaders(providers)));
|
|
98
104
|
return new CompressedSession(session);
|
|
99
105
|
}
|
|
100
106
|
export async function startCompressedSessionFromMcpConfig(config, mcpConfigJson) {
|
package/dist/transforms.d.ts
CHANGED
|
@@ -3,10 +3,16 @@ import { type JustBashCommandRegistration } from "./just_bash_commands.js";
|
|
|
3
3
|
export interface TransformToolOptions {
|
|
4
4
|
serverName?: string;
|
|
5
5
|
}
|
|
6
|
-
export interface TransformToolsForJustBashOptions extends TransformToolOptions {
|
|
7
|
-
bash: unknown;
|
|
8
|
-
}
|
|
9
6
|
export interface PlanToolsForJustBashOptions extends TransformToolOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Convert JSON/CSV/YAML tool results to TOON before writing them to stdout.
|
|
9
|
+
* Defaults to ``false`` so Just Bash output matches the generated CLI byte for
|
|
10
|
+
* byte (and stays pipeable into tools such as ``jq``).
|
|
11
|
+
*/
|
|
12
|
+
toonify?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TransformToolsForJustBashOptions extends PlanToolsForJustBashOptions {
|
|
15
|
+
bash: unknown;
|
|
10
16
|
}
|
|
11
17
|
export interface JustBashTransformResult {
|
|
12
18
|
tools: Record<string, ExecutableTool>;
|
package/dist/transforms.js
CHANGED
|
@@ -6,7 +6,7 @@ export function planToolsForJustBash(tools, options = {}) {
|
|
|
6
6
|
const serverName = normalizeServerName(options.serverName);
|
|
7
7
|
const toolSpecs = executableToolsToSpecs(tools);
|
|
8
8
|
const plan = buildHostTransformPlan({ kind: "just-bash", serverName, tools: toolSpecs });
|
|
9
|
-
const registrations = createJustBashCommandRegistrations((plan.justBash?.commands ?? []).map((command) => justBashSource(serverName, command.commandName, command.backendToolName, tools)));
|
|
9
|
+
const registrations = createJustBashCommandRegistrations((plan.justBash?.commands ?? []).map((command) => justBashSource(serverName, command.commandName, command.backendToolName, tools, options.toonify ?? false)));
|
|
10
10
|
return {
|
|
11
11
|
registrations,
|
|
12
12
|
tools: helpTools({
|
|
@@ -38,7 +38,7 @@ export async function transformToolsForCliMode(tools, options = {}) {
|
|
|
38
38
|
commandName: serverName,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
function justBashSource(serverName, commandName, backendToolName, tools) {
|
|
41
|
+
function justBashSource(serverName, commandName, backendToolName, tools, toonify) {
|
|
42
42
|
const tool = tools[backendToolName];
|
|
43
43
|
if (tool === undefined) {
|
|
44
44
|
throw new Error(`missing Just Bash backend tool: ${backendToolName}`);
|
|
@@ -49,7 +49,7 @@ function justBashSource(serverName, commandName, backendToolName, tools) {
|
|
|
49
49
|
backendToolName,
|
|
50
50
|
helpToolName: `${serverName}_help`,
|
|
51
51
|
tool: executableToolToSpec(backendToolName, tool),
|
|
52
|
-
invoke: async (input) => normalizeHostToolResult(await tool.execute(input),
|
|
52
|
+
invoke: async (input) => normalizeHostToolResult(await tool.execute(input), toonify),
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
async function generatedTransform(tools, options) {
|
package/native/index.d.ts
CHANGED
|
@@ -40,4 +40,4 @@ export declare function startCompressedSessionFromMcpConfigJson(configJson: stri
|
|
|
40
40
|
|
|
41
41
|
export declare function startCompressedSessionJson(configJson: string, backendsJson: string): Promise<NativeCompressedSession>
|
|
42
42
|
|
|
43
|
-
export declare function startCompressedSessionWithProviderBackendsJson(configJson: string, backendsJson: string, providersJson: string): Promise<NativeCompressedSession>
|
|
43
|
+
export declare function startCompressedSessionWithProviderBackendsJson(configJson: string, backendsJson: string, providersJson: string, refreshProviders: RefreshProviders): Promise<NativeCompressedSession>
|
|
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.33.
|
|
3
|
+
"version": "0.33.1",
|
|
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",
|