Skip to content

HTTP session not found errors breaking Playwright MCP #2114

@danbarr

Description

@danbarr

Bug description

Starting with ToolHive v0.3.1, when using the Playwright MCP, the first tool call works but subsequent calls produce an HTTP 404 "Session not found" error.

Copilot (VS Code) seems to work itself around this:

Connection state: Error 404 status sending message to http://localhost:10679/mcp: Session not found; will retry with new session ID

But other clients like Claude Code and Roo Code just error:

Error executing MCP tool:
Error POSTing to endpoint (HTTP 404): Session not found

I rebuilt old versions to narrow this down, and the issue started with v0.3.1. In v0.3.0 and earlier, the MCP works as expected.

This issue is impacting the Playwright MCP since it uses persistent sessions to maintain browser state across calls, but presumably would impact other MCPs that rely on sessions.

Steps to reproduce

Run the Playwright MCP server from a known-working image (v0.0.36 was used to write and validate our usage guide in the docs and was known to be working at that time).

# Create a directory to mount for screenshot ouputs
mkdir ~/playwright-output

thv run --volume ~/playwright-output:/browser-output --name playwright mcr.microsoft.com/playwright/mcp:v0.0.36 --transport streamable-http --target-port 8931 -- --port 8931 --output-dir /browser-output

From a client, submit a prompt that calls multiple Playwright tools in succession:

Use Playwright to take a screenshot of https://toolhive.dev

Expected behavior

The agent should run three Playwright tools: browser_navigate, then browser_take_screenshot, and browser_close and save the screenshot PNG file to your mounted folder.

Actual behavior

The browser_navigate tool call works, but browser_take_screenshot fails with an HTTP 404.

Image

If you revert to thv v0.3.0 and re-run playwright, it works:

Image

Environment (if relevant)

  • ToolHive version: v0.3.1 though v0.3.7

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcliChanges that impact CLI functionalityproxy

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions