@silver886/mcp-proxy 0.1.2 → 0.1.3
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,15 @@ 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: [{ role: "user", content: { type: "text", text
|
|
152
|
+
messages: [{ role: "user", content: { type: "text", text } }],
|
|
154
153
|
});
|
|
155
154
|
}
|
|
156
155
|
else {
|
|
@@ -161,7 +160,8 @@ class ProxyServer {
|
|
|
161
160
|
case "tools/call": {
|
|
162
161
|
const toolName = parsed.params?.name;
|
|
163
162
|
if (toolName === "configure") {
|
|
164
|
-
|
|
163
|
+
const text = await this.handleConfigure();
|
|
164
|
+
this.sendResult(id, { content: [{ type: "text", text }] });
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
if (!this.config) {
|
|
@@ -268,7 +268,7 @@ class ProxyServer {
|
|
|
268
268
|
id: `init-${name}`,
|
|
269
269
|
method: "initialize",
|
|
270
270
|
params: {
|
|
271
|
-
protocolVersion:
|
|
271
|
+
protocolVersion: protocol_js_1.MCP_PROTOCOL_VERSION,
|
|
272
272
|
capabilities: {},
|
|
273
273
|
clientInfo: { name: protocol_js_1.PACKAGE_NAME, version: protocol_js_1.PACKAGE_VERSION },
|
|
274
274
|
},
|
|
@@ -305,10 +305,12 @@ class ProxyServer {
|
|
|
305
305
|
sendNotification(method) {
|
|
306
306
|
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", method }) + "\n");
|
|
307
307
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
308
|
+
async handleConfigure() {
|
|
309
|
+
if (this.config) {
|
|
310
|
+
await this.startPairing();
|
|
311
|
+
this.sendNotification("notifications/tools/list_changed");
|
|
312
|
+
}
|
|
313
|
+
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
314
|
}
|
|
313
315
|
async startPairing() {
|
|
314
316
|
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.3";
|
|
@@ -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";
|