yetuge 859d45db7e
fix(mcp): keep host paths out of the MCP config mutation 500 details (#7275)
* fix(mcp): keep host paths out of the MCP config mutation 500 details

The five MCP config mutation routes answered an unexpected failure with
`f"Failed to …: {str(e)}"`. Each one runs a read-modify-write of
`extensions_config.json` (`_apply_mcp_config_update`,
`_apply_mcp_servers_create`, `_apply_mcp_server_config_update`,
`_apply_mcp_server_delete`, `_apply_mcp_server_state_update`), so the error the
handler catches is usually an `OSError` from `atomic_write_extensions_config`
that names the absolute host path — the `DEER_FLOW_HOME` layout of the server.

The custom-agent, user-profile and skills-read routes already return fixed text
for this reason (#7255; `routers/AGENTS.md`: "agent config parse errors and
`OSError`s carry host paths and stay in the server log"). These five were the
remaining MCP mutation 500s on the same file, so they now return the fixed
detail and keep the exception in the existing log line.

Red first, on the unmodified `main` — all five put the planted host path in
`detail`:

    $ python -m pytest tests/test_mcp_config_error_details.py -q
    5 failed in 6.37s

After the change, 5 passed; the wider MCP suites (246 tests across
`blocking_io/test_mcp_router.py`, `test_mcp_config_secrets.py`,
`test_mcp_lifecycle*.py`) stay green.

* fix(mcp): normalize personal config mutation errors

---------

Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-10-23 07:20:21 +08:00
..