You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TL;DR: Clean up technical debt and modularize the MCP server into clear architectural layers, establishing the foundation for v0.2.0 performance improvements.
Context
Epic 1 of the v0.2.0 release cycle. The current MCP server (src/mcp/server.ts, 2223 LOC) mixes tool registration, browser lifecycle, error recovery, and execution logic in a single file. The cache subsystem spans 5 files with overlapping responsibilities (3788 LOC). Several test files reference code removed in PR #29 — npm test currently fails due to a hardcoded stale version check in tests/test-cli-commands.js:280.
This epic eliminates dead code, consolidates the cache subsystem, and introduces a layered server architecture. The result is a cleaner, smaller codebase that subsequent epics can iterate on safely.
Success Criteria
Server starts and accepts client connections within 3 seconds (measured)
All currently-working tools remain functional through the refactored entry point
Cache subsystem consolidated from 5 files to 1–2 files
Integration test covers the new server architecture end-to-end
npm test passes cleanly (no broken imports, no stale assertions)
Existing .mcp.json configurations continue to work without modification
v0.2.0-alpha.1 published to npm with @alpha tag
Scope
In Scope:
Remove artificial setTimeout delays from surviving modules
Delete obsolete test files; audit entire tests/ directory for broken imports and stale assertions
Consolidate overlapping cache modules into a coherent unit
Modularize MCP server into routing layer (src/proxy/) and execution layer
Delete protocol-validation modules (~933 LOC) replaced by SDK-level handling
Add integration test coverage for new architecture
Release v0.2.0-alpha.1
Out of Scope:
New features, new tools, new CLI commands (deferred to Epic 2–3)
Cache logic improvements or new caching strategies (deferred to Epic 2)
Session/scenario/profile tool ports (deferred to Epic 3)
README rewrite (deferred to Epic 4)
Public API migration guide (ships with v0.2.0 final in Epic 4)
Architecture Decisions
Binding for ALL sub-issues. Deviations require updating this section.
MCP SDK Server class (low-level): Use Server with setRequestHandler instead of McpServer.tool() — upstream tools use raw JSON Schema, not Zod schemas.
@playwright/mcp as execution layer: Pinned dependency (0.0.75). Resolved via require.resolve('@playwright/mcp/cli.js') — no network lookup per start. PoC verified 2026-05-18: 23 tools, 2.5s wall time.
Backward-compat shim:src/mcp/server.ts becomes a re-export to src/proxy/proxy-server.ts. dist/mcp/server.cjs stays valid for existing .mcp.json configs.
Node.js >= 18: Required by @playwright/mcp. Bump engines.node from >=16.
Cache consolidation = mechanical only: Inline files, do NOT improve cache logic. Epic 2 redesigns the cache. cache-migration.ts stays (needed for Epic 4).
TL;DR: Clean up technical debt and modularize the MCP server into clear architectural layers, establishing the foundation for v0.2.0 performance improvements.
Context
Epic 1 of the v0.2.0 release cycle. The current MCP server (
src/mcp/server.ts, 2223 LOC) mixes tool registration, browser lifecycle, error recovery, and execution logic in a single file. The cache subsystem spans 5 files with overlapping responsibilities (3788 LOC). Several test files reference code removed in PR #29 —npm testcurrently fails due to a hardcoded stale version check intests/test-cli-commands.js:280.This epic eliminates dead code, consolidates the cache subsystem, and introduces a layered server architecture. The result is a cleaner, smaller codebase that subsequent epics can iterate on safely.
Success Criteria
npm testpasses cleanly (no broken imports, no stale assertions).mcp.jsonconfigurations continue to work without modification@alphatagScope
In Scope:
setTimeoutdelays from surviving modulestests/directory for broken imports and stale assertionssrc/proxy/) and execution layerOut of Scope:
Architecture Decisions
Binding for ALL sub-issues. Deviations require updating this section.
Serverclass (low-level): UseServerwithsetRequestHandlerinstead ofMcpServer.tool()— upstream tools use raw JSON Schema, not Zod schemas.@playwright/mcpas execution layer: Pinned dependency (0.0.75). Resolved viarequire.resolve('@playwright/mcp/cli.js')— no network lookup per start. PoC verified 2026-05-18: 23 tools, 2.5s wall time.src/mcp/server.tsbecomes a re-export tosrc/proxy/proxy-server.ts.dist/mcp/server.cjsstays valid for existing.mcp.jsonconfigs.@playwright/mcp. Bumpengines.nodefrom>=16.cache-migration.tsstays (needed for Epic 4).protocol-validator.ts,protocol-validation-layer.ts,protocol-error-recovery.ts(~933 LOC) — replaced by SDK-level handling.browser_*prefix: All tools (local + execution layer) usebrowser_*for consistent discovery.tsup.config.ts: New entry forsrc/proxy/proxy-server.ts; add@playwright/mcpto externals in existing MCP entry.Sub-Issues
setTimeoutdelays fromtest-scenario-cache.tstests/for broken imports and stale assertionssrc/index.tsexportsParallelization: #36 and #37 can run in parallel (no file overlap). #38 should complete before #39.
References
src/mcp/server.ts,src/core/bidirectional-cache.ts,src/core/enhanced-cache-integration.ts,src/core/tiered-cache.ts,src/core/enhanced-cache-key.ts,src/core/context-aware-similarity.ts,src/core/protocol-*.tsfeature/v0.2.0Risks
tsupandtsc.@playwright/mcpinstability (v0.0.x) — breaking changes possible. Mitigation (Modularize MCP server into routing and execution layers #39): pin exact version0.0.75(PoC-verified).src/index.ts. Mitigation: acceptable for v0.2.0; migration guide in Epic 4.Dependencies
Audit Log
/check— format, content, technical feasibility, cross-issue consistency/check— re-audit with masterplan contextsubIssues).