MCP Directory

Claude Code Subagents: When They Help (and When They Hurt)

Claude Code subagents are best used as narrowly scoped workers with only the MCP access their task requires, not as a default layer for every coding job.

MCP Directory·August 4, 2026·7 min read
A smartphone shows a ChatGPT interface placed on an Apple laptop in a leafy environment.
Photo by Solen Feyissa on Pexels

Claude Code subagents help when a self-contained task would pollute the main context or needs tightly scoped MCP access; they hurt when work depends on shared history, rapid feedback, or coordinated edits. Today, a custom subagent can inherit session MCP tools, reference a configured server, or start an inline server that only it can see.

Table of contents

The short answer

Use Claude Code subagents for bounded research, review, testing, or log-heavy work, especially when one worker needs an MCP server the parent should not load. Keep quick edits and context-dependent implementation in the main conversation, because delegation adds a new context, another model run, startup delay, and a summary boundary.

That distinction matters more than the number of agents. Anthropic describes subagents as separate workers with their own context window, system prompt, tool access, and permissions; only their result returns to the parent. The official Claude Code subagent documentation specifically recommends them for work that would otherwise fill the main context with searches, logs, or file contents.

Our view at MCP Directory is simple: start with one specialist and one job. A read-only reviewer, browser checker, or incident investigator earns its overhead; a generic “do everything” subagent usually duplicates the parent and makes failures harder to trace. If you are still choosing a Claude surface, see the Claude MCP client guide.

How it works today

A Claude Code subagent is a Markdown definition with YAML frontmatter, stored per project in .claude/agents/ or for all projects in ~/.claude/agents/. Claude can delegate automatically from the description, or you can name or @-mention the agent explicitly.

The useful MCP mechanism is the mcpServers field. According to Anthropic’s current scoping reference, each list item can be either a string naming a server already configured in the session or an inline server definition. A string reuses the parent connection; an inline definition connects when the worker starts and disconnects when it finishes.

This creates three practical patterns:

  • Inherited tools: the subagent receives MCP tools already available to the parent, subject to its tool restrictions.
  • Named reference: adding - github under mcpServers shares the configured github connection.
  • Inline server: the server exists only for that agent, so its tool descriptions do not occupy the parent’s context.

MCP itself still follows a host-client-server architecture: the host manages permissions and context, while a client maintains a connection to each server. The MCP architecture guide is the cleanest explanation of that boundary. A subagent is not an MCP server and MCP does not create the subagent; Claude Code orchestrates both.

Step-by-step setup

The safest setup is a project-scoped, read-focused agent with one inline server. Use the vendor-documented Playwright example below, then widen access only after the workflow proves useful.

  1. Create the agent file. Add .claude/agents/browser-checker.md in the repository. Use ~/.claude/agents/browser-checker.md only if you deliberately want the definition available across projects.

  2. Add verified frontmatter and instructions. Anthropic’s own example uses Microsoft’s published @playwright/mcp package:

---
name: browser-checker
description: Tests web features in a real browser and reports reproducible failures.
mcpServers:
  - playwright:
      type: stdio
      command: npx
      args: ["-y", "@playwright/mcp@latest"]
---

Test only the requested flow. Report the URL, steps, observed result, and expected result.

This is an inline stdio server, not a .mcp.json entry. Microsoft’s Playwright MCP repository confirms the package name and notes that Node.js 18 or newer is required.

  1. Restart if the directory is new. Claude Code detects files added to an existing agents directory, but Anthropic says a session may need restarting when ~/.claude/agents/ did not exist at startup.

  2. Invoke it explicitly first. Ask: Use the browser-checker subagent to test the sign-in error state. Explicit invocation makes evaluation easier than hoping automatic delegation triggers.

  3. Verify the boundary. Use /mcp to inspect connections, then confirm the parent cannot call the inline Playwright tools after the subagent ends. For session-wide installation and scope choices, follow our guide to adding an MCP server.

Do not paste a token into a committed agent file. For a shared server, configure credentials through the server’s documented authentication flow and reference it by name; Anthropic’s MCP guide also warns that servers fetching external content introduce prompt-injection risk.

Sleek office desk setup featuring a laptop, glass of water, and open window view.
Photo by EVG Kowalievska on Pexels

Claude Code vs other MCP clients

Claude Code is the clear choice when per-worker MCP isolation matters; the other clients focus on making servers available to a chat or coding agent. They can be excellent MCP hosts, but their official docs do not describe Claude Code-style mcpServers frontmatter for a disposable subagent.

