AgentSpawnMCP

AgentSpawnMCP

A universal MCP server for spawning agents with any OpenAI-compatible LLM, supporting cloud and local models, and integrating with Claude Code, OpenCode, and Codex CLI.

Category
访问服务器

README

AgentSpawnMCP

<p align="center"> <img src="docs/assets/agent-spawn-mcp-hero.png" alt="AgentSpawnMCP routing tasks to multiple model agents" width="100%"> </p>

Universal MCP server for any OpenAI-compatible LLM. Supports OpenAI and Anthropic API formats, cloud providers (OpenAI, Grok, Claude, Minimax, DeepSeek) and local models (Ollama, LM Studio, Jan). Built on FastMCP with pure httpx.

Quick Start — Spawn Agents

# No install needed — run directly with uvx
export MINIMAX_TOKEN=your-token
uvx agent-spawn-mcp spawn \
  --name minimax \
  --url https://api.minimax.io/anthropic/v1 \
  --token-env MINIMAX_TOKEN \
  --model MiniMax-M2.7 \
  --api-type anthropic

Or install globally:

pip install agent-spawn-mcp
agent-spawn-mcp spawn --name minimax --url https://api.minimax.io --token-env MINIMAX_TOKEN --model MiniMax-M2.7

API Types

  • --api-type openai (default) — OpenAI-compatible (chat/completions)
  • --api-type anthropic — Anthropic API (v1/messages)

URL versioning

Pass --url pointing directly at the API root. If your base URL already contains a version segment (e.g. …/paas/v4), the client will not re-append v1/. Examples:

Provider --url --api-type
OpenAI https://api.openai.com/v1 openai
Grok https://api.x.ai/v1 openai
z.ai (primary) https://api.z.ai/api/paas/v4 openai
z.ai (coding) https://api.z.ai/api/coding/paas/v4 openai
z.ai Anthropic https://api.z.ai/api/anthropic anthropic
Anthropic https://api.anthropic.com anthropic
Minimax https://api.minimax.io/anthropic/v1 anthropic

Claude Code / OpenCode Integration

Add to your .mcp.json:

{
  "mcpServers": {
    "minimax-agent": {
      "command": "uvx",
      "args": ["agent-spawn-mcp", "spawn",
               "--name", "minimax",
               "--url", "https://api.minimax.io/anthropic/v1",
               "--token", "your-minimax-token",
               "--model", "MiniMax-M2.7",
               "--api-type", "anthropic"]
    },
    "claude-agent": {
      "command": "uvx",
      "args": ["agent-spawn-mcp", "spawn",
               "--name", "claude",
               "--url", "https://api.anthropic.com",
               "--token", "your-anthropic-token",
               "--model", "claude-sonnet-4-20250514",
               "--api-type", "anthropic"]
    },
    "glm-agent": {
      "command": "uvx",
      "args": ["agent-spawn-mcp", "spawn",
               "--name", "glm",
               "--url", "https://api.z.ai/api/paas/v4",
               "--token", "your-zai-token",
               "--model", "glm-5.1"]
    },
    "glm-turbo-agent": {
      "command": "uvx",
      "args": ["agent-spawn-mcp", "spawn",
               "--name", "glm-turbo",
               "--url", "https://api.z.ai/api/paas/v4",
               "--token", "your-zai-token",
               "--model", "glm-5-turbo"]
    }
  }
}

Gotchas:

  • Each entry in .mcp.json must use a unique --name — it becomes the tool name {name}_agent, and duplicates collide.
  • --token on the command line is visible in ps output and some crash logs. Prefer keeping the MCP config file read-protected (chmod 600).

Codex CLI Integration

Codex can register stdio MCP servers with codex mcp add.

For a Minimax Anthropic-compatible agent:

export MINIMAX_TOKEN=your-minimax-token

codex mcp add minimax-agent -- \
  uvx agent-spawn-mcp spawn \
    --name minimax \
    --url https://api.minimax.io/anthropic/v1 \
    --token-env MINIMAX_TOKEN \
    --model MiniMax-M2.7 \
    --api-type anthropic

