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
Visit Server

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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured