mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(tools): send mcp-server startup diagnostics to stderr
idf.py mcp-server printed startup, shutdown, and error messages on stdout. On the stdio MCP transport, stdout is the JSON-RPC channel, so those non-JSON lines can confuse or break strict clients. Route them to stderr like the other diagnostics in mcp_ext.py. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -437,15 +437,16 @@ def action_extensions(base_actions: dict, project_path: str) -> dict:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f'Error getting devices: {str(e)}'
|
return f'Error getting devices: {str(e)}'
|
||||||
|
|
||||||
# Start the MCP server
|
# Start the MCP server. Diagnostics should go to stderr — stdout is reserved
|
||||||
print('MCP Server running on stdio...')
|
# for the JSON-RPC transport and any non-JSON bytes can confuse MCP clients.
|
||||||
|
print('MCP Server running on stdio...', file=sys.stderr)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
mcp.run()
|
mcp.run()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print('\nMCP Server stopped.')
|
print('\nMCP Server stopped.', file=sys.stderr)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f'MCP Server error: {e}')
|
print(f'MCP Server error: {e}', file=sys.stderr)
|
||||||
|
|
||||||
# Return the action extension
|
# Return the action extension
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user