Skip to content

[Feature]: Add support for custom headers to enable multi-tenant testing #925 #37575

@lupuletic

Description

@lupuletic

Our platform serves multiple tenants from the same domain, with tenant isolation handled via HTTP headers rather than separate subdomains or paths.

Current Limitation

The Playwright MCP currently doesn't provide a way to set custom headers, which prevents us from testing different tenant contexts in our local development environment.

Proposed Feature

Enable the MCP agent to specify custom headers (specifically tenant identification headers) when initiating browser sessions or making requests.

Use Case

Multi-tenant testing: Switch between different tenant contexts during end-to-end tests
Local development: Test tenant-specific functionality without deploying to separate environments
CI/CD integration: Automate testing across multiple tenant configurations

Expected Behavior

The agent should be able to pass custom headers (e.g., X-Tenant-ID: tenant-123) that persist throughout the browser session, allowing seamless testing of tenant-specific features and workflows.
This enhancement would significantly improve our ability to perform comprehensive end-to-end testing in multi-tenant environments.

Many Thanks!

I had previously tried to implement this functionality on the PR here: microsoft/playwright-mcp#801 -- however, as part of moving the MCP within the playwright monorepo, I was going to raise a new PR

Example

No response

Motivation

Our platform serves multiple tenants from the same domain, with tenant isolation handled via HTTP headers rather than separate subdomains or paths.

The Playwright MCP currently doesn't provide a way to set custom headers, which prevents us from testing different tenant contexts in our local development environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    open-to-a-pull-requestThe feature request looks good, we are open to reviewing a PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions