@lobehub/chat 1.96.19 → 1.96.20
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/.env.example +7 -0
- package/CHANGELOG.md +25 -0
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/src/libs/mcp/client.ts +10 -2
package/.env.example
CHANGED
@@ -232,3 +232,10 @@ OPENAI_API_KEY=sk-xxxxxxxxx
|
|
232
232
|
|
233
233
|
# Specify the Embedding model and Reranker model(unImplemented)
|
234
234
|
# DEFAULT_FILES_CONFIG="embedding_model=openai/embedding-text-3-small,reranker_model=cohere/rerank-english-v3.0,query_mode=full_text"
|
235
|
+
|
236
|
+
########################################
|
237
|
+
########## MCP Service Config ##########
|
238
|
+
########################################
|
239
|
+
|
240
|
+
# MCP tool call timeout (milliseconds)
|
241
|
+
# MCP_TOOL_TIMEOUT=60000
|
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,31 @@
|
|
2
2
|
|
3
3
|
# Changelog
|
4
4
|
|
5
|
+
### [Version 1.96.20](https://github.com/lobehub/lobe-chat/compare/v1.96.19...v1.96.20)
|
6
|
+
|
7
|
+
<sup>Released on **2025-07-08**</sup>
|
8
|
+
|
9
|
+
#### 💄 Styles
|
10
|
+
|
11
|
+
- **misc**: Add `MCP_TOOL_TIMEOUT` env and improve debug usage guide.
|
12
|
+
|
13
|
+
<br/>
|
14
|
+
|
15
|
+
<details>
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
17
|
+
|
18
|
+
#### Styles
|
19
|
+
|
20
|
+
- **misc**: Add `MCP_TOOL_TIMEOUT` env and improve debug usage guide, closes [#8357](https://github.com/lobehub/lobe-chat/issues/8357) ([d4baae5](https://github.com/lobehub/lobe-chat/commit/d4baae5))
|
21
|
+
|
22
|
+
</details>
|
23
|
+
|
24
|
+
<div align="right">
|
25
|
+
|
26
|
+
[](#readme-top)
|
27
|
+
|
28
|
+
</div>
|
29
|
+
|
5
30
|
### [Version 1.96.19](https://github.com/lobehub/lobe-chat/compare/v1.96.18...v1.96.19)
|
6
31
|
|
7
32
|
<sup>Released on **2025-07-07**</sup>
|
package/changelog/v1.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.96.
|
3
|
+
"version": "1.96.20",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
package/src/libs/mcp/client.ts
CHANGED
@@ -11,6 +11,12 @@ import debug from 'debug';
|
|
11
11
|
import { MCPClientParams, McpTool } from './types';
|
12
12
|
|
13
13
|
const log = debug('lobe-mcp:client');
|
14
|
+
// MCP tool call timeout (milliseconds), configurable via the environment variable MCP_TOOL_TIMEOUT, default is 60000
|
15
|
+
// Parse MCP_TOOL_TIMEOUT, only use if it's a valid positive number, otherwise fallback to default 60000
|
16
|
+
const MCP_TOOL_TIMEOUT = (() => {
|
17
|
+
const val = Number(process.env.MCP_TOOL_TIMEOUT);
|
18
|
+
return Number.isFinite(val) && val > 0 ? val : 60_000;
|
19
|
+
})();
|
14
20
|
|
15
21
|
export class MCPClient {
|
16
22
|
private mcp: Client;
|
@@ -87,8 +93,10 @@ export class MCPClient {
|
|
87
93
|
}
|
88
94
|
|
89
95
|
async callTool(toolName: string, args: any) {
|
90
|
-
log('Calling tool: %s with args: %O', toolName, args);
|
91
|
-
const result = await this.mcp.callTool({ arguments: args, name: toolName }
|
96
|
+
log('Calling tool: %s with args: %O, timeout: %O', toolName, args, MCP_TOOL_TIMEOUT);
|
97
|
+
const result = await this.mcp.callTool({ arguments: args, name: toolName }, undefined, {
|
98
|
+
timeout: MCP_TOOL_TIMEOUT,
|
99
|
+
});
|
92
100
|
log('Tool call result: %O', result);
|
93
101
|
return result;
|
94
102
|
}
|