Skip to content

fix(stdio): keep Appium and WebDriver logs off JSON-RPC stdout - #493

Open
Mochxd wants to merge 2 commits into
appium:mainfrom
Mochxd:fix/stdio-keep-jsonrpc-stdout
Open

fix(stdio): keep Appium and WebDriver logs off JSON-RPC stdout#493
Mochxd wants to merge 2 commits into
appium:mainfrom
Mochxd:fix/stdio-keep-jsonrpc-stdout

Conversation

@Mochxd

@Mochxd Mochxd commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes #492.

Stdio MCP clients (Cursor included) treat stdout as JSON-RPC. Appium info lines, XCUITest page source, and WebDriver ELEMENT dumps were ending up on that stream, so the client failed to parse even when the tool itself succeeded.

Pin npmlog to stderr, quiet the stdio CLI to warn before startup, and create/attach WebDriver clients with logLevel: warn.

@Mochxd

Mochxd commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

I dont know if it is the right way to solve the issue or something else but i am waiting the feedback..

Comment thread src/logger.ts Outdated
Comment thread src/utils/webdriver-client-options.ts
@Mochxd
Mochxd requested a review from KazuCocoa August 25, 2026 18:57
Comment thread src/utils/webdriver-client-options.ts
@Mochxd
Mochxd force-pushed the fix/stdio-keep-jsonrpc-stdout branch from ad3ace1 to 5309ffc Compare August 26, 2026 17:44
@Mochxd

Mochxd commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@KazuCocoa sorry for the force push :(( had some trouble pushing the branch and ended up squashing everything into one commit to get it through..the latest update should cover the programmatic stdio path (server.start() configures logging when transportType is stdio)so let me know if anything still looks off

@Mochxd
Mochxd requested a review from KazuCocoa August 26, 2026 17:46
@KazuCocoa

KazuCocoa commented Aug 27, 2026

Copy link
Copy Markdown
Member

The last one:

[P2] Update already-created WDIO loggers for programmatic stdio

By the time server.start() reaches this call, importing appium-mcp/core has already loaded webdriver and @wdio/utils, so their loggers were created at the default info level. Setting WDIO_LOG_LEVEL=warn here is too late for those existing loggers, and withQuietWebDriverLogging() only updates the webdriver logger. I reproduced the programmatic stdio path and still got INFO @wdio/utils: Connecting to existing driver... on stdout, which corrupts JSON-RPC.

Please update all existing WDIO loggers when stdio is configured, or defer the WebDriver imports until after this configuration runs. A child-process regression test should start the core server with stdio, trigger a remote session, and assert that stdout contains only JSON-RPC.


This could be valid. This PR may need to add @wdio/logger as well

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.

stdio: logs and driver dumps leak onto stdout and break MCP JSON-RPC clients

2 participants