mcp-second-opinion

mcp-second-opinion

An MCP server that queries a panel of LLMs from different providers via OpenRouter and returns their answers side by side, optionally synthesizing them to highlight disagreements.

Category
访问服务器

README

mcp-second-opinion

CI License: MIT TypeScript

An MCP server that gets you a second opinion. It asks the same question to a panel of LLMs from different providers — in parallel, through a single OpenRouter key — and hands back every answer side by side. Optionally it synthesizes them, and is told to surface where the models disagree instead of averaging it into a confident-sounding blur.

One model can be confidently wrong. A panel that's forced to disagree is much harder to fool — so give your agent (Claude Desktop, or any MCP client) the ability to check a claim against three minds before trusting one.

You → second_opinion("Is this SQL injection-safe?", synthesize: true)

  ## openai/gpt-4o-mini      → "Yes, parameterised — safe."
  ## anthropic/claude-3.5-haiku → "No — the ORDER BY clause is interpolated."
  ## google/gemini-2.5-flash → "Safe for the WHERE clause; ORDER BY is a risk."

  ## 🔎 Synthesis
  Disagreement: the ORDER BY interpolation. Two of three flag it. Bottom line: not safe.

Why

  • Cross-provider by design. OpenRouter proxies OpenAI / Anthropic / Google / Meta / … behind one OpenAI-compatible endpoint, so a real multi-provider panel needs only one API key.
  • Resilient by construction. Each member runs with a per-attempt timeout, bounded retries with backoff + jitter on transient failures (429 / 5xx / network), and fast-fail on permanent ones (400/401/404). A slow or failing model is reported as one failed answer — it never sinks the batch. All covered by tests.
  • Bounded & honest about cost. Fan-out is capped (concurrency limit + max panel size + dedup of repeated ids), and every answer reports its token usage with a running total — you can see what N opinions cost.
  • Disagreement is the point. The synthesizer is explicitly instructed to name conflicts, not smooth them away.

Install

Requires Node ≥ 18 and an OpenRouter API key (free to create at https://openrouter.ai/keys).

git clone https://github.com/aleksbuss/mcp-second-opinion.git
cd mcp-second-opinion
npm install
npm run build

Add it to Claude Desktop

Edit claude_desktop_config.json (Claude → Settings → Developer → Edit Config):

{
  "mcpServers": {
    "second-opinion": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-second-opinion/dist/index.js"],
      "env": {
        "OPENROUTER_API_KEY": "sk-or-..."
      }
    }
  }
}

Restart Claude Desktop; the second_opinion and list_panel_models tools appear.

Tools

second_opinion

arg type notes
prompt string (required) The question to put to the panel.
models string[] (optional) OpenRouter model ids (max 8, deduped). Omit to use the default panel.
synthesize boolean (optional) If true, a synthesizer model compares the answers.
system string (optional) System prompt sent to every model.
max_tokens number (optional) Max output tokens per model. Defaults to the server setting.
temperature number 0–2 (optional) Sampling temperature (0 = deterministic). Defaults to the server setting.

Returns an error result to the client only when every model fails; a partial panel is still a useful answer.

list_panel_models

Returns the configured default panel and how to override it. No arguments.

Configuration (environment)

var required default
OPENROUTER_API_KEY
SECOND_OPINION_MODELS openai/gpt-4o-mini, anthropic/claude-3.5-haiku, google/gemini-2.5-flash-lite
SECOND_OPINION_SYNTH openai/gpt-4o-mini
SECOND_OPINION_TIMEOUT_MS 60000 (per attempt)
SECOND_OPINION_MAX_TOKENS 1024
SECOND_OPINION_TEMPERATURE 0.7
SECOND_OPINION_CONCURRENCY 4

Any model id on https://openrouter.ai/models works. Pick a cheap, fast panel — you're paying for N calls per question.

Develop

npm run typecheck   # tsc --noEmit
npm test            # vitest (mocks fetch; no network, no key needed)
npm run build       # → dist/
npm run dev         # run from source via tsx

The logic is split so it's testable without a network or a key — fetch and sleep are injected:

  • src/openrouter.ts — the HTTP client: status handling, retry/backoff, HTTP-200-with-error bodies, timeouts, token usage. (tests)
  • src/panel.ts — fan-out with bounded concurrency, dedup, the resilience invariant, and synthesis. (tests)
  • src/config.ts — pure config parsing (models, caps, env). (tests)

49 tests, run on Node 18, 20 & 22 in CI.

Engineering contracts and the failures that shaped them are written down in CLAUDE.md and POST_MORTEMS.md — small project, but the same habit.

Security & limitations

  • The panel's answers are unverified model output. This tool returns raw text from third-party LLMs (and, on failure, truncated provider error bodies) straight into the caller's context. If an agent calls this autonomously on attacker-influenced input, treat the answers as data, not instructions — they are a prompt-injection surface, like any MCP tool that returns external content. The output is intentionally not wrapped in trust markers because the tool's whole purpose is to show you what the models said; the trust boundary is the caller's responsibility.
  • BYOK, and you pay per question × per model. There is no spend cap — max_tokens bounds output length but not model choice. Keep the default panel cheap; don't point it at a panel of frontier models by accident.
  • Single-operator / local trust model. Designed to run locally next to an MCP client (Claude Desktop) with your own key in the environment. The key is never logged.

License

MIT © Aleksejs Buss

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选