Sub-Agents MCP Server
Let your AI assistant (Cursor, Claude) use specialized sub-agents for specific tasks. For example, create a "test-writer" agent that writes tests, or a "code-reviewer" agent that reviews your code.
Why sub-agents-mcp?
While Claude Code has excellent built-in sub-agent functionality, it's exclusive to Claude Code. This MCP server brings that same powerful sub-agent pattern to ANY LLM tool that supports MCP - including Cursor, Windsurf, and others.
TL;DR: Experience Claude Code's sub-agent workflow everywhere.
Prerequisites
Node.js 20 or higher
Cursor CLI or Claude Code installed
Basic terminal/command line knowledge
Installation
This command will install and run the MCP server. No manual building or cloning required!
Quick Start (3 minutes)
Step 1: Create Your First Agent
Create a folder for your agents and add a file code-reviewer.md:
Step 2: Setup Your AI Tool
For Cursor Users:
For Claude Code Users:
Step 3: Configure MCP
For Cursor: Edit ~/.cursor/mcp.json
For Claude: Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
Path examples:
✅ Good:
/Users/john/Documents/my-agents(Mac/Linux)✅ Good:
C:\\Users\\john\\Documents\\my-agents(Windows)❌ Bad:
./agentsor~/agents(relative paths don't work)
That's it! Restart your IDE and start using agents.
How to Use
Once configured, just tell your AI assistant to use your agents:
Examples
Using a code reviewer:
Using a test writer:
Using a documentation writer:
Your AI will automatically invoke the specialized agent and return the results!
Common Agent Examples
Here are some agents you might want to create:
test-writer.md - Writes comprehensive unit tests
sql-expert.md - Helps with database queries
security-checker.md - Reviews code for security issues
Configuration
Required Settings
AGENTS_DIR - Path to your agents folder
⚠️ Must be an absolute path
Mac/Linux:
/Users/john/my-agentsWindows:
C:\\Users\\john\\my-agents
Create this folder before configuring MCP
AGENT_TYPE - Which AI tool you're using
Set to
"cursor"for CursorSet to
"claude"for Claude Code
Optional Settings
EXECUTION_TIMEOUT_MS - How long agents can run (default: 5 minutes)
Increase for complex tasks like document review
Maximum: 10 minutes (600000ms)
Creating Agents
Each .md or .txt file in your agents folder becomes an available agent.
File naming tips:
Filename = agent name (e.g.,
test-writer.md→ use as "test-writer")Use hyphens or underscores, no spaces
Agent file structure:
Security Note
Agents have access to your project directory. Only use agent definitions from trusted sources.
Troubleshooting
Cursor CLI Not Working
Symptoms: Timeout errors, authentication failures, or "session expired" messages
Solutions:
Authenticate with cursor-agent login
cursor-agent loginThis is the standard authentication method. Run this command before using the MCP server.
Check if cursor-agent is installed
which cursor-agentIf not found, reinstall Cursor CLI.
Verify session status If you're still having issues, your session may have expired. Simply run
cursor-agent loginagain.
Agent Not Found
Verify
AGENTS_DIRpoints to the correct directoryCheck file has
.mdor.txtextensionEnsure filename contains only allowed characters
Other Execution Errors
Verify
AGENT_TYPEis set correctly (cursororclaude)Ensure the CLI tool is installed and accessible:
For
cursor: Ensurecursor-agentCLI is installed and authenticatedFor
claude: Ensure Claude Code CLI is installed
Check environment variables are properly set
How It Works
Your AI assistant can invoke specialized agents through MCP:
You ask your AI to use an agent (e.g., "Use the test-writer agent")
The MCP server runs the specialized agent with your request
Results come back to your main AI assistant
Additional Configuration Examples
Full Configuration Reference
For Cursor: ~/.cursor/mcp.json
For Claude: ~/Library/Application Support/Claude/claude_desktop_config.json
License
MIT
Enable AI-to-AI collaboration through Model Context Protocol
Tools
Enables AI assistants to delegate specific tasks to specialized sub-agents (e.g., test-writer, code-reviewer). Supports both Cursor and Claude Code with custom agent definitions.