Skip to content

fix(mcp): accept transport field as alias for type (#3238)#3243

Open
18062706139fcz wants to merge 1 commit into
bytedance:mainfrom
18062706139fcz:fix/mcp-transport-field-3238
Open

fix(mcp): accept transport field as alias for type (#3238)#3243
18062706139fcz wants to merge 1 commit into
bytedance:mainfrom
18062706139fcz:fix/mcp-transport-field-3238

Conversation

@18062706139fcz
Copy link
Copy Markdown

Summary

Fixes #3238 — A remote MCP server configured with only transport: sse was misidentified as stdio (the default for type) and failed at startup with:

Failed to configure MCP server: with stdio transport requires 'command' field

Root cause

McpServerConfig only honored type and defaulted it to "stdio". The official MCP configuration schema uses transport for the same concept, so configurations following the spec were treated as stdio.

Change

  • McpServerConfig now has a model_validator(mode="before") that promotes transport to type when only transport is provided. type remains authoritative when both are set, so existing configurations are unaffected.
  • Added regression tests covering the alias for sse/http and the precedence rule.

Test

cd backend && uv run pytest tests/test_mcp_client_config.py -q
# 13 passed

Closes #3238

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 26, 2026

CLA assistant check
All committers have signed the CLA.

@18062706139fcz
Copy link
Copy Markdown
Author

CLA assistant check Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

ryker seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

DONE

@18062706139fcz 18062706139fcz force-pushed the fix/mcp-transport-field-3238 branch from 7148a01 to 27e125a Compare May 29, 2026 03:16
The official MCP configuration schema uses `transport` to specify the
transport mechanism (stdio/sse/http), but `McpServerConfig` only honored
`type` and defaulted to `stdio`. Remote MCP servers configured with just
`transport: sse` were therefore misidentified as stdio and failed with
"with stdio transport requires 'command' field".

Add a model validator that promotes `transport` to `type` when only
`transport` is provided, while keeping `type` authoritative when both
are set. This matches the MCP-spec field name without breaking existing
configurations.

Fixes bytedance#3238
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes #3238 by accepting the MCP spec's transport field as an alias for the project's type field on McpServerConfig, so remote SSE/HTTP servers configured with only transport: sse are no longer misidentified as stdio.

Changes:

  • Add a Pydantic model_validator(mode="before") on McpServerConfig that promotes transport to type when only transport is set; type wins when both are present.
  • Add regression tests covering the alias for sse/http and the precedence rule.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
backend/packages/harness/deerflow/config/extensions_config.py Adds _accept_transport_alias before-validator to normalize transporttype.
backend/tests/test_mcp_client_config.py Adds regression tests for the alias and precedence behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] MCP SSE 远程服务配置transport: sse被错误识别为 stdio 传输

3 participants