Sub-Agents▌

by shinpr
Sub-Agents delegates tasks to specialized AI assistants, automating workflow orchestration with performance monitoring a
Delegates tasks to specialized AI assistants in Cursor and Claude Code CLI tools by automatically discovering agent definition files and providing execution with timeout management and performance monitoring for building orchestration workflows and task delegation systems.
best for
- / Teams wanting to share AI agents across different IDEs
- / Developers building orchestration workflows
- / Creating task delegation systems with specialized agents
- / Porting Claude Code sub-agent workflows to other tools
capabilities
- / Execute specialized AI agents via Cursor CLI, Claude Code, or Gemini CLI
- / Auto-discover agent definition files from directories
- / Monitor agent execution with timeout management
- / Track performance metrics across agent runs
- / Manage agent sessions with error handling
- / Define reusable task-specific agents in markdown
what it does
Delegates tasks to specialized AI assistants defined in markdown files, making Claude Code-style sub-agents work across any MCP-compatible tool like Cursor or Claude Desktop.
about
Sub-Agents is a community-built MCP server published by shinpr that provides AI assistants with tools and capabilities via the Model Context Protocol. Sub-Agents delegates tasks to specialized AI assistants, automating workflow orchestration with performance monitoring a It is categorized under developer tools.
how to install
You can install Sub-Agents in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
license
MIT
Sub-Agents is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
readme
Sub-Agents MCP Server
Bring Claude Code–style sub-agents to any MCP-compatible tool.
This MCP server lets you define task-specific AI agents (like "test-writer" or "code-reviewer") in markdown files, and execute them via Cursor CLI, Claude Code, Gemini CLI, or Codex backends.
Why?
Claude Code offers powerful sub-agent workflows—but they're limited to its own environment. This MCP server makes that workflow portable, so any MCP-compatible tool (Cursor, Claude Desktop, Windsurf, etc.) can use the same agents.
Concrete benefits:
- Define reusable agents once, use them across multiple tools
- Share agent definitions within teams regardless of IDE choice
- Leverage Cursor CLI, Claude Code, Gemini CLI, or Codex capabilities from any MCP client
Alternative: Agent Skills
sub-agents-skills offers a lightweight alternative.
| sub-agents-mcp | sub-agents-skills | |
|---|---|---|
| Setup | MCP configuration required | Copy skill files to your environment |
| Features | Session management, error handling | Minimal |
| Stability | More robust | Lightweight |
Choose sub-agents-mcp for production use with reliability features. Choose sub-agents-skills for quick setup in Skill-compatible environments.
Table of Contents
- Prerequisites
- Quick Start
- Usage Examples
- Writing Effective Agents
- Agent Examples
- Configuration Reference
- Session Management
- Troubleshooting
- Design Philosophy
- How It Works
Prerequisites
- Node.js 20 or higher
- One of these execution engines (they actually run the sub-agents):
cursor-agentCLI (from Cursor)claudeCLI (from Claude Code)geminiCLI (from Gemini CLI)codexCLI (from Codex)
- An MCP-compatible tool (Cursor IDE, Claude Desktop, Windsurf, etc.)
Quick Start
1. Create Your First Agent
Create a folder for your agents and add code-reviewer.md:
# Code Reviewer
Review code for quality and maintainability issues.
## Task
- Find bugs and potential issues
- Suggest improvements
- Check code style consistency
## Done When
- All target files reviewed
- Issues listed with explanations
See Writing Effective Agents for more on agent design.
2. Install Your Execution Engine
Pick one based on which tool you use:
For Cursor users:
# Install Cursor CLI (includes cursor-agent)
curl https://cursor.com/install -fsS | bash
# Authenticate (required before first use)
cursor-agent login
For Claude Code users:
# Option 1: Native install (recommended)
curl -fsSL https://claude.ai/install.sh | bash
# Option 2: NPM (requires Node.js 18+)
npm install -g @anthropic-ai/claude-code
Note: Claude Code installs the claude CLI command.
For Gemini CLI users:
# Install Gemini CLI
npm install -g @google/gemini-cli
# Authenticate via browser (required before first use)
gemini
Note: Gemini CLI uses OAuth authentication. Run gemini once to authenticate via browser.
For Codex users:
# Install Codex
npm install -g @openai/codex
3. Configure MCP
Add this to your MCP configuration file:
Cursor: ~/.cursor/mcp.json
Claude Desktop: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
{
"mcpServers": {
"sub-agents": {
"command": "npx",
"args": ["-y", "sub-agents-mcp"],
"env": {
"AGENTS_DIR": "/absolute/path/to/your/agents-folder",
"AGENT_TYPE": "cursor" // or "claude", "gemini", or "codex"
}
}
}
}
Important: Use absolute paths only.
- ✅
/Users/john/Documents/my-agents(Mac/Linux) - ✅
C:\Users\john\Documents\my-agents(Windows) - ❌
./agentsor~/agentswon't work
Restart your IDE and you're ready to go.
4. Fix "Permission Denied" Errors When Running Shell Commands
Sub-agents may fail to execute shell commands with permission errors. This happens because sub-agents can't respond to interactive permission prompts.
Recommended approach:
-
Run your CLI tool directly with the task you want sub-agents to handle:
# For Cursor users cursor-agent # For Claude Code users claude # For Gemini CLI users gemini # For Codex CLI users codex -
When prompted to allow commands (e.g., "Add Shell(cd), Shell(make) to allowlist?"), approve them
-
This automatically updates your configuration file, and those commands will now work when invoked via MCP sub-agents
Manual configuration (alternative):
If you prefer to configure permissions manually, edit:
- Cursor:
<project>/.cursor/cli.jsonor~/.cursor/cli-config.json - Claude Code:
.claude/settings.jsonor.claude/settings.local.json
{
"permissions": {
"allow": [
"Shell(cd)",
"Shell(make)",
"Shell(git)"
]
}
}
Note: Agents often run commands as one-liners like cd /path && make build, so you need to allow all parts of the command.
Usage Examples
Just tell your AI to use an agent:
"Use the code-reviewer agent to check my UserService class"
"Use the test-writer agent to create unit tests for the auth module"
"Use the doc-writer agent to add JSDoc comments to all public methods"
Your AI automatically invokes the specialized agent and returns results.
Tip: Always include what you want done in your request—not just which agent to use. For example:
- ✅ "Use the code-reviewer agent to check my UserService class"
- ❌ "Use the code-reviewer agent" (too vague—the agent won't know what to review)
The more specific your task, the better the results.
Writing Effective Agents
The Single Responsibility Principle
Each agent should do one thing well. Avoid "swiss army knife" agents.
| ✅ Good | ❌ Bad |
|---|---|
| Reviews code for security issues | Reviews code, writes tests, and refactors |
| Writes unit tests for a module | Writes tests and fixes bugs it finds |
Essential Structure
# Agent Name
One-sentence purpose.
## Task
- Action 1
- Action 2
## Done When
- Criterion 1
- Criterion 2
Keep Agents Self-Contained
Agents run in isolation with fresh context. Avoid:
- References to other agents ("then use X agent...")
- Assumptions about prior context ("continuing from before...")
- Scope creep beyond the stated purpose
Advanced Patterns
For complex agents, consider adding:
- Scope boundaries: Explicitly state what's out of scope
- Prohibited actions: List common mistakes the agent should avoid
- Output format: Define structured output when needed
Agent Examples
Each .md or .txt file in your agents folder becomes an agent. The filename becomes the agent name (e.g., bug-investigator.md → "bug-investigator").
bug-investigator.md
# Bug Investigator
Investigate bug reports and identify root causes.
## Task
- Collect evidence from error logs, code, and git history
- Generate multiple hypotheses for the cause
- Trace each hypothesis to its root cause
- Report findings with supporting evidence
## Out of Scope
- Fixing the bug (investigation only)
- Making assumptions without evidence
## Done When
- At least 2 hypotheses documented with evidence
- Most likely cause identified with confidence level
- Affected code locations listed
For more advanced patterns (completion checklists, prohibited actions, structured output), see claude-code-workflows/agents. These are written for Claude Code, but the design patterns apply to any execution engine.
Configuration Reference
Required Environment Variables
AGENTS_DIR
Path to your agents folder. Must be absolute.
AGENT_TYPE
Which execution engine to use:
"cursor"- usescursor-agentCLI"claude"- usesclaudeCLI"gemini"- usesgeminiCLI"codex"- usescodexCLI (OpenAI Codex)
Optional Settings
EXECUTION_TIMEOUT_MS
How long agents can run before timing out (default: 5 minutes, max: 10 minutes)
AGENTS_SETTINGS_PATH
Path to custom CLI settings directory for sub-agents.
Each CLI normally reads settings from project-level directories (.claude/, .cursor/, .codex/) or user-level directories (~/.claude/, ~/.cursor/, ~/.codex/). If you want sub-agents to run with different settings (e.g., different permissions or model), specify a separate settings directory here.
Supported CLI types: claude, cursor, codex
Note: Gemini CLI does not support custom settings paths, so this option has no effect when AGENT_TYPE is gemini.
Example with custom settings:
{
"mcpServers": {
"sub-agents": {
"command": "npx",
"args": ["-y", "sub-agents-mcp"],
"env": {
"AGENTS_DIR": "/absolute/path/to/agents",
"AGENT_TYPE": "cursor",
"EXECUTION_TIMEOUT_MS": "600000",
"AGENTS_SETTINGS_PATH": "/absolute/path/to/custom-cli-settings"
}
}
}
}
Security Note
Agents have access to your project directory. Only use agent definitions from trusted sources.
Session Management
Session management allows sub-agents to remember previous executions, which helps when you want agents to build on earlier work or maintain context across multiple calls.
Why Sessions Matter
By default, each sub-agent
FAQ
- What is the Sub-Agents MCP server?
- Sub-Agents is a Model Context Protocol (MCP) server profile on explainx.ai. MCP lets AI hosts (e.g. Claude Desktop, Cursor) call tools and resources through a standard interface; this page summarizes categories, install hints, and community ratings.
- How do MCP servers relate to agent skills?
- Skills are reusable instruction packages (often SKILL.md); MCP servers expose live capabilities. Teams frequently combine both—skills for workflows, MCP for APIs and data. See explainx.ai/skills and explainx.ai/mcp-servers for parallel directories.
- How are reviews shown for Sub-Agents?
- This profile displays 10 aggregated ratings (sample rows for discoverability plus signed-in user reviews). Average score is about 4.5 out of 5—verify behavior in your own environment before production use.
Ratings
4.5★★★★★10 reviews- ★★★★★Shikha Mishra· Oct 10, 2024
Sub-Agents is among the better-indexed MCP projects we tried; the explainx.ai summary tracks the official description.
- ★★★★★Piyush G· Sep 9, 2024
We evaluated Sub-Agents against two servers with overlapping tools; this profile had the clearer scope statement.
- ★★★★★Chaitanya Patil· Aug 8, 2024
Useful MCP listing: Sub-Agents is the kind of server we cite when onboarding engineers to host + tool permissions.
- ★★★★★Sakshi Patil· Jul 7, 2024
Sub-Agents reduced integration guesswork — categories and install configs on the listing matched the upstream repo.
- ★★★★★Ganesh Mohane· Jun 6, 2024
I recommend Sub-Agents for teams standardizing on MCP; the explainx.ai page compares cleanly with sibling servers.
- ★★★★★Oshnikdeep· May 5, 2024
Strong directory entry: Sub-Agents surfaces stars and publisher context so we could sanity-check maintenance before adopting.
- ★★★★★Dhruvi Jain· Apr 4, 2024
Sub-Agents has been reliable for tool-calling workflows; the MCP profile page is a good permalink for internal docs.
- ★★★★★Rahul Santra· Mar 3, 2024
According to our notes, Sub-Agents benefits from clear Model Context Protocol framing — fewer ambiguous “AI plugin” claims.
- ★★★★★Pratham Ware· Feb 2, 2024
We wired Sub-Agents into a staging workspace; the listing’s GitHub and npm pointers saved time versus hunting across READMEs.
- ★★★★★Yash Thakker· Jan 1, 2024
Sub-Agents is a well-scoped MCP server in the explainx.ai directory — install snippets and categories matched our Claude Code setup.