@vibecodr/cli 0.2.5 → 0.2.7
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/CHANGELOG.md +4 -0
- package/dist/core/mcp-client.js +22 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/core/mcp-client.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
3
|
import { extractWWWAuthenticateParams } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
4
4
|
import { StreamableHTTPClientTransport, StreamableHTTPError } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
5
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
5
6
|
import { CliError, EXIT_CODES } from "../cli/errors.js";
|
|
6
7
|
const require = createRequire(import.meta.url);
|
|
7
8
|
const packageJson = require("../../package.json");
|
|
@@ -12,6 +13,18 @@ export const CLIENT_INFO = {
|
|
|
12
13
|
name: "vibecodr-mcp",
|
|
13
14
|
version: packageVersion
|
|
14
15
|
};
|
|
16
|
+
export function resolveToolRequestTimeoutMs(args) {
|
|
17
|
+
const raw = args["timeoutSeconds"];
|
|
18
|
+
if (raw === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
if (typeof raw !== "number" || !Number.isFinite(raw))
|
|
21
|
+
return undefined;
|
|
22
|
+
const timeoutSeconds = Math.min(Math.max(Math.floor(raw), 5), 600);
|
|
23
|
+
return timeoutSeconds * 1000 + 15_000;
|
|
24
|
+
}
|
|
25
|
+
function isMcpRequestTimeout(error) {
|
|
26
|
+
return error instanceof McpError && error.code === ErrorCode.RequestTimeout;
|
|
27
|
+
}
|
|
15
28
|
export class McpRuntimeClient {
|
|
16
29
|
async listTools(serverUrl, accessToken) {
|
|
17
30
|
return await this.withClient(serverUrl, accessToken, async (client) => {
|
|
@@ -21,10 +34,11 @@ export class McpRuntimeClient {
|
|
|
21
34
|
}
|
|
22
35
|
async callTool(serverUrl, accessToken, name, args) {
|
|
23
36
|
return await this.withClient(serverUrl, accessToken, async (client) => {
|
|
37
|
+
const timeout = resolveToolRequestTimeoutMs(args);
|
|
24
38
|
return await client.callTool({
|
|
25
39
|
name,
|
|
26
40
|
arguments: args
|
|
27
|
-
});
|
|
41
|
+
}, undefined, timeout === undefined ? undefined : { timeout });
|
|
28
42
|
});
|
|
29
43
|
}
|
|
30
44
|
async withClient(serverUrl, accessToken, fn) {
|
|
@@ -70,6 +84,13 @@ export class McpRuntimeClient {
|
|
|
70
84
|
: "Run vibecodr login, or retry interactively to complete CLI MCP OAuth. CLI auth is separate from Codex, editor, ChatGPT, and other MCP client auth."
|
|
71
85
|
});
|
|
72
86
|
}
|
|
87
|
+
if (isMcpRequestTimeout(error)) {
|
|
88
|
+
throw new CliError("mcp.request_timeout", "The MCP request timed out before Vibecodr finished the operation.", EXIT_CODES.protocol, {
|
|
89
|
+
cause: error,
|
|
90
|
+
debugDetails: { code: ErrorCode.RequestTimeout },
|
|
91
|
+
nextStep: "If this was an import or publish, run vibecodr call resume_latest_publish_flow --json to pick up the operation without restarting."
|
|
92
|
+
});
|
|
93
|
+
}
|
|
73
94
|
throw new CliError("mcp.protocol", "Failed to complete the MCP request.", EXIT_CODES.protocol, {
|
|
74
95
|
cause: error,
|
|
75
96
|
nextStep: "Run vibecodr doctor to inspect auth, discovery, and connectivity."
|