{
  "$type": "site.standard.document",
  "content": "---\ntitle: \"Fixing slow Zed agent startup times\"\ndescription: \"Claude Code sessions in Zed were taking 30 seconds to start. The culprit: npx\n  fetching Playwright MCP on every launch. The fix involves global installs and\n  mise shims.\"\ntags:\n  - ai\n  - dev\n---\n\nI've been using [Claude Code](https://github.com/anthropics/claude-code) via\n[ACP](https://modelcontextprotocol.io/docs/concepts/architecture#agent-control-protocol)\n(Agent Control Protocol) in [Zed](https://zed.dev/), and while the integration\nis brilliant, starting a new Claude session took noticeably longer in Zed than\nrunning `claude` directly in the terminal; ~30s vs about 5s. And it was\nparticularly frustrating because there's no `/clear` slash command via ACP. The\nonly way to clear the context, which I do _all the time_, is to re-start the\nagent, which (because of the delay) breaks my flow.\n\n## Digging into the diagnosis\n\nLooking into it,\n[issue #13329](https://github.com/anthropics/claude-code/issues/13329) documents\nhow MCP server initialisation blocks session creation. One user had measured\ntheir setup taking 32+ seconds just waiting for MCP servers to initialise. Seems\nlike just the issue I was having.\n\nSo I checked my local MCP configuration. I have a few servers \"globally\"\nconfigured for all projects on this machine:\n\n- [`@playwright/mcp`](https://github.com/microsoft/playwright/tree/main/packages/playwright-mcp)\n  for browser automation\n- [`backlog`](https://github.com/ckreiling/backlog.md) for task management\n- [`ht-mcp`](https://github.com/benswift/ht-mcp) for headless terminal access\n\nI ran some timing tests and found the smoking gun: `@playwright/mcp` was being\ninvoked via `npx @playwright/mcp@latest`, so it checks the npm registry every\ntime and potentially downloads packages. Meanwhile, the other MCP servers\n(backlog and ht-mcp) were fast, because they were already installed globally and\nbeing invoked directly as binaries. Playwright was the outlier, and it was\ndragging down every single session startup.\n\n## The fix\n\nI implemented a three-part fix:\n\n### 1. Install Playwright MCP globally\n\nInstead of relying on `npx` to fetch it every time, install it globally:\n\n```bash\nnpm install -g @playwright/mcp\n```\n\n### 2. Add mise shims to PATH for non-interactive contexts\n\nHere's where things got interesting. My [mise](https://mise.jdx.dev/) setup was\nworking fine in the terminal (where I have `mise activate zsh` in my `.zshrc`),\nbut IDEs like Zed don't run interactive shells---they use non-interactive\ncontexts that skip `.zshrc` entirely[^shell-contexts].\n\n[^shell-contexts]:\n    This is standard Unix behaviour. Interactive shells source `.zshrc` (or\n    `.bashrc` for bash), but non-interactive shells only source `.zshenv` (or\n    `.bash_profile`). IDEs, MCP servers, and other tools that spawn processes\n    typically use non-interactive contexts.\n\nThe solution is mise's recommended hybrid approach: add the mise shims directory\nto PATH in `.zshenv` (which is sourced for all contexts), while keeping\n`mise activate` in `.zshrc` for interactive shells:\n\n```bash\n# .zshenv (sourced for all shell contexts)\nexport PATH=\"$HOME/.local/share/mise/shims:$PATH\"\n\n# .zshrc (sourced for interactive shells only)\neval \"$(mise activate zsh)\"\n```\n\nThis ensures that globally-installed npm packages are available to MCP servers\nspawned by Zed, without sacrificing the nice interactive shell features that\n`mise activate` provides.\n\n### 3. Update MCP config\n\nFinally, update the MCP configuration to use the binary directly instead of\ngoing through `npx`:\n\n```json\n{\n  \"mcpServers\": {\n    \"playwright\": {\n      \"command\": \"mcp-server-playwright\"\n    }\n  }\n}\n```\n\n## The outcome\n\nIt's still not instant, but it is faster---the pause that was breaking my\nflow is (closer to) gone.\n\nThe broader lesson: `npx` is convenient for one-off commands, but a terrible\nchoice for anything that runs frequently. Global installation\nplus direct binary invocation is the way to go for tools you use\nregularly[^npx-tradeoffs]. And if you're using mise (or any other tool version\nmanager like [asdf](https://asdf-vm.com/) or [rtx](https://github.com/jdx/rtx)),\nremember that non-interactive contexts need explicit PATH configuration---IDEs\nand MCP servers don't get the benefits of your shell's interactive setup\nautomatically.\n\n[^npx-tradeoffs]:\n    The trade-off is that you now need to update these packages manually\n    (`npm update -g @playwright/mcp`) rather than getting the latest version\n    automatically. For rapidly-evolving tools that's a real consideration, but\n    for stable packages the performance gain is worth it.\n",
  "createdAt": "2026-05-13T23:14:42.028Z",
  "description": "Claude Code sessions in Zed were taking 30 seconds to start. The culprit: npx fetching Playwright MCP on every launch. The fix involves global installs and mise shims.",
  "path": "/blog/2025/12/17/fixing-slow-zed-agent-startup-times",
  "publishedAt": "2025-12-17T00:00:00.000Z",
  "site": "at://did:plc:tevykrhi4kibtsipzci76d76/site.standard.publication/self",
  "tags": [
    "ai",
    "dev"
  ],
  "textContent": "Claude Code sessions in Zed were taking 30 seconds to start. The culprit: npx fetching Playwright MCP on every launch. The fix involves global installs and mise shims.",
  "title": "Fixing slow Zed agent startup times"
}