fix: MCP reconnect via tool passes only server_id to connect_server (#1385)
* fix: MCP reconnect via tool passes only server_id to connect_server connect_server requires name, transport, command, args, env, and url but the reconnect path in do_manage_mcp only passed the server_id, causing a TypeError on every reconnect attempt. Mirror the pattern used in mcp_routes.py reconnect_server. * test: verify MCP reconnect passes full server config to connect_server Mocks the MCP manager and DB to assert that do_manage_mcp reconnect passes name, transport, command, args, env, and url — not just the server_id.
This commit is contained in:
committed by
GitHub
parent
69d6fe44b3
commit
1f2a06facd
@@ -1215,7 +1215,17 @@ async def do_manage_mcp(content: str, owner: Optional[str] = None) -> Dict:
|
||||
try:
|
||||
srv = db2.query(McpServer).filter(McpServer.id == sid).first()
|
||||
if srv:
|
||||
await mcp.connect_server(sid)
|
||||
_args = json.loads(srv.args) if srv.args else []
|
||||
_env = json.loads(srv.env) if srv.env else {}
|
||||
await mcp.connect_server(
|
||||
server_id=sid,
|
||||
name=srv.name,
|
||||
transport=srv.transport,
|
||||
command=srv.command,
|
||||
args=_args,
|
||||
env=_env,
|
||||
url=srv.url,
|
||||
)
|
||||
st = mcp.get_server_status(sid)
|
||||
return {"response": f"Reconnected '{srv.name}' ({st.get('tool_count', 0)} tools)", "exit_code": 0}
|
||||
return {"error": f"Server {sid} not found", "exit_code": 1}
|
||||
|
||||
Reference in New Issue
Block a user