← Back to learning path
Case · Published

Codex x Playwright MCP: let AI operate a browser

Use Playwright MCP to open pages, interact with controls, inspect screenshots, and verify web state while keeping high-risk actions behind approval.

Source: recipes/03-playwright-mcp.md实战案例 (original language)
Chapter progress 0%Learning path progress 0% · 0/46 chapters completedContinue learning path →

Tip · Last checked

Official sources were checked on 2026-09-04. The MCP mechanism follows the Codex MCP documentation. This case uses microsoft/playwright-mcp. See the Playwright website for browser automation. Tool names, installation, and permissions can change; follow the upstream project.

Codex x Playwright MCP: let AI operate a browser

Playwright MCP exposes browser actions such as opening a page, navigating, clicking, filling fields, reading content, taking screenshots, and checking results as tools an AI agent can call. This lets a coding agent inspect whether a web workflow actually works.

This case uses the command line to install and exercise the server.

1. Install

codex mcp add playwright npx @playwright/mcp@latest

playwright-mcp-add-command

To verify the installation, open Codex and use the /mcp command to list the configured MCP servers.

playwright-mcp-server-list

playwright-mcp-list-command

2. Use it

After confirming the server, try a bounded research task:

  1. Open a browser and search for "What is MCP?".
  2. Read two relevant tutorials.
  3. Save a short summary to a local Markdown file.

For example:

Open a browser, search Baidu for "什么是 MCP", read two useful results, and save a concise Markdown summary in the current directory.

playwright-mcp-browser-search-prompt

The run may ask for permission to fill a search field, enter text, or open a page. Approve only the actions you understand.

playwright-mcp-permission-prompt

You should be able to observe the browser opening, searching, and visiting the selected pages.

playwright-mcp-baidu-search-results

The final result can be summarized and written to the local Markdown file.

playwright-mcp-collected-search-summary

playwright-mcp-markdown-file-created

References

The operation flow and demonstration scenario were also informed by this Bilibili video: Claude Code crash course with complete documents.

The screenshots are from the author's own operation. The text has been reorganized and rewritten; contact the site owner for removal requests.

Further reading

KnowledgeAI Agents: From Core Concepts to ProductionKnowledgeModel Serving in Production: GPU Inference, Queues, and Scaling
Product Hub Demo · V0.3