Connecting Claude Desktop with iTerm2 and Puppeteer via MCP Servers
This guide walks through setting up Claude Desktop as an MCP host, configuring iterm-mcp for terminal automation, and using a Puppeteer MCP server for web interaction, complete with step‑by‑step commands, troubleshooting examples, and practical insights for building AI agents.
Public MCP Server Lists
Several public MCP server registries can be used as back‑ends, for example: https://mcp.rpcx.io/ https://mcp.so/ https://github.com/punkpeye/awesome-mcp-servers
MCP Host Selection
Claude Desktop is used as the MCP host in the workflow, but other clients such as the VS Code plugin, the Zen editor, and DeepChat are also compatible.
Claude Desktop Installation
Download the appropriate installer from https://claude.ai/download and run it on macOS (the steps also apply to other operating systems). After launching the application, open the top‑most Settings menu and select Developer to view the currently configured MCP server.
Configuring an MCP Server
Click Edit Config to open the configuration file. Add an entry named iterm-mcp to register the iterm‑mcp server.
iterm-mcp: Terminal Integration
iterm‑mcp bridges large language models (LLMs) with the iTerm2 terminal emulator, enabling the model to execute and monitor shell commands. Its main properties are:
Efficient token usage – the model can request only the final lines of long‑running commands.
Natural integration – the model shares the iTerm screen, can query its contents, and delegate tasks step‑by‑step.
Full REPL control – the model can start a REPL, interact with it, and send control characters such as Ctrl‑C or Ctrl‑Z.
Minimal dependencies – it runs via npx and can be added to Claude Desktop or other MCP clients.
iterm‑mcp exposes three tools: write_to_terminal – writes a command to the active iTerm window and returns the number of output lines. read_terminal_output – reads a specified number of lines from the active iTerm window. send_control_character – sends a control character (e.g., Ctrl‑C) to the active iTerm window.
Requirements: iTerm2 must be running and Node 18+ is required.
npx -y @smithery/cli install iterm-mcp --client claudeExample: Drawing ASCII Art
Using Claude Desktop, the model is asked to draw a cute snake in ASCII art and write it to a file. The first attempt fails because the write operation returns an error. Claude reports the failure, then switches to a line‑by‑line echo approach, which succeeds and displays the snake. This demonstrates the model’s ability to diagnose its own error, choose an alternative method, and retry without human intervention.
Puppeteer MCP Server: Web Automation
The Puppeteer MCP server lets LLMs control a headless browser. Install it with: npx -y @modelcontextprotocol/server-puppeteer A prompt is given to Claude to open JD.com, search for the book “深入理解 Go 并发编程”, and add the item to the shopping cart:
打开京东商城,搜索《深入理解Go并发编程》一书,加入到购物车中。Claude decomposes the task into many subtasks, invoking Puppeteer tools to navigate the page, fill the search box, click results, and attempt to add the product to the cart. Because JD.com does not auto‑login, the final “add to cart” step fails. The author notes that the prompt should be adjusted to pause for manual login before proceeding.
Implications
Both iterm‑mcp and the Puppeteer server illustrate that once an LLM can issue commands to a terminal or a browser, it can effectively control a remote machine (given appropriate permissions). This capability forms a foundation for building more general AI agents capable of complex, multi‑modal workflows.
BirdNest Tech Talk
Author of the rpcx microservice framework, original book author, and chair of Baidu's Go CMC committee.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
