mcp-remote 0.1.0-1 → 0.1.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.
- package/README.md +1 -1
- package/dist/{chunk-TLT4CYWU.js → chunk-H6WV3ZQP.js} +11 -2
- package/dist/client.js +2 -9
- package/dist/proxy.js +3 -14
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ So far, the majority of MCP servers in the wild are installed locally, using the
|
|
|
10
10
|
|
|
11
11
|
But there's a reason most software that _could_ be moved to the web _did_ get moved to the web: it's so much easier to find and fix bugs & iterate on new features when you can push updates to all your users with a single deploy.
|
|
12
12
|
|
|
13
|
-
With the MCP [Authorization specification](https://
|
|
13
|
+
With the latest MCP [Authorization specification](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization), we now have a secure way of sharing our MCP servers with the world _without_ running code on user's laptops. Or at least, you would, if all the popular MCP _clients_ supported it yet. Most are stdio-only, and those that _do_ support HTTP+SSE don't yet support the OAuth flows required.
|
|
14
14
|
|
|
15
15
|
That's where `mcp-remote` comes in. As soon as your chosen MCP client supports remote, authorized servers, you can remove it. Until that time, drop in this one liner and dress for the MCP clients you want!
|
|
16
16
|
|
|
@@ -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.0
|
|
17
|
+
version: "0.1.0",
|
|
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",
|
|
@@ -6654,7 +6654,16 @@ async function connectToRemoteServer(client, serverUrl, authProvider, headers, a
|
|
|
6654
6654
|
requestInit: { headers }
|
|
6655
6655
|
});
|
|
6656
6656
|
try {
|
|
6657
|
-
|
|
6657
|
+
if (client) {
|
|
6658
|
+
await client.connect(transport);
|
|
6659
|
+
} else {
|
|
6660
|
+
await transport.start();
|
|
6661
|
+
if (!sseTransport) {
|
|
6662
|
+
const testTransport = new StreamableHTTPClientTransport(url, { authProvider, requestInit: { headers } });
|
|
6663
|
+
const testClient = new Client({ name: "mcp-remote-fallback-test", version: "0.0.0" }, { capabilities: {} });
|
|
6664
|
+
await testClient.connect(testTransport);
|
|
6665
|
+
}
|
|
6666
|
+
}
|
|
6658
6667
|
log(`Connected to remote server using ${transport.constructor.name}`);
|
|
6659
6668
|
return transport;
|
|
6660
6669
|
} catch (error) {
|
package/dist/client.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
log,
|
|
12
12
|
parseCommandLineArgs,
|
|
13
13
|
setupSignalHandlers
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-H6WV3ZQP.js";
|
|
15
15
|
|
|
16
16
|
// src/client.ts
|
|
17
17
|
import { EventEmitter } from "events";
|
|
@@ -47,14 +47,7 @@ async function runClient(serverUrl, callbackPort, headers, transportStrategy = "
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
try {
|
|
50
|
-
const transport = await connectToRemoteServer(
|
|
51
|
-
client,
|
|
52
|
-
serverUrl,
|
|
53
|
-
authProvider,
|
|
54
|
-
headers,
|
|
55
|
-
authInitializer,
|
|
56
|
-
transportStrategy
|
|
57
|
-
);
|
|
50
|
+
const transport = await connectToRemoteServer(client, serverUrl, authProvider, headers, authInitializer, transportStrategy);
|
|
58
51
|
transport.onmessage = (message) => {
|
|
59
52
|
log("Received message:", JSON.stringify(message, null, 2));
|
|
60
53
|
};
|
package/dist/proxy.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
Client,
|
|
4
3
|
JSONRPCMessageSchema,
|
|
5
|
-
MCP_REMOTE_VERSION,
|
|
6
4
|
NodeOAuthClientProvider,
|
|
7
5
|
connectToRemoteServer,
|
|
8
6
|
createLazyAuthCoordinator,
|
|
@@ -11,7 +9,7 @@ import {
|
|
|
11
9
|
mcpProxy,
|
|
12
10
|
parseCommandLineArgs,
|
|
13
11
|
setupSignalHandlers
|
|
14
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-H6WV3ZQP.js";
|
|
15
13
|
|
|
16
14
|
// src/proxy.ts
|
|
17
15
|
import { EventEmitter } from "events";
|
|
@@ -136,23 +134,14 @@ async function runProxy(serverUrl, callbackPort, headers, transportStrategy = "h
|
|
|
136
134
|
};
|
|
137
135
|
};
|
|
138
136
|
try {
|
|
139
|
-
const
|
|
140
|
-
{
|
|
141
|
-
name: "mcp-remote",
|
|
142
|
-
version: MCP_REMOTE_VERSION
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
capabilities: {}
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
|
-
const remoteTransport = await connectToRemoteServer(client, serverUrl, authProvider, headers, authInitializer, transportStrategy);
|
|
137
|
+
const remoteTransport = await connectToRemoteServer(null, serverUrl, authProvider, headers, authInitializer, transportStrategy);
|
|
149
138
|
mcpProxy({
|
|
150
139
|
transportToClient: localTransport,
|
|
151
140
|
transportToServer: remoteTransport
|
|
152
141
|
});
|
|
153
142
|
await localTransport.start();
|
|
154
143
|
log("Local STDIO server running");
|
|
155
|
-
log(
|
|
144
|
+
log(`Proxy established successfully between local STDIO and remote ${remoteTransport.constructor.name}`);
|
|
156
145
|
log("Press Ctrl+C to exit");
|
|
157
146
|
const cleanup = async () => {
|
|
158
147
|
await remoteTransport.close();
|