@silver886/mcp-proxy 0.1.2 → 0.1.4
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/mcp/dist/proxy.js
CHANGED
|
@@ -118,7 +118,7 @@ class ProxyServer {
|
|
|
118
118
|
// initialize always succeeds — proxy is a valid server even before pairing
|
|
119
119
|
case "initialize":
|
|
120
120
|
this.sendResult(id, {
|
|
121
|
-
protocolVersion:
|
|
121
|
+
protocolVersion: protocol_js_1.MCP_PROTOCOL_VERSION,
|
|
122
122
|
capabilities: { tools: { listChanged: true }, prompts: {}, logging: {} },
|
|
123
123
|
serverInfo: { name: protocol_js_1.PACKAGE_NAME, version: protocol_js_1.PACKAGE_VERSION },
|
|
124
124
|
});
|
|
@@ -128,7 +128,7 @@ class ProxyServer {
|
|
|
128
128
|
if (!this.config) {
|
|
129
129
|
this.sendResult(id, { tools: [{
|
|
130
130
|
name: "configure",
|
|
131
|
-
description: "
|
|
131
|
+
description: "Set up or reconfigure the MCP proxy connection. Returns the setup URL.",
|
|
132
132
|
inputSchema: { type: "object", properties: {} },
|
|
133
133
|
}] });
|
|
134
134
|
return;
|
|
@@ -141,16 +141,18 @@ class ProxyServer {
|
|
|
141
141
|
case "prompts/list":
|
|
142
142
|
this.sendResult(id, { prompts: [{
|
|
143
143
|
name: "configure",
|
|
144
|
-
description:
|
|
145
|
-
? "Reconfigure the MCP proxy (change tunnel URL, auth token, or tool selection)"
|
|
146
|
-
: "Get the setup URL to pair this MCP proxy with a host agent",
|
|
144
|
+
description: "Set up or reconfigure the MCP proxy connection",
|
|
147
145
|
}] });
|
|
148
146
|
return;
|
|
149
147
|
case "prompts/get": {
|
|
150
148
|
const promptName = parsed.params?.name;
|
|
151
149
|
if (promptName === "configure") {
|
|
150
|
+
const text = await this.handleConfigure();
|
|
152
151
|
this.sendResult(id, {
|
|
153
|
-
messages: [
|
|
152
|
+
messages: [
|
|
153
|
+
{ role: "user", content: { type: "text", text: "Show the MCP Proxy setup URL. Do not add any follow-up — do not ask me to let you know or report back." } },
|
|
154
|
+
{ role: "assistant", content: { type: "text", text } },
|
|
155
|
+
],
|
|
154
156
|
});
|
|
155
157
|
}
|
|
156
158
|
else {
|
|
@@ -161,7 +163,8 @@ class ProxyServer {
|
|
|
161
163
|
case "tools/call": {
|
|
162
164
|
const toolName = parsed.params?.name;
|
|
163
165
|
if (toolName === "configure") {
|
|
164
|
-
|
|
166
|
+
const text = await this.handleConfigure();
|
|
167
|
+
this.sendResult(id, { content: [{ type: "text", text }] });
|
|
165
168
|
return;
|
|
166
169
|
}
|
|
167
170
|
if (!this.config) {
|
|
@@ -268,7 +271,7 @@ class ProxyServer {
|
|
|
268
271
|
id: `init-${name}`,
|
|
269
272
|
method: "initialize",
|
|
270
273
|
params: {
|
|
271
|
-
protocolVersion:
|
|
274
|
+
protocolVersion: protocol_js_1.MCP_PROTOCOL_VERSION,
|
|
272
275
|
capabilities: {},
|
|
273
276
|
clientInfo: { name: protocol_js_1.PACKAGE_NAME, version: protocol_js_1.PACKAGE_VERSION },
|
|
274
277
|
},
|
|
@@ -305,10 +308,12 @@ class ProxyServer {
|
|
|
305
308
|
sendNotification(method) {
|
|
306
309
|
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", method }) + "\n");
|
|
307
310
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
311
|
+
async handleConfigure() {
|
|
312
|
+
if (this.config) {
|
|
313
|
+
await this.startPairing();
|
|
314
|
+
this.sendNotification("notifications/tools/list_changed");
|
|
315
|
+
}
|
|
316
|
+
return `Open this URL in your browser to set up the MCP Proxy:\n\n${this.setupUrl}\n\nThe proxy will connect automatically once setup is complete.`;
|
|
312
317
|
}
|
|
313
318
|
async startPairing() {
|
|
314
319
|
if (this.pollTimer)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const PACKAGE_NAME = "@silver886/mcp-proxy";
|
|
2
|
-
export declare const PACKAGE_VERSION = "0.1.
|
|
2
|
+
export declare const PACKAGE_VERSION = "0.1.4";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
export { PACKAGE_NAME, PACKAGE_VERSION } from "./generated.js";
|
|
3
|
+
export declare const MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
3
4
|
export declare const DEFAULT_HOST = "127.0.0.1";
|
|
4
5
|
export declare const DEFAULT_PORT = 6270;
|
|
5
6
|
export declare const DEFAULT_PAGES_URL = "https://mcp-proxy.pages.dev";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LineBuffer = exports.ErrorMessage = exports.ErrorCode = exports.DEFAULT_PAGES_URL = exports.DEFAULT_PORT = exports.DEFAULT_HOST = exports.PACKAGE_VERSION = exports.PACKAGE_NAME = void 0;
|
|
3
|
+
exports.LineBuffer = exports.ErrorMessage = exports.ErrorCode = exports.DEFAULT_PAGES_URL = exports.DEFAULT_PORT = exports.DEFAULT_HOST = exports.MCP_PROTOCOL_VERSION = exports.PACKAGE_VERSION = exports.PACKAGE_NAME = void 0;
|
|
4
4
|
exports.jsonRpcError = jsonRpcError;
|
|
5
5
|
exports.readBody = readBody;
|
|
6
6
|
exports.getArg = getArg;
|
|
@@ -9,6 +9,7 @@ const node_http_1 = require("node:http");
|
|
|
9
9
|
var generated_js_1 = require("./generated.js");
|
|
10
10
|
Object.defineProperty(exports, "PACKAGE_NAME", { enumerable: true, get: function () { return generated_js_1.PACKAGE_NAME; } });
|
|
11
11
|
Object.defineProperty(exports, "PACKAGE_VERSION", { enumerable: true, get: function () { return generated_js_1.PACKAGE_VERSION; } });
|
|
12
|
+
exports.MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
12
13
|
exports.DEFAULT_HOST = "127.0.0.1";
|
|
13
14
|
exports.DEFAULT_PORT = 6270;
|
|
14
15
|
exports.DEFAULT_PAGES_URL = "https://mcp-proxy.pages.dev";
|