ClientMain configurationLocal and remote MCPPer-subagent MCP scopeApproval/control modelBest fit
Claude Code.mcp.json, settings, CLI, or .claude/agents/*.mdstdio, HTTP, SSE, WebSocketYes, named or inlineParent permissions plus agent restrictionsTerminal workflows and isolated specialists
Claude DesktopExtensions UI; legacy local JSON also existsLocal extensions and remote connectorsNo documented worker scopeApp prompts and organization controlsGeneral chat with local or SaaS tools
Cursor.cursor/mcp.json or ~/.cursor/mcp.jsonstdio, SSE, Streamable HTTPNo documented worker scopePer-tool toggles; approval by defaultIDE-first coding agent
Windsurf/CascadeMarketplace or ~/.codeium/windsurf/mcp_config.jsonstdio, SSE, Streamable HTTPNo documented worker scopePer-tool toggles; 100-tool active limitIDE workflows centered on Cascade

Cursor’s official MCP documentation confirms project/global paths, transports, tool toggles, and default approvals; our Cursor client page covers the practical install flow. Windsurf documents its config path and 100-tool ceiling in the Cascade MCP guide. Claude Desktop now emphasizes one-click desktop extensions, as explained in Anthropic’s setup guide.

The catch most guides skip

Isolation removes context as well as clutter. A normal subagent does not see the parent’s full conversation history or files already read; it starts from a delegation message, its own prompt, applicable project instructions, and a fresh context, so an underspecified handoff produces confident but misaligned work.

MCP adds another failure surface. Inline servers must start and authenticate, remote services can disconnect, tool results may be verbose, and independent workers can race on the same files or external records. Claude Code automatically reconnects HTTP and SSE servers with backoff, but not local stdio processes, according to Anthropic’s connection behavior.

The workaround is disciplined scoping:

  • Give the agent one deliverable, explicit acceptance criteria, and the minimum relevant paths.
  • Prefer read-only credentials and omit write-capable tools unless the task requires them.
  • Keep dependent planning and implementation in one context.
  • Run parallel workers only on independent targets; use worktree isolation when separate code edits are truly necessary.
  • Ask for a compact evidence report, not a second essay that refills the parent context.

Subagents also cost extra tokens because each worker has its own input and output. Anthropic notes that model selection can route a specialist to a cheaper model, but that does not make delegation free. I would avoid subagents for a one-file fix, an ambiguous product decision, or any task requiring repeated user approval; the coordination tax exceeds the context saved.

What to connect first

Start with one read-oriented system that closes a real information gap, then add a write-capable server only after you trust the workflow. These three picks cover source control, production evidence, and browser behavior without pretending every developer needs the same stack.

  1. GitHub MCP Server for review and issue context. GitHub maintains the official open-source server, with repository, issue, pull-request, and code-security toolsets. Give a reviewer subagent read-only access first; do not let an experimental worker merge or modify issues.

  2. Sentry MCP for incident investigation. Sentry operates a hosted MCP service that can bring errors and project context into a focused debugging worker. This is a strong subagent job because event searches are noisy, while the parent usually needs only the suspected cause, evidence, and affected release.

  3. Playwright MCP for browser verification. Microsoft’s server exposes browser automation through structured accessibility snapshots. Scope it inline to a browser-checker so the parent does not carry browser tool schemas during ordinary coding, and remember the repository itself says CLI plus skills may be more token-efficient for high-throughput coding agents.

Browse the best MCP servers for alternatives, but resist collecting integrations. Three narrowly assigned servers beat twenty overlapping ones: fewer schemas, fewer credentials, clearer approvals, and a much better chance that Claude chooses the right tool.

FAQ

What are Claude Code subagents?

Claude Code subagents are isolated workers that handle delegated tasks in their own context window. Each can have a distinct prompt, model, tools, permissions, skills, and MCP access before returning a result to the main conversation.

Can a Claude Code subagent use its own MCP server?

Yes, a Claude Code subagent can receive an inline MCP server through the `mcpServers` frontmatter field. It can also reference a server already configured in the parent session by name; inline servers connect for the worker’s lifetime only.

Are Claude Code subagents safe and inexpensive to run?

No, safety and low cost are not automatic. Subagents inherit a permission context, MCP servers may reach sensitive systems, and every worker consumes separate model tokens, so use minimal tools, read-only credentials, explicit approvals, and cheaper models where the task allows.

When should I avoid Claude Code subagents?

Avoid Claude Code subagents when the task is small, ambiguous, latency-sensitive, or dependent on extensive conversation history. Keep tightly coupled planning, editing, and testing in the main context unless isolation saves more context than delegation consumes.

Put this into practice

Browse MCP servers by capability, or check your own setup's tool budget and security.

More in AI clients

Browse all ai clients articles.