Skip to content

Commit 1d63d4d

Browse files
authored
feat: support "MCP Servers config" configuring during use (#88)
1 parent 6778029 commit 1d63d4d

File tree

4 files changed

+28
-3
lines changed

4 files changed

+28
-3
lines changed

tools/mcp_call_tool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class McpTool(Tool):
1313

1414
def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage]:
15-
servers_config_json = self.runtime.credentials.get("servers_config", "")
15+
servers_config_json = tool_parameters.get("servers_config") or self.runtime.credentials.get("servers_config")
1616
if not servers_config_json:
1717
raise ValueError("Please fill in the servers_config")
1818
try:

tools/mcp_call_tool.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,16 @@ parameters:
3434
en_US: Tool arguments (JSON string in the python dict[str, Any] format).
3535
zh_Hans: 工具的参数。
3636
llm_description: Tool arguments (JSON string in the python dict[str, Any] format).
37+
form: llm
38+
- name: servers_config
39+
type: string
40+
required: false
41+
label:
42+
en_US: MCP Servers config
43+
zh_Hans: MCP 服务配置
44+
human_description:
45+
en_US: MCP Servers config, support multiple MCP services.
46+
(Optional, Filling in this field will overwrite the MCP Servers config entered during authorization.)
47+
zh_Hans: MCP服务配置,支持多个MCP服务。
48+
(选填,填写后将覆盖授权时填写的MCP服务配置。)
3749
form: llm

tools/mcp_list_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
class McpTool(Tool):
1313

1414
def _invoke(self, tool_parameters: dict[str, Any]) -> Generator[ToolInvokeMessage]:
15-
servers_config_json = self.runtime.credentials.get("servers_config", "")
15+
servers_config_json = tool_parameters.get("servers_config") or self.runtime.credentials.get("servers_config")
1616
if not servers_config_json:
1717
raise ValueError("Please fill in the servers_config")
1818
try:

tools/mcp_list_tools.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,17 @@ description:
1111
llm: Fetch MCP Server tools list (Gets a list of MCP tools in addition to existing tools).
1212
extra:
1313
python:
14-
source: tools/mcp_list_tools.py
14+
source: tools/mcp_list_tools.py
15+
parameters:
16+
- name: servers_config
17+
type: string
18+
required: false
19+
label:
20+
en_US: MCP Servers config
21+
zh_Hans: MCP 服务配置
22+
human_description:
23+
en_US: MCP Servers config, support multiple MCP services.
24+
(Optional, Filling in this field will overwrite the MCP Servers config entered during authorization.)
25+
zh_Hans: MCP服务配置,支持多个MCP服务。
26+
(选填,填写后将覆盖授权时填写的MCP服务配置。)
27+
form: llm

0 commit comments

Comments
 (0)