fix(mcp): accept transport field as alias for type (#3238)#3243
fix(mcp): accept transport field as alias for type (#3238)#324318062706139fcz wants to merge 1 commit into
Conversation
DONE |
7148a01 to
27e125a
Compare
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
27e125a to
d7b319e
Compare
There was a problem hiding this comment.
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")onMcpServerConfigthat promotestransporttotypewhen onlytransportis set;typewins when both are present. - Add regression tests covering the alias for
sse/httpand 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 transport → type. |
| backend/tests/test_mcp_client_config.py | Adds regression tests for the alias and precedence behavior. |
Summary
Fixes #3238 — A remote MCP server configured with only
transport: ssewas misidentified asstdio(the default fortype) and failed at startup with:Root cause
McpServerConfigonly honoredtypeand defaulted it to"stdio". The official MCP configuration schema usestransportfor the same concept, so configurations following the spec were treated as stdio.Change
McpServerConfignow has amodel_validator(mode="before")that promotestransporttotypewhen onlytransportis provided.typeremains authoritative when both are set, so existing configurations are unaffected.sse/httpand the precedence rule.Test
Closes #3238