Sub Agents MCP
Run reusable Markdown-defined coding agents through the CLI you already use
Sub Agents MCP is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, macOS, Linux
- Runs
- Locally
- Version
- 0.15.1
- Listing updated
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add sub-agents-mcp --env AGENTS_DIR='<AGENTS_DIR>' --env AGENT_TYPE='<AGENT_TYPE>' --env CURSOR_API_KEY='<CURSOR_API_KEY>' --env CLI_API_KEY='<CLI_API_KEY>' -- npx -y sub-agents-mcpAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"sub-agents-mcp": {
"command": "npx",
"args": [
"-y",
"sub-agents-mcp"
],
"env": {
"AGENTS_DIR": "<AGENTS_DIR>",
"AGENT_TYPE": "<AGENT_TYPE>",
"CURSOR_API_KEY": "<CURSOR_API_KEY>",
"CLI_API_KEY": "<CLI_API_KEY>"
}
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"sub-agents-mcp": {
"command": "npx",
"args": [
"-y",
"sub-agents-mcp"
],
"env": {
"AGENTS_DIR": "<AGENTS_DIR>",
"AGENT_TYPE": "<AGENT_TYPE>",
"CURSOR_API_KEY": "<CURSOR_API_KEY>",
"CLI_API_KEY": "<CLI_API_KEY>"
}
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"sub-agents-mcp": {
"command": "npx",
"args": [
"-y",
"sub-agents-mcp"
],
"env": {
"AGENTS_DIR": "<AGENTS_DIR>",
"AGENT_TYPE": "<AGENT_TYPE>",
"CURSOR_API_KEY": "<CURSOR_API_KEY>",
"CLI_API_KEY": "<CLI_API_KEY>"
}
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"sub-agents-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"sub-agents-mcp"
],
"env": {
"AGENTS_DIR": "<AGENTS_DIR>",
"AGENT_TYPE": "<AGENT_TYPE>",
"CURSOR_API_KEY": "<CURSOR_API_KEY>",
"CLI_API_KEY": "<CLI_API_KEY>"
}
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add sub-agents-mcp --env AGENTS_DIR='<AGENTS_DIR>' --env AGENT_TYPE='<AGENT_TYPE>' --env CURSOR_API_KEY='<CURSOR_API_KEY>' --env CLI_API_KEY='<CLI_API_KEY>' -- npx -y sub-agents-mcpOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.sub-agents-mcp]
command = "npx"
args = ["-y", "sub-agents-mcp"]
env = { AGENTS_DIR = "<AGENTS_DIR>", AGENT_TYPE = "<AGENT_TYPE>", CURSOR_API_KEY = "<CURSOR_API_KEY>", CLI_API_KEY = "<CLI_API_KEY>" }Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"sub-agents-mcp": {
"command": "npx",
"args": [
"-y",
"sub-agents-mcp"
],
"env": {
"AGENTS_DIR": "<AGENTS_DIR>",
"AGENT_TYPE": "<AGENT_TYPE>",
"CURSOR_API_KEY": "<CURSOR_API_KEY>",
"CLI_API_KEY": "<CLI_API_KEY>"
}
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Or run: gemini mcp add -s user -e AGENTS_DIR='<AGENTS_DIR>' -e AGENT_TYPE='<AGENT_TYPE>' -e CURSOR_API_KEY='<CURSOR_API_KEY>' -e CLI_API_KEY='<CLI_API_KEY>' sub-agents-mcp npx -- -y sub-agents-mcp
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.
Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "sub-agents-mcp": { "command": "npx", "args": [ "-y", "sub-agents-mcp" ], "env": { "AGENTS_DIR": "<AGENTS_DIR>", "AGENT_TYPE": "<AGENT_TYPE>", "CURSOR_API_KEY": "<CURSOR_API_KEY>", "CLI_API_KEY": "<CLI_API_KEY>" } } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
AGENTS_DIRAbsolute path to the directory containing agent definition files (.md or .txt)RequiredAGENT_TYPEType of AI CLI to use: 'cursor', 'claude', 'gemini', 'codex', 'command-code', 'glm', 'kimi', 'grok', 'antigravity', 'opencode', 'mcode', or 'pi'RequiredAGENT_PERMISSIONApproval/sandbox level for sub-agents: 'read-only', 'safe-edit' (default), or 'yolo'AGENT_MODELOptional model override applied to every sub-agent execution by this MCP serverAGENT_EFFORTOptional backend-specific reasoning effort or model variant. Supported by codex, claude, command-code, glm, kimi, grok, antigravity, opencode, mcode, and pi.CURSOR_API_KEYAPI key for cursor-agent authentication (used only when AGENT_TYPE=cursor; passed via env, never via CLI args)CLI_API_KEYProvider API key for AGENT_TYPE=glm or kimi (passed to the claude binary via env, never via CLI args). Restart/reconnect the MCP server after changing it.EXECUTION_TIMEOUT_MSAgent execution timeout in milliseconds, as a positive whole number (default: 300000). The server refuses to start on an invalid value such as "5min".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: 1)AGENTS_SETTINGS_PATHPath to CLI settings file/directory. Claude: --settings arg, Cursor: CURSOR_CONFIG_DIR, Codex: CODEX_HOME. GLM/Kimi/Gemini/Grok/Antigravity/OpenCode/Command Code/MiniMax Code/Pi not supported.
About Sub Agents MCP
You write an agent as a Markdown file, such as a code reviewer or test writer, and the filename becomes its name. When an assistant is told to use that agent, the server launches your chosen coding CLI with those instructions and returns the result to the same conversation. That lets different MCP clients share one set of agent definitions and one backend and model setting.
The AGENT_TYPE variable picks the backend from a long list: Codex, Claude Code, Cursor CLI, Command Code, GLM, Kimi, Grok Build, Google Antigravity, Gemini CLI, OpenCode, MiniMax Code and Pi. The selected CLI must already be installed and signed in. GLM and Kimi need a CLI_API_KEY, while the others use the CLI's own login. AGENT_PERMISSION chooses read-only, safe-edit (default) or yolo, which the README treats as guidance rather than a security boundary.
Sessions can be switched on so an agent remembers earlier calls when the assistant reuses the returned session ID. Execution times out at five minutes by default. It needs Node.js 22 or later and is MIT licensed.
What it does
- Markdown agent definitions
- Defines each agent in a Markdown file named after the agent.
- Many CLI backends
- Runs agents through Codex, Claude Code, Cursor, Gemini, Grok, Pi and others.
- Permission levels
- Offers read-only, safe-edit and yolo modes.
- Shared model setting
- One AGENT_MODEL value applies to every agent.
- Session continuity
- Optional sessions let an agent continue earlier work.
- Execution timeout
- Limits a run to a configurable time, five minutes by default.
Good for
- Delegate a code review to a focused reviewer agent
- Have a test-writer agent add unit tests
- Investigate a failing flow with a dedicated agent
- Share agent definitions across several MCP clients
Pricing
Open source
MIT licensed npm package
Sub Agents MCP FAQ
What do I need installed?
Node.js 22 or later, an MCP client and one supported coding CLI that is signed in.
How do I name an agent?
Use the filename; code-reviewer.md becomes code-reviewer.
Are the permission levels a security boundary?
No. The README says enforcement depends on the backend, so treat them as guidance.
How do agents remember earlier calls?
Set SESSION_ENABLED to true and have the assistant reuse the returned session_id.
Is Sub Agents MCP free?
Yes. Sub Agents MCP is open source, so you can use and self-host it for free.
How do I add Sub Agents MCP to Claude Code?
Run this command in your terminal: claude mcp add sub-agents-mcp --env AGENTS_DIR='<AGENTS_DIR>' --env AGENT_TYPE='<AGENT_TYPE>' --env CURSOR_API_KEY='<CURSOR_API_KEY>' --env CLI_API_KEY='<CLI_API_KEY>' -- npx -y sub-agents-mcp
What are the best alternatives to Sub Agents MCP?
The closest alternatives to Sub Agents MCP are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.


