@proofline/mcp 0.1.3 → 0.1.5
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 +2 -0
- package/package.json +1 -1
- package/src/bridge.js +16 -2
package/README.md
CHANGED
|
@@ -55,6 +55,8 @@ The bridge supports Proofline's stateless JSON transport with protocol `2025-11-
|
|
|
55
55
|
## Development and releases
|
|
56
56
|
|
|
57
57
|
The hosted endpoint's Official MCP Registry entry is maintained in `server.json`.
|
|
58
|
+
Its description says what an agent can do with the hosted server, within the
|
|
59
|
+
registry's 100-character limit, and names no tool or permission.
|
|
58
60
|
Run the **Publish MCP Registry** workflow from `main` after reviewing a metadata
|
|
59
61
|
change. It validates the file and publishes with GitHub OIDC; no stored registry
|
|
60
62
|
token is needed. Published versions are immutable, so increment the registry
|
package/package.json
CHANGED
package/src/bridge.js
CHANGED
|
@@ -3,6 +3,8 @@ import { once } from "node:events";
|
|
|
3
3
|
export const PROTOCOL = "2025-11-25";
|
|
4
4
|
const REQUEST_LIMIT = 8192;
|
|
5
5
|
const RESPONSE_LIMIT = 8 * 1024 * 1024;
|
|
6
|
+
const REQUEST_TIMEOUT = 35_000;
|
|
7
|
+
const TRANSPORT_TIMEOUTS = new Set(["UND_ERR_CONNECT_TIMEOUT", "UND_ERR_HEADERS_TIMEOUT", "UND_ERR_BODY_TIMEOUT", "ETIMEDOUT"]);
|
|
6
8
|
const object = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
7
9
|
const identity = (value) => typeof value === "string" || Number.isSafeInteger(value);
|
|
8
10
|
|
|
@@ -56,11 +58,12 @@ async function send(output, message) {
|
|
|
56
58
|
|
|
57
59
|
async function post(frame, config, protocol, notification) {
|
|
58
60
|
let response;
|
|
61
|
+
const signal = AbortSignal.timeout(REQUEST_TIMEOUT);
|
|
59
62
|
try {
|
|
60
63
|
response = await fetch(`${config.origin}/mcp`, {
|
|
61
64
|
method: "POST",
|
|
62
65
|
redirect: "manual",
|
|
63
|
-
signal
|
|
66
|
+
signal,
|
|
64
67
|
headers: {
|
|
65
68
|
Authorization: `Bearer ${config.token}`,
|
|
66
69
|
"Content-Type": "application/json",
|
|
@@ -94,6 +97,9 @@ async function post(frame, config, protocol, notification) {
|
|
|
94
97
|
} catch { throw new BridgeError("response"); }
|
|
95
98
|
} catch (error) {
|
|
96
99
|
if (error instanceof BridgeError) throw error;
|
|
100
|
+
if (signal.aborted || TRANSPORT_TIMEOUTS.has(error.cause?.code ?? error.code)) {
|
|
101
|
+
throw new BridgeError("timeout");
|
|
102
|
+
}
|
|
97
103
|
throw new BridgeError("transport");
|
|
98
104
|
}
|
|
99
105
|
}
|
|
@@ -142,7 +148,15 @@ export async function bridge(input, output, diagnostic, config) {
|
|
|
142
148
|
notification = false;
|
|
143
149
|
continue;
|
|
144
150
|
}
|
|
145
|
-
|
|
151
|
+
let response;
|
|
152
|
+
try {
|
|
153
|
+
response = await post(frame, config, protocol, notification);
|
|
154
|
+
} catch (error) {
|
|
155
|
+
if (notification || !(error instanceof BridgeError) || error.category !== "timeout") throw error;
|
|
156
|
+
await send(output, failure(error, id));
|
|
157
|
+
id = null;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
146
160
|
if (!notification) {
|
|
147
161
|
if (!object(response) || response.jsonrpc !== "2.0" || response.id !== id ||
|
|
148
162
|
("result" in response) === ("error" in response) ||
|