fix: preserve MCP tool names#2402
Open
LittleChenLiya wants to merge 4 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts MCP tool loading so DeerFlow preserves the original external MCP tool names (e.g., click_element, input_text) rather than prefixing them with the MCP server name, aligning DeerFlow’s exposed tool names with other MCP clients and fixing skills that expect the unprefixed names.
Changes:
- Disable
tool_name_prefixwhen constructingMultiServerMCPClientso MCP tools keep their original names. - Add a regression assertion ensuring MCP client initialization is performed with
tool_name_prefix=False.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| backend/packages/harness/deerflow/mcp/tools.py | Stops prefixing MCP tool names by passing tool_name_prefix=False to MultiServerMCPClient. |
| backend/tests/test_mcp_sync_wrapper.py | Adds an assertion to lock in the expected MCP client initialization behavior. |
1dfa764 to
9755536
Compare
Collaborator
Author
|
已重新基于最新 main 收窄并解决冲突。 这次保留了主线新增的 persistent MCP session、OAuth/custom interceptor 逻辑,内部仍使用 tool_name_prefix=True 来定位 server;对外暴露工具名时只在原始名称无冲突的情况下去掉 server 前缀,如果多个 server 暴露同名工具则继续保留前缀避免碰撞。 验证:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题原因
DeerFlow 初始化 MCP client 时启用了 server name 前缀,导致外部 MCP 工具名从
click_element、input_text变成server_click_element、server_input_text。依赖原始工具名的 skill 会认为工具不可用。修改内容
测试
uvx ruff check .、uvx ruff format --check .通过。uv run python -m pytest tests/test_mcp_sync_wrapper.py -v通过。pytest仍受符号链接/路径相关已知失败影响。关联 issue
fix #2399
Problem Cause
DeerFlow enabled the server name prefix when initializing the MCP client, changing external MCP tool names from
click_elementandinput_texttoserver_click_elementandserver_input_text. Skills that depend on the original tool names would treat those tools as unavailable.Changes
Tests
uvx ruff check .anduvx ruff format --check .passed.uv run python -m pytest tests/test_mcp_sync_wrapper.py -vpassed.pytestis still affected by known symlink/path-related failures.Related Issue
Fixes #2399