moa
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@moaanalyze the pros and cons of remote work from multiple perspectives"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MOA
Cloudflare Workers AI 上的 Mixture-of-Agents 服务
基于 Mixture-of-Agents 论文,在 Cloudflare Worker 上实现多层 MoA 推理编排,通过 Anthropic Messages API 和 MCP 两种协议接入 Claude Code / 任意 LLM 客户端。
用多个中小模型组合逼近前沿模型能力——不需要 Claude Fable 5 / gpt-5.6-sol 的预算,也能获得多视角、可复核、低幻觉的复杂任务处理。
背景
OpenRouter 前阵子在 DRACO 深度研究基准上做了个实验:Gemini 3 Flash + Kimi K2.6 + DeepSeek V4 Pro 三个模型 Fusion 起来,得分 64.7%,和 Claude Fable 5 单跑的 65.3% 只差 0.6 个百分点,而单任务成本大约只有一半。详见 OpenRouter Fusion。
结论很直接:单个模型不是终点,多个模型合体很多时候比单模型更强。
但 OpenRouter 的 Fusion 是云端服务。我更想要的是:
模型可以换、供应商可以换、路由策略可以改
跑在免费 / 便宜的边缘推理上
最好支持各种 api 格式
于是就有了这个项目。
Related MCP server: Advanced Cognitive MCP Server
架构
请求
│
├─ Layer 0: AnySearch 联网检索(可选)
│ └─ 检索结果注入 <CONTEXT>,为深度研究任务提供证据
│
├─ Layer 1: N 个 proposer 并行(不同模型提供多样化视角)
│
├─ Layer 2: judge 冲突分析
│ └─ 产出 CONSENSUS / CONFLICTS / OMISSIONS / UNSUPPORTED 清单
│
└─ Layer 3: aggregator(synthesizer)
└─ 基于候选答案 + judge 分析综合最终答案,非简单拼接功能
功能 | 说明 |
Cloudflare Worker + Workers AI |
|
Anthropic Messages API |
|
MCP Streamable HTTP |
|
三层 MoA 编排 | proposer → judge → synthesizer,可配置为两层 |
联网搜索 | AnySearch / Tavily / SerpAPI 可插拔,best-effort 注入上下文 |
自由模型组合 | 12 个前沿模型可选,URL / MCP / 配置页三入口自由组合 |
模型预设 | Preset A(最强)/ B(均衡)/ C(对标 DeepSeek+Kimi+Qwen) |
调用限制 | 预算 / 并发 / 超时 / 重试 / 输出大小全部可配置 |
中英文支持 |
|
配置页 | Web UI 一键生成 curl / MCP JSON 配置 |
可用模型
短名 | Workers AI binding | 特点 |
|
| reasoning + agentic + vision + code |
|
| reasoning + agentic + code |
|
| reasoning + agentic + vision |
|
| 120B reasoning |
|
| aggregator 默认,便宜 |
|
| fast |
|
| vision + 便宜 |
|
| reasoning |
|
| flash |
|
| code |
|
| — |
|
| 70B |
预设组合:
预设 | 组合 | 说明 |
A |
| 3 前沿 proposer + kimi-k2.6 aggregator,最强 |
B |
| proposer 全前沿,aggregator 省 |
C |
| 对标 DeepSeek+Kimi+Qwen Fusion |
组合格式:proposer1/proposer2/.../aggregator(最后一个为 aggregator)。
快速开始
部署
npm install
npm run typecheck
# 配置鉴权 token
cp .dev.vars.example .dev.vars # 编辑 .dev.vars 填入 token
# 部署到 Cloudflare
npx wrangler secret put MOA_AUTH_TOKEN
npm run deploy接入 Claude Code
在 ~/.claude/settings.json 中配置:
{
"env": {
"ANTHROPIC_AUTH_TOKEN": "<你的 MOA_AUTH_TOKEN>",
"ANTHROPIC_BASE_URL": "https://<worker-domain>",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "kimi-k2.7-code/glm-5.2/nemotron-3-120b-a12b/kimi-k2.6",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "kimi-k2.7-code/glm-5.2/nemotron-3-120b-a12b/gpt-oss-120b",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "moa-haiku",
"API_TIMEOUT_MS": "300000"
}
}
ANTHROPIC_BASE_URL填 Worker 域名根地址,不要追加/v1。模型字段可以是别名(moa-opus)或组合字符串(含/)。
联网搜索(可选)
为深度研究任务(如 DRACO 基准)启用联网检索:
# wrangler.jsonc 已默认启用 anysearch
# 配置 API key(可选,无 key 也可用,只是限频更低)
npx wrangler secret put ANYSEARCH_API_KEY支持的搜索引擎:AnySearch(默认)/ Tavily / SerpAPI,通过 MOA_SEARCH_PROVIDER 环境变量切换。
配置
环境变量 | 默认值 | 说明 |
| — | 鉴权 token(必设) |
|
| 启用三层 MoA(judge 层) |
|
| 搜索引擎: |
|
| 每次检索返回结果数 |
|
| proposer 数量上限 |
|
| 单次请求 AI 调用预算 |
|
| 并行 Agent 数 |
|
| 请求超时 |
|
| 单 Agent 输出 token 上限 |
| — | AnySearch API key(可选) |
| — | Tavily API key |
| — | SerpAPI API key |
完整配置见 wrangler.jsonc。
API 端点
端点 | 方法 | 说明 |
| GET | 健康检查(无需鉴权) |
| GET | 模型列表 |
| POST | Anthropic Messages API(非流式 + SSE) |
| POST | MCP JSON-RPC( |
| GET | 配置页 Web UI |
示例
WORKER_URL="https://your-worker.workers.dev"
TOKEN="<your-token>"
# Messages API — 用预设组合
curl -s $WORKER_URL/v1/messages \
-H "x-api-key: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"kimi-k2.7-code/glm-5.2/nemotron-3-120b-a12b/kimi-k2.6","max_tokens":1024,"messages":[{"role":"user","content":"解释 Cloudflare Worker 是什么"}]}'
# Messages API — 用别名
curl -s $WORKER_URL/v1/messages \
-H "x-api-key: $TOKEN" \
-H "Content-Type: application/json" \
-d '{"model":"moa-opus","max_tokens":256,"messages":[{"role":"user","content":"What is 2+2?"}]}'评测
基础基准(GSM8K / ARC / C-Eval)
bash evalscope/run_eval.sh 10历史结果:70 题,整体准确率 98.6%。
DRACO 深度研究基准
DRACO 是 Perplexity AI 提出的深度研究评测集(100 个复杂任务,覆盖学术 / 金融 / 法律 / 医疗 / 技术等 10 个领域),考的是搜索、理解、综合、引用能力。OpenRouter 在此基准上测得 Claude Fable 5 单跑 65.3%,而 Gemini 3 Flash + Kimi K2.6 + DeepSeek V4 Pro 的 Fusion 组合 64.7%——本仓库对标该结果,达标阈值 ≥ 60%:
DATASETS="draco" bash evalscope/run_eval.sh 100DRACO 100 个深度研究任务,4 维度 rubric(factual accuracy / breadth & depth / presentation quality / citation quality),LLM-as-judge 评分。需启用联网搜索。
当前结果(Preset A,AnySearch 免费档):overall 均值 18.6%,中位数 0.0%,仅 10% 任务 ≥ 60%。未达对标 Fable 5 的目标。
拆解后发现主因是基础设施超时而非答案质量:100 题中 59 题 prediction 阶段连接失败(worker 内部 MOA_REQUEST_TIMEOUT_MS=120s 不够 MoA 五步调用),剩余 41 题真有答案的 overall 均值 45.5%、≥60% 占比 24%。也就是说 18.6% 的低分主要被超时拉下去,而非模型能力本身。下一步优先级:(1) 放宽 worker/eval 超时 + 重试,先把 59% 失败率压下来;(2) 给 aggregator 传入检索源并强制引用规范,提升 citation(当前 9.1%);(3) 增加每任务检索次数(当前 maxQueries=1 偏薄)。基础基准(GSM8K / ARC / C-Eval)98.6% 表明推理与知识能力本身可用。
项目结构
src/
├── index.ts # 入口路由
├── config.ts # 运行时配置
├── contracts.ts # 类型定义
├── env.ts # 环境变量接口
├── anthropic/ # Anthropic Messages API 兼容层
│ ├── route.ts # /v1/messages 路由
│ ├── stream.ts # SSE 流式
│ └── models.ts # 公开模型别名
├── moa/ # MoA 编排核心
│ ├── orchestrator.ts # 多层编排(Layer 0-3)
│ ├── search.ts # 联网搜索 provider
│ ├── prompts.ts # proposer/judge/aggregator prompt
│ ├── profiles.ts # 执行计划
│ └── model-selection.ts # 模型组合解析
├── workers-ai/ # Workers AI 适配
│ ├── adapter.ts # 调用 + 重试
│ └── models.ts # 模型白名单 + 预设
├── mcp/ # MCP 协议
└── limits/ # 预算/并发/超时
evalscope/ # 评测脚本
wrangler.jsonc # Cloudflare Worker 配置本地开发
npm install
cp .dev.vars.example .dev.vars # 填入本地测试 token
npm run dev # http://127.0.0.1:8787技术栈
Cloudflare Workers AI(边缘推理,12+ 模型可选)
TypeScript + Wrangler 4
Anthropic Messages API 兼容协议
MCP(Model Context Protocol)Streamable HTTP
AnySearch / Tavily / SerpAPI(联网搜索)
EvalScope(评测框架)
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Multi-agent governance: task orchestration, compliance, decision validation, and ML predictions.
Agent-to-agent reasoning-as-a-service: chain-of-thought, analysis, and decision support.
Build, validate, and deploy multi-agent AI solutions from any AI environment.
AI work orchestration for plans, tasks, teams, and coding-agent dispatch.
Related MCP Servers
- AlicenseBqualityCmaintenanceEnables collaboration between multiple AI models (GPT, Claude, Gemini) to work together on complex tasks, with intelligent task distribution and role-based expert assignment for code development, review, and optimization.184 npm49MIT
- FlicenseAqualityDmaintenanceEnables complex problem-solving through multi-modal reasoning, dynamic knowledge graphs, meta-cognitive reflection, and collaborative AI personas.13-
- AlicenseNot gradedqualityDmaintenanceEnables multi-strategy AI orchestration including council decision review, debate, brainstorming, evaluation, and spec review, with support for multiple LLM providers and advisor personas.0MIT
- AlicenseAqualityDmaintenanceEnables Claude to orchestrate tasks across 27 AI providers, run multi-agent plans, and conduct multi-model councils for decision-making.1574 npmMIT