@anyshift/mcp-proxy 0.6.0 → 0.6.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/index.js +17 -11
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -363,14 +363,13 @@ async function main() {
|
|
|
363
363
|
const childTransport = new SSEClientTransport(new URL(REMOTE_URL), {
|
|
364
364
|
eventSourceInit: {
|
|
365
365
|
fetch: (url, init) => {
|
|
366
|
-
//
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
});
|
|
366
|
+
// Merge headers using the Headers API (case-insensitive set avoids duplicates
|
|
367
|
+
// when requestInit headers are also passed through init by the SDK)
|
|
368
|
+
const merged = new Headers(init?.headers);
|
|
369
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
370
|
+
merged.set(key, value);
|
|
371
|
+
}
|
|
372
|
+
return fetch(url, { ...init, headers: merged });
|
|
374
373
|
},
|
|
375
374
|
},
|
|
376
375
|
requestInit: { headers },
|
|
@@ -648,6 +647,10 @@ async function main() {
|
|
|
648
647
|
});
|
|
649
648
|
// Check if child MCP returned an error
|
|
650
649
|
const childReturnedError = !!result.isError;
|
|
650
|
+
// Preserve _meta from child response (e.g. parsed_commands) for passthrough
|
|
651
|
+
const childMeta = result._meta && typeof result._meta === 'object' && Object.keys(result._meta).length > 0
|
|
652
|
+
? result._meta
|
|
653
|
+
: undefined;
|
|
651
654
|
// Process result through file writer to get unified response
|
|
652
655
|
if (result.content && Array.isArray(result.content) && result.content.length > 0) {
|
|
653
656
|
// Extract text content and embedded resources from all content items
|
|
@@ -710,7 +713,8 @@ async function main() {
|
|
|
710
713
|
type: 'text',
|
|
711
714
|
text: JSON.stringify(createErrorResponse(tool_id, contentStr, toolArgs), null, 2)
|
|
712
715
|
}],
|
|
713
|
-
isError: true
|
|
716
|
+
isError: true,
|
|
717
|
+
...(childMeta ? { _meta: childMeta } : {})
|
|
714
718
|
};
|
|
715
719
|
}
|
|
716
720
|
// Get unified response from file writer
|
|
@@ -751,7 +755,8 @@ async function main() {
|
|
|
751
755
|
type: 'text',
|
|
752
756
|
text: JSON.stringify(unifiedResponse, null, 2)
|
|
753
757
|
}],
|
|
754
|
-
isError: !!unifiedResponse.error
|
|
758
|
+
isError: !!unifiedResponse.error,
|
|
759
|
+
...(childMeta ? { _meta: childMeta } : {})
|
|
755
760
|
};
|
|
756
761
|
}
|
|
757
762
|
}
|
|
@@ -762,7 +767,8 @@ async function main() {
|
|
|
762
767
|
type: 'text',
|
|
763
768
|
text: JSON.stringify(createContentResponse(tool_id, result, toolArgs), null, 2)
|
|
764
769
|
}],
|
|
765
|
-
isError: childReturnedError
|
|
770
|
+
isError: childReturnedError,
|
|
771
|
+
...(childMeta ? { _meta: childMeta } : {})
|
|
766
772
|
};
|
|
767
773
|
}
|
|
768
774
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anyshift/mcp-proxy",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Generic MCP proxy that adds truncation, file writing, and JQ capabilities to any MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@jest/globals": "^30.2.0",
|
|
22
|
+
"@types/glob": "^9.0.0",
|
|
22
23
|
"@types/jest": "^30.0.0",
|
|
23
24
|
"@types/node": "^22.0.0",
|
|
24
25
|
"jest": "^30.2.0",
|