Skip to main content
Glama

Sub-Agents MCP Server

npm version License: MIT

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.

What You Can Do

  • Delegate code review, test writing, investigation, and documentation to focused agents

  • Reuse the same agent definitions across MCP clients with one shared backend and model configuration

  • Continue the same agent across multiple calls for longer work

Related MCP server: Agents Council

Quick Start

You need Node.js 22 or later, an MCP-compatible client, and one supported coding CLI installed and signed in. This example uses Codex.

1. Create an Agent

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.

2. Add the MCP Server

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.

3. Run the Agent

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.

Examples

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.

When the MCP Server Fits

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.

Supported Backends

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.

Shared Agent Settings

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 investigation

  • safe-edit — edits allowed without approval (default)

  • yolo — unrestricted execution

If an agent reports that an action was blocked, choose a less restrictive mode.

Continue Work Across Calls

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.

If It Does Not Start

  • Run the selected backend command directly and confirm that it is installed and signed in

  • Make sure AGENTS_DIR is an absolute path and contains at least one .md or .txt file

  • Restart or reconnect the MCP client after changing its configuration

License

MIT

Available Tools

1 tool
run_agentA

Delegate complex, multi-step, or specialized tasks to an autonomous agent for independent execution with dedicated context (e.g., refactoring across multiple files, fixing all test failures, systematic codebase analysis, batch operations). Returns session_id in response metadata - reuse it in subsequent calls to maintain conversation context continuity across multiple agent executions.

ParametersJSON Schema
NameRequiredDescriptionDefault
cwdYesWorking directory path for agent execution context. Must be an absolute path to a valid directory.
agentYesAgent name exactly as listed in list_agents resource.
promptYesUser's direct request content. Agent context is separately provided via agent parameter.
session_idNoSession ID for continuing previous conversation context (optional). If omitted, a new session will be auto-generated and returned in response metadata. Reuse the returned session_id in subsequent calls to maintain context continuity.

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Adds useful behavior beyond the schema: the agent runs independently with dedicated context and returns a session_id in response metadata for reuse. However, with no annotations provided, the description should be clearer about potential side effects such as file modifications or long-running operations, which are implied by the examples but not stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose and use cases, followed by the only critical chaining detail. Every sentence earns its place with no filler or redundant restatement of the schema.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an autonomous agent tool with no output schema or annotations, the description covers the core contract (task delegation, dedicated context, session continuity) but omits the result payload beyond session_id, execution lifecycle, and safety caveats. This is adequate but incomplete for a potentially powerful and side-effectful tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all parameter meanings are already documented and the baseline is 3. The description adds a small extra note about session_id being returned and reusable, but does not provide deeper syntax or format details beyond what the schema states.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb ('Delegate') and identifies both the resource ('autonomous agent') and the execution mode ('independent execution with dedicated context'). Concrete examples like refactoring across files, fixing test failures, and batch operations remove ambiguity about what the tool is for.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'Complex, multi-step, or specialized tasks' explicitly defines the intended trigger conditions, and the session_id guidance explains how to chain multiple executions. There are no exclusions or alternative tools named, but no sibling tools exist to require them.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 1 tool updatev0.14.2
    • Changedrun_agent1 field changed
      • removedInput schema / properties / extra_args
        Removed value: -{
        -  "description": "Additional configuration parameters for agent execution (optional)",
        -  "items": {
        -    "type": "string"
        -  },
        -  "type": "array"
        -}
  2. 1 tool updatev1.0.0
    • Changedrun_agent5 fields changed
      • changedInput schema / properties / agent / description
        Previous value: -"Identifier of the specialized agent to delegate the task to"New value: +"Agent name exactly as listed in list_agents resource."
      • changedInput schema / properties / cwd / description
        Previous value: -"Working directory path for agent execution context (optional)"New value: +"Working directory path for agent execution context. Must be an absolute path to a valid directory."
      • changedInput schema / properties / prompt / description
        Previous value: -"Task description or instructions for the agent to execute. When referencing file paths, use absolute paths to ensure proper file access."New value: +"User's direct request content. Agent context is separately provided via agent parameter."
      • addedInput schema / properties / session_id
        Added value: +{
        +  "description": "Session ID for continuing previous conversation context (optional). If omitted, a new session will be auto-generated and returned in response metadata. Reuse the returned session_id in subsequent calls to maintain context continuity.",
        +  "type": "string"
        +}
      • changedInput schema / required
        Previous value: -[
        -  "agent",
        -  "prompt"
        -]New value: +[
        +  "agent",
        +  "prompt",
        +  "cwd"
        +]
  3. 1 tool update
    • First observedrun_agent

TDQS

A3.7/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or misselection between tools. The tool's purpose is clearly described and stands alone.

Naming Consistency5/5

The single tool name 'run_agent' is clear and follows a conventional verb_noun style. There are no other names to contradict a consistent pattern.

Tool Count2/5

A single tool for a server called 'Task Agents' is too few for the apparent scope. Users cannot list, manage, or monitor agents, making the toolset feel extremely thin.

Completeness1/5

The server provides only an invocation operation with no lifecycle management—no status checks, cancellation, listing, or result retrieval mechanisms. This is severely incomplete for a task-agent-oriented server.

Maintenance

ActivityActive
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables the creation and execution of task-specific AI sub-agents defined in markdown across any MCP-compatible tool like Cursor or Claude Desktop. It integrates with execution engines such as Claude Code, Cursor CLI, and Gemini CLI to provide portable and reusable specialized agent workflows.
    1
    441 npm
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    The simplest way to bridge and collaborate across AI Agent sessions like Claude Code, Codex, Gemini, or Cursor. It allows your agents to combine their strengths to solve your most difficult tasks without leaving their current context.
    16 npm
    67
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables two-way delegation between Codex and Cursor agents with background jobs, handoff plans, and isolated worktrees, allowing either editor to offload investigation, review, planning, or implementation to the other and continue the same native session later.
    2 npm
    Apache 2.0