Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Sep 23, 2025

Summary

This PR fixes issue #8251 where the Playwright MCP server fails to start due to empty string arguments in its configuration.

Problem

The Playwright MCP server configuration from the marketplace API includes arguments with empty values:

  • --browser=
  • --headless=
  • --viewport-size=

These empty value arguments cause the Playwright MCP server to fail during startup.

Solution

Added a targeted fix in the SimpleInstaller that:

  1. Detects when installing the Playwright MCP server (by checking item.id === 'playwright')
  2. Filters out both empty strings ('') and arguments ending with = (empty value arguments)
  3. Preserves all valid arguments like -y and @playwright/mcp@latest

Testing

  • Added comprehensive test suite with 4 test cases covering:
    • Filtering empty arguments for Playwright
    • Not affecting other MCP servers
    • Handling missing args gracefully
    • Mixed empty and non-empty arguments
  • All existing tests pass without regression
  • Type checking and linting pass

Impact

  • Minimal risk: Fix only applies to Playwright MCP server installations
  • Backward compatible: Other MCP servers are unaffected
  • Well tested: Comprehensive test coverage ensures correctness

Fixes #8251


Important

Fixes Playwright MCP server startup issue by filtering out empty string and empty value arguments in SimpleInstaller.

  • Behavior:
    • In SimpleInstaller, filter out empty string arguments and arguments ending with = for Playwright MCP server.
    • Only affects Playwright MCP server, preserving other arguments like -y and @playwright/mcp@latest.
  • Testing:
    • Added SimpleInstaller.playwright.spec.ts with 4 test cases for filtering empty arguments, non-Playwright server handling, missing args, and mixed args.
    • Ensures no regression in existing tests.
  • Impact:
    • Minimal risk and backward compatible, only affecting Playwright MCP server installations.

This description was created by Ellipsis for a091768. You can customize this summary. It will automatically update as commits are pushed.

- Fixes issue #8251 where Playwright MCP server fails to start with empty string arguments
- Filters out both empty strings and arguments ending with = (like --browser=)
- Added comprehensive tests to verify the fix works correctly
- Does not affect other MCP servers, only applies to Playwright
@roomote roomote bot requested review from cte, jr and mrubens as code owners September 23, 2025 08:06
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Sep 23, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewing my own code is like debugging in production - technically possible but morally questionable.


// Fix for Playwright MCP server: filter out empty string arguments and arguments with empty values
// Issue #8251: Empty string arguments and arguments ending with '=' cause the Playwright MCP server to fail
if (item.id === "playwright" && mcpData.args && Array.isArray(mcpData.args)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider making this empty argument filtering more generic. While the fix correctly targets the Playwright MCP server, other MCP servers might face similar issues with empty value arguments. The test shows that other servers with similar patterns are left untouched.

Consider whether this filtering logic should be:

  • Applied to all MCP servers (with an opt-out list if needed)
  • Configurable via a property in the MarketplaceItem
  • At minimum, documented why it's Playwright-specific

if (item.id === "playwright" && mcpData.args && Array.isArray(mcpData.args)) {
// Filter out empty string arguments and arguments that end with '=' (empty value arguments)
mcpData.args = mcpData.args.filter((arg: any) => {
if (typeof arg !== "string") return true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good defensive programming checking for non-string arguments. Consider logging a warning when non-string arguments are encountered, as this might indicate a data quality issue from the marketplace API.

// Issue #8251: Empty string arguments and arguments ending with '=' cause the Playwright MCP server to fail
if (item.id === "playwright" && mcpData.args && Array.isArray(mcpData.args)) {
// Filter out empty string arguments and arguments that end with '=' (empty value arguments)
mcpData.args = mcpData.args.filter((arg: any) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider extracting this filtering logic into a separate private method like filterEmptyArguments(args: any[]): any[] for better readability and potential reuse.

url: "https://github.com/playwright/mcp",
content: JSON.stringify({
command: "npx",
args: ["-y", "", "@playwright/mcp@latest", "--browser=", "--headless=false", "", "--viewport-size="],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a test case for arguments that contain only whitespace (e.g., " ") to ensure they're handled appropriately.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Sep 23, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Sep 23, 2025
@daniel-lxs daniel-lxs closed this Sep 23, 2025
@github-project-automation github-project-automation bot moved this from PR [Needs Prelim Review] to Done in Roo Code Roadmap Sep 23, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Playwright in Marketplace installation issue

4 participants