-
Notifications
You must be signed in to change notification settings - Fork 0
Use official Playwright MCP server in .vscode/mcp.json (#203) #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nnoce14
wants to merge
17
commits into
main
Choose a base branch
from
issue/203-playwright-mcp
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
56daaff
Use official Playwright MCP server in .vscode/mcp.json
nnoce14 63d2e2d
chore: upgrade vite to fix audit vulnerability
nnoce14 7386b64
Configure Playwright MCP (stdio) and remove http variant
nnoce14 e581424
Add repo-level Copilot MCP config and install script
nnoce14 6d89558
docs(mcp): add .github/mcp README and verification script; prefer ins…
nnoce14 31b802c
chore: commit pnpm-lock.yaml
nnoce14 a09f4c1
ci(mcp): start Playwright MCP and install repo mcp-config in copilot …
nnoce14 65d803e
chore(mcp): add safe installer for mcp-config and use it in CI\n\nCre…
nnoce14 a7b234e
ci(mcp): align pnpm action version with package.json (10.30.1)\n\nEns…
nnoce14 60a0c31
Merge origin/main into issue/203-playwright-mcp: resolve merge confli…
nnoce14 cc43df0
chore: resolve audit vulnerability for axios
nnoce14 e353dc4
chore: fix sonar scan memory issue on CI pipeline
nnoce14 82dbff5
chore(ci): pin @playwright/mcp version to 1.59.0 in workflow\n\nCo-au…
nnoce14 4ccf9c1
chore(mcp): pin @playwright/mcp to 0.0.70 across workflow and configs…
nnoce14 af5901a
chore(mcp): centralize MCP start script; ignore unknown flags in inst…
nnoce14 3c49ffb
chore(mcp): remove unused .github/mcp/run_login.mjs to satisfy knip
nnoce14 d3208f1
Merge branch 'main' into issue/203-playwright-mcp
nnoce14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "mcpServers": { | ||
| "playwright": { | ||
| "type": "stdio", | ||
| "command": "npx", | ||
| "args": ["@playwright/mcp@0.0.70"], | ||
| "tools": ["*"] | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # Playwright MCP — Agent & Developer Guidance | ||
|
|
||
| This folder documents how to use the Playwright MCP server for Copilot/agents and local development. | ||
|
|
||
| Key points: | ||
| - The verification script used during testing was temporary. It's not required every time. | ||
| - The canonical MCP config for this repo is `.copilot/mcp-config.json` (committed). Copilot CLI reads `~/.copilot/mcp-config.json`. | ||
|
|
||
| Recommended developer steps (manual): | ||
| 1. Install the repo MCP config into your home directory (non-destructive): | ||
|
|
||
| pnpm run mcp:install-config | ||
|
|
||
| This copies `./.copilot/mcp-config.json` to `~/.copilot/mcp-config.json` if you don't already have one. | ||
|
|
||
| 2. Start the Playwright MCP server (HTTP, programmatic): | ||
|
|
||
| pnpm run mcp:playwright:start | ||
|
|
||
| (For editor/stdio usage, use `pnpm run mcp:playwright:stdio`.) | ||
|
|
||
| 3. Start the dev stack (portless mapping): | ||
|
|
||
| pnpm run dev | ||
|
|
||
| 4. Optional manual verification (headless): | ||
|
|
||
| node .github/mcp/run_login.mjs | ||
|
|
||
| This script is a convenience for maintainers to verify a headless login flow. It is not required for agents to function. | ||
|
|
||
| Guidance for automation/CI: | ||
| - Prefer using the HTTP MCP server (`--port 8931`) for CI and programmatic checks. | ||
| - Avoid automatically overwriting users' `~/.copilot/mcp-config.json` in postinstall hooks. Prefer documented, explicit steps (as above). | ||
|
|
||
| If you want a packaged automation for agents, prefer creating a small GitHub Actions workflow that starts the MCP on a runner and uses it for tests, rather than forcing local machine changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| #!/usr/bin/env node | ||
| import fs from 'fs/promises'; | ||
| import path from 'path'; | ||
| import os from 'os'; | ||
|
|
||
| const argv = process.argv.slice(2).filter(a => a !== '--'); | ||
|
|
||
| function printUsage() { | ||
| console.log(`Usage: node install-config.js [--force] [--source <path>]\n\nOptions:\n --force, -f Overwrite existing config without creating a backup\n --source, -s Path to source mcp-config.json (defaults to ./.copilot/mcp-config.json in the repo)\n --help, -h Show this help message\n\nNote: Unknown extra arguments are ignored to allow wrapper passthrough.`); | ||
| } | ||
|
|
||
| let force = false; | ||
| let source = null; | ||
|
|
||
| for (let i = 0; i < argv.length; i++) { | ||
| const a = argv[i]; | ||
| if (a === '--force' || a === '-f') { | ||
| force = true; | ||
| } else if (a === '--source' || a === '-s') { | ||
| const val = argv[i + 1]; | ||
| if (!val || val.startsWith('-')) { | ||
| console.error('Error: --source requires a path argument'); | ||
| printUsage(); | ||
| process.exit(1); | ||
| } | ||
| source = val; | ||
| i++; | ||
| } else if (a === '--help' || a === '-h') { | ||
| printUsage(); | ||
| process.exit(0); | ||
| } else { | ||
| console.warn('Warning: Ignoring unknown argument:', a); | ||
| // Allow passthrough of extra args from wrappers; ignore unknown flags | ||
| continue; | ||
| } | ||
| } | ||
|
|
||
| if (!source) { | ||
| source = path.resolve(process.cwd(), '.copilot', 'mcp-config.json'); | ||
| } else { | ||
| source = path.resolve(process.cwd(), source); | ||
| } | ||
|
|
||
| async function exists(p) { | ||
| try { await fs.access(p); return true } catch { return false } | ||
| } | ||
|
|
||
| async function main(){ | ||
| try { | ||
| if (!await exists(source)){ | ||
| console.error(`Source config not found at ${source}`); | ||
| process.exit(2); | ||
| } | ||
|
|
||
| const destDir = path.join(os.homedir(), '.copilot'); | ||
| const destFile = path.join(destDir, 'mcp-config.json'); | ||
|
|
||
| await fs.mkdir(destDir, { recursive: true }); | ||
|
|
||
| if (await exists(destFile)){ | ||
| if (force){ | ||
| console.log('Overwriting existing config due to --force'); | ||
| } else { | ||
| const timestamp = new Date().toISOString().replace(/[:.]/g, '-'); | ||
| const backupPath = `${destFile}.${timestamp}.bak`; | ||
| await fs.copyFile(destFile, backupPath); | ||
| console.log(`Existing config backed up to ${backupPath}`); | ||
| } | ||
| } | ||
|
|
||
| await fs.copyFile(source, destFile); | ||
| console.log(`Installed MCP config from ${source} to ${destFile}`); | ||
| process.exit(0); | ||
| } catch (err){ | ||
| console.error('Failed to install MCP config:', err); | ||
| process.exit(1); | ||
| } | ||
| } | ||
|
|
||
| main(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.