Skip to content

Conversation

@AB498
Copy link
Contributor

@AB498 AB498 commented Feb 7, 2025

Detached Frame Error Fix and Puppeteer Launch Arguments Support

Description

This PR fixes the "detached Frame" error (MCP error -32603: Attempted to use detached Frame 'D9B4203EF8575FD5A6ABAFC77F0F8E18') encountered in the MCP tool. Additionally, it adds support for specifying Puppeteer launch arguments, improving flexibility when initializing browser instances.

Server Details

  • Server: modelcontextprotocol/servers
  • Changes to: MCP execution flow and Puppeteer browser launch configuration

Motivation and Context

  • The detached frame error caused failures in MCP tool execution, preventing some interactions.
  • Allowing Puppeteer launch arguments gives users control over headless mode, debugging, and other configurations.

How Has This Been Tested?

  • Tested with an MCP client under various execution flows.
  • Verified Puppeteer arguments work as expected with different browser setups.

Breaking Changes

  • No breaking changes expected. The fix ensures stability without altering existing APIs.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Protocol Documentation
  • My changes follow MCP security best practices
  • I have updated the server's README accordingly
  • I have tested this with an LLM client
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have documented all environment variables and configuration options

Additional Context

  • Puppeteer launch arguments can now be configured via environment variables.
  • The fix ensures that MCP no longer attempts to interact with detached frames.

@AB498 AB498 changed the title fix: detached frame error & add Puppeteer launch args fix: detached frame error & feature: Puppeteer launch arguments support Feb 7, 2025
@kavukcutolga
Copy link

I have this issue, is the fix going to be merged ?

@olaservo olaservo added server-puppeteer bug Something isn't working enhancement New feature or request and removed enhancement New feature or request labels Mar 27, 2025
Copy link
Member

@olaservo olaservo left a comment

Choose a reason for hiding this comment

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

Thanks for fixing the detached frame error and for adding args support! If we do include the args input here as well, could you also add a note to the Readme about this feature, something like:

### Launch Arguments
The server supports configuring Puppeteer launch options:

- **headless** (boolean): Run browser in headless mode
  Example:
  ```json
  {
    "url": "https://example.com",
    "args": {
      "headless": true
    }
  }

@AB498 AB498 reopened this Mar 29, 2025
@olaservo
Copy link
Member

I think besides the potential edge case I mentioned this is looking good and I will keep an eye out to merge.

@olaservo olaservo merged commit d739c00 into modelcontextprotocol:main Mar 30, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants