Playwright
STDIO基于Playwright的网页自动化MCP服务器
基于Playwright的网页自动化MCP服务器
\A MCP server with playwright tools\
The server implements a simple note storage system with:
The server provides a single prompt:
The server implements the following tools:
playwright_navigate: Navigates to a specified URL. This operation will automatically create a new session if there is no active session.
url argument (string).playwright_screenshot: Takes a screenshot of the current page or a specific element.
name argument (string) for the screenshot file name.selector argument (string) to specify a CSS selector for the element to screenshot. If no selector is provided, a full-page screenshot is taken.playwright_click: Clicks an element on the page using a CSS selector.
selector argument (string) to specify the CSS selector for the element to click.playwright_fill: Fills out an input field.
selector argument (string) to specify the CSS selector for the input field.value argument (string) to specify the value to fill.playwright_evaluate: Executes JavaScript code in the browser console.
script argument (string) to specify the JavaScript code to execute.playwright_click_text: Clicks an element on the page by its text content.
text argument (string) to specify the text content of the element to click.playwright_get_text_content: Get the text content of all visiable elements.playwright_get_html_content: Get the HTML content of the page.
selector argument (string) to specify the CSS selector for the element.[TODO: Add configuration details specific to your implementation]
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
To prepare the package for distribution:
uv sync
uv build
This will create source and wheel distributions in the dist/ directory.
uv publish
Note: You'll need to set PyPI credentials via environment variables or command flags:
--token or UV_PUBLISH_TOKEN--username/UV_PUBLISH_USERNAME and --password/UV_PUBLISH_PASSWORDSince MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory C:\Users\YUNYING\Documents\project\python\mcp\playwright-server run playwright-server
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.