
Brings Claude Code's sub-agent workflow to any MCP client by letting you define task-specific AI assistants in markdown files. Point it at a folder of agent definitions (like "code-reviewer" or "test-writer"), configure which backend to use (Cursor CLI, Claude Code, Codex, or Gemini CLI), and invoke agents by name from any MCP-compatible tool. Each agent is a self-contained markdown file with a task description and completion criteria. The server handles session management and routes execution through your chosen CLI backend, so you can share the same agent definitions across Cursor, Claude Desktop, Windsurf, or other MCP clients. Requires one of the supported CLI tools installed and authenticated.
Run reusable coding agents from any MCP-compatible client.
Write a reviewer, test writer, or investigator in Markdown, then ask your assistant to use it. The MCP server runs that agent with the coding CLI you choose and returns the result to the same conversation.
You need Node.js 22 or later, an MCP-compatible client, and one supported coding CLI installed and signed in. This example uses Codex.
Create an agents folder anywhere on your machine, then add code-reviewer.md:
# Code Reviewer
Review code for bugs and maintainability issues.
## Task
- Find concrete problems in the requested changes
- Explain why each problem matters
- Point to the affected code
## Done When
- All requested files have been reviewed
- Findings include evidence and suggested next steps
The filename becomes the agent name: code-reviewer.md becomes code-reviewer.
Add the server to your client's MCP configuration. Replace AGENTS_DIR with the absolute path to the folder you created.
{
"mcpServers": {
"sub-agents": {
"command": "npx",
"args": ["-y", "sub-agents-mcp"],
"env": {
"AGENTS_DIR": "/absolute/path/to/agents",
"AGENT_TYPE": "codex"
}
}
}
}
Restart or reconnect your MCP client after saving the configuration.
Ask your assistant:
Use the code-reviewer agent to review the authentication changes.
Your assistant runs the agent with Codex and returns the review to the conversation.
Use the test-writer agent to add unit tests for the auth module.
Use the bug-investigator agent to find the cause of the failed checkout requests.
Use the doc-writer agent to document the public API changes.
Name both the agent and the work you want it to do.
Use the MCP server when you want to share the same agents across MCP clients while keeping backend and model configuration in one place.
If you prefer a lighter installation or want each agent to choose its own backend and model, see Sub-Agents Skills.
Set AGENT_TYPE to the backend you already use:
AGENT_TYPE | Backend | Command |
|---|---|---|
codex | Codex | codex |
claude | Claude Code | claude |
cursor | Cursor CLI | cursor-agent |
command-code | Command Code | command-code |
glm | GLM (Z.ai) | claude |
kimi | Kimi | claude |
grok | Grok Build | grok |
antigravity | Google Antigravity | agy 1.1.12+ |
gemini | Gemini CLI (compatibility) | gemini |
opencode | OpenCode | opencode |
The selected CLI must be installed and configured before the MCP server starts.
GLM and Kimi require CLI_API_KEY in the MCP server environment. Other backends use the CLI's existing authentication.
For Google models, prefer Antigravity. Gemini CLI remains available for existing enterprise, API key, or Vertex AI configurations.
Set AGENT_MODEL to use one model for every agent. Omit it to use the backend's default.
AGENT_PERMISSION controls what agents may do:
read-only — review and investigationsafe-edit — edits allowed without approval (default)yolo — unrestricted executionIf an agent reports that an action was blocked, choose a less restrictive mode.
Set SESSION_ENABLED to "true" when you want an agent to remember earlier calls and continue a longer task. Your assistant must reuse the returned session_id on the next call to continue that session.
AGENTS_DIR is an absolute path and contains at least one .md or .txt fileMIT
AGENTS_DIR*Absolute path to the directory containing agent definition files (.md or .txt)
AGENT_TYPE*Type of AI CLI to use: 'cursor', 'claude', 'gemini', or 'codex'
AGENT_PERMISSIONApproval/sandbox level for sub-agents: 'read-only', 'safe-edit' (default), or 'yolo'
CURSOR_API_KEYsecretAPI key for cursor-agent authentication (used only when AGENT_TYPE=cursor; passed via env, never via CLI args)
EXECUTION_TIMEOUT_MSMaximum execution time for agents in milliseconds (default: 300000, max: 600000)
SESSION_ENABLEDEnable session management to maintain execution history across agent calls (default: false)
SESSION_DIRDirectory path for storing session files (default: .mcp-sessions in current working directory)
SESSION_RETENTION_DAYSNumber of days to retain session history before automatic cleanup (default: 7)
AGENTS_SETTINGS_PATHPath to CLI settings file/directory. Claude: --settings arg, Cursor: CURSOR_CONFIG_DIR, Codex: CODEX_HOME. Gemini not supported.