For z.ai GLM through the OpenAI-compatible API:

export ZAI_TOKEN=your-zai-token

codex mcp add glm-agent -- \
  uvx agent-spawn-mcp spawn \
    --name glm \
    --url https://api.z.ai/api/paas/v4 \
    --token-env ZAI_TOKEN \
    --model glm-5.1

Verify the registration:

codex mcp list
codex mcp get minimax-agent

Restart Codex from a shell where the token env var is set. The tool exposed to Codex is named from --name, for example minimax_agent or glm_agent.

If you need Codex to store the env var with the MCP server config, add --env MINIMAX_TOKEN="$MINIMAX_TOKEN" before --. This is convenient, but it stores the secret in Codex config. Passing --token directly also works, but stores the token in the command args.

Tools Exposed

  • {name}_agent(task, model?, system_prompt?, temperature?, max_tokens?, timeout?) — Spawn agent
  • agent_info() — Get provider info

max_tokens behaviour

The client imposes no cap. Behaviour when max_tokens is omitted depends on --api-type:

  • openai — the field is simply not sent; the provider falls back to its own default (usually the model's full output budget). Reasoning models like GLM-5.x can burn huge amounts on chain-of-thought, so pass an explicit limit for short tasks.

  • anthropic — the Anthropic API requires the field, so when you omit it the client fills in a safe default of 16384. Override when you need more or want to cap spend:

    claude_agent(task="summarise this PR")                    # uses 16384
    claude_agent(task="exhaustive review", max_tokens=64000)  # bigger
    claude_agent(task="ping",              max_tokens=256)    # cheaper
    

    Typical values:

    Use case max_tokens
    Short answer / ping 1024
    Summary / routine agent run 4096
    Code generation / long task 8192
    Default (if omitted) 16384
    Exhaustive analysis 32000+

    Upper bound is model-specific (Claude Sonnet 4 — 64k, Opus 4 — 32k, GLM-4.5-Air — 8k, etc.). Pass max_tokens explicitly up to that limit.

Return Format

{
    "result": "...",  # Agent response text
    "metadata": {
        "provider": "minimax",
        "model_used": "MiniMax-M2.7",
        "usage": {"prompt_tokens": 100, "completion_tokens": 500},
        "latency_ms": 2340
    }
}

AgentSpawnMCP — Full Server

Full MCP server with all tools (chat, vision, files, search, agent). Requires git clone.

git clone https://github.com/sandsaber/AgentSpawnMCP
cd AgentSpawnMCP
uv sync
cp example.env .env
# Edit .env with your tokens

uv run python main.py main --provider grok

Auto-Discovery

Providers auto-detected when env var is set:

Env Var Provider
XAI_TOKEN Grok
OPENAI_TOKEN OpenAI
GROQ_TOKEN Groq
DEEPSEEK_TOKEN DeepSeek
ZAI_TOKEN z.ai (GLM)

Available Tools (Full Server)

Tool Description
list_providers All discovered providers
list_models Models for the active provider
chat Text completion with session history
stateful_chat Server-side conversation
chat_with_vision Analyze images (jpg/jpeg/png)
generate_image Create or edit images (OpenAI-format only)
upload_file / list_files / get_file_content / delete_file File management
chat_with_files Chat with documents
web_search Agentic web search
code_executor Execute code
agent Unified agent
list_chat_sessions / get_chat_history / clear_chat_history Session history

Image generation support

generate_image targets the OpenAI /images/generations request shape (model / prompt / n / image_url). Providers that expose the same shape (OpenAI dall-e-3, Grok grok-imagine-image) work out of the box.

Providers with custom image APIs are not currently supported:

  • z.ai (glm-image, cogview-4-250304) expects quality / size / user_id at /paas/v4/images/generations, not the OpenAI shape.
  • Anthropic-compat endpoints don't expose image generation at all.

For these, use the provider's native HTTP API directly.

License

MIT License. Copyright (c) 2026 Michael Makarov.

See LICENSE for the full license text.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选