mcp-remote 0.1.0 → 0.1.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/README.md +17 -0
- package/dist/{chunk-H6WV3ZQP.js → chunk-XFJBHM5U.js} +8 -5
- package/dist/client.js +1 -1
- package/dist/proxy.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,6 +114,23 @@ To bypass authentication, or to emit custom headers on all requests to your remo
|
|
|
114
114
|
]
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
### Transport Strategies
|
|
118
|
+
|
|
119
|
+
MCP Remote supports different transport strategies when connecting to an MCP server. This allows you to control whether it uses Server-Sent Events (SSE) or HTTP transport, and in what order it tries them.
|
|
120
|
+
|
|
121
|
+
Specify the transport strategy with the `--transport` flag:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
npx mcp-remote https://example.remote/server --transport sse-only
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Available Strategies:**
|
|
128
|
+
|
|
129
|
+
- `http-first` (default): Tries HTTP transport first, falls back to SSE if HTTP fails with a 404 error
|
|
130
|
+
- `sse-first`: Tries SSE transport first, falls back to HTTP if SSE fails with a 405 error
|
|
131
|
+
- `http-only`: Only uses HTTP transport, fails if the server doesn't support it
|
|
132
|
+
- `sse-only`: Only uses SSE transport, fails if the server doesn't support it
|
|
133
|
+
|
|
117
134
|
### Claude Desktop
|
|
118
135
|
|
|
119
136
|
[Official Docs](https://modelcontextprotocol.io/quickstart/user)
|
|
@@ -14,7 +14,7 @@ var require_package = __commonJS({
|
|
|
14
14
|
"package.json"(exports, module) {
|
|
15
15
|
module.exports = {
|
|
16
16
|
name: "mcp-remote",
|
|
17
|
-
version: "0.1.
|
|
17
|
+
version: "0.1.2",
|
|
18
18
|
description: "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth",
|
|
19
19
|
keywords: [
|
|
20
20
|
"mcp",
|
|
@@ -6667,7 +6667,7 @@ async function connectToRemoteServer(client, serverUrl, authProvider, headers, a
|
|
|
6667
6667
|
log(`Connected to remote server using ${transport.constructor.name}`);
|
|
6668
6668
|
return transport;
|
|
6669
6669
|
} catch (error) {
|
|
6670
|
-
if (error instanceof Error && shouldAttemptFallback && (
|
|
6670
|
+
if (error instanceof Error && shouldAttemptFallback && (error.message.includes("405") || error.message.includes("Method Not Allowed") || error.message.includes("404") || error.message.includes("Not Found"))) {
|
|
6671
6671
|
log(`Received error: ${error.message}`);
|
|
6672
6672
|
if (recursionReasons.has(REASON_TRANSPORT_FALLBACK)) {
|
|
6673
6673
|
const errorMessage = `Already attempted transport fallback. Giving up.`;
|
|
@@ -6800,8 +6800,9 @@ async function findAvailablePort(preferredPort) {
|
|
|
6800
6800
|
}
|
|
6801
6801
|
async function parseCommandLineArgs(args, defaultPort, usage) {
|
|
6802
6802
|
const headers = {};
|
|
6803
|
-
|
|
6804
|
-
|
|
6803
|
+
let i = 0;
|
|
6804
|
+
while (i < args.length) {
|
|
6805
|
+
if (args[i] === "--header" && i < args.length - 1) {
|
|
6805
6806
|
const value = args[i + 1];
|
|
6806
6807
|
const match = value.match(/^([A-Za-z0-9_-]+):(.*)$/);
|
|
6807
6808
|
if (match) {
|
|
@@ -6810,8 +6811,10 @@ async function parseCommandLineArgs(args, defaultPort, usage) {
|
|
|
6810
6811
|
log(`Warning: ignoring invalid header argument: ${value}`);
|
|
6811
6812
|
}
|
|
6812
6813
|
args.splice(i, 2);
|
|
6814
|
+
continue;
|
|
6813
6815
|
}
|
|
6814
|
-
|
|
6816
|
+
i++;
|
|
6817
|
+
}
|
|
6815
6818
|
const serverUrl = args[0];
|
|
6816
6819
|
const specifiedPort = args[1] ? parseInt(args[1]) : void 0;
|
|
6817
6820
|
const allowHttp = args.includes("--allow-http");
|
package/dist/client.js
CHANGED
package/dist/proxy.js
CHANGED