second-opinion-mcp
MCP server that gives any AI coding tool a structured second opinion from another AI provider.
README
second-opinion-mcp
Leia em portugues: Portugues
MCP server that gives any AI coding tool a structured second opinion from another AI provider.
Why This Exists
AI coding assistants hallucinate, miss bugs, and give outdated advice. This server lets them cross-check answers with a different AI provider and get back a machine-readable verdict they can act on. Not chat, not markdown -- fixed JSON schemas with enums (YES/NO, PASS/FAIL), confidence levels, and evidence arrays, all validated with Zod.
Providers
| Provider | Env Key | Default Model | Pricing |
|---|---|---|---|
| Gemini | GEMINI_API_KEY |
gemini-2.5-flash | Free tier available (may require billing enabled on Google Cloud). Paid plans for higher limits |
| OpenAI | OPENAI_API_KEY |
gpt-4.1-mini | Pay-as-you-go (requires billing) |
| Groq | GROQ_API_KEY |
llama-3.3-70b-versatile | Free tier available, paid plans for higher limits |
| DeepSeek | DEEPSEEK_API_KEY |
deepseek-chat | Pay-as-you-go (requires billing) |
Set one API key and the server auto-detects the provider. Detection order: Gemini > OpenAI > Groq > DeepSeek.
Quick Start
Claude Code (one command)
# With Gemini (free tier)
claude mcp add second-opinion -s user -e GEMINI_API_KEY=your-key -- npx @mrssoftwares/second-opinion-mcp
# With OpenAI
claude mcp add second-opinion -s user -e OPENAI_API_KEY=your-key -- npx @mrssoftwares/second-opinion-mcp
# With Groq (free tier)
claude mcp add second-opinion -s user -e GROQ_API_KEY=your-key -- npx @mrssoftwares/second-opinion-mcp
# With DeepSeek
claude mcp add second-opinion -s user -e DEEPSEEK_API_KEY=your-key -- npx @mrssoftwares/second-opinion-mcp
Other MCP Clients (JSON config)
{
"mcpServers": {
"second-opinion": {
"command": "npx",
"args": ["@mrssoftwares/second-opinion-mcp"],
"env": {
"GEMINI_API_KEY": "your-key-here"
}
}
}
}
From Source
git clone https://github.com/mauricioreiss/second-opinion-mcp.git
cd second-opinion-mcp
npm install && npm run build
Tools
second_opinion_ask
Ask a technical question. Returns a verdict, not a wall of text.
| Parameter | Type | Required | Description |
|---|---|---|---|
question |
string | yes | The technical question |
context |
string | no | Additional context |
{
"verdict": "NO",
"confidence": "HIGH",
"answer": "Usar eval() para parsing de JSON e inseguro. Use JSON.parse().",
"evidence": [
"eval() executa codigo arbitrario, permitindo injecao de codigo",
"JSON.parse() rejeita JSON invalido sem executar codigo"
],
"provider": "gemini",
"model": "gemini-2.5-flash"
}
Verdict: YES | NO | PARTIAL | UNCERTAIN. Confidence: HIGH | MEDIUM | LOW.
second_opinion_review
Code review with structured findings per criterion.
| Parameter | Type | Required | Description |
|---|---|---|---|
code |
string | yes | Code or diff to review |
language |
string | no | Language (auto-detected if omitted) |
focus |
string[] | no | Review criteria (default: security, performance, correctness, error-handling) |
{
"verdict": "FAIL",
"score": 3,
"criteria": [
{
"name": "security",
"status": "FAIL",
"findings": [
{
"severity": "HIGH",
"line": 5,
"issue": "SQL injection via string interpolation",
"fix": "Use parameterized queries: db.query('SELECT * FROM users WHERE id = $1', [id])"
}
]
}
],
"summary": "Vulnerabilidade critica de SQL injection encontrada.",
"provider": "gemini",
"model": "gemini-2.5-flash"
}
Verdict: PASS | FAIL | WARNING. Score: 1-10. Finding severity: HIGH | MEDIUM | LOW. Line can be null.
second_opinion_verify
Fact-check a technical claim.
| Parameter | Type | Required | Description |
|---|---|---|---|
claim |
string | yes | The claim to verify |
context |
string | no | Additional context |
{
"verdict": "PARTIAL",
"confidence": "MEDIUM",
"explanation": "Redis WATCH monitora chaves, mas nao garante isolamento total como locks tradicionais.",
"caveats": [
"WATCH usa optimistic locking, nao bloqueia outros clientes",
"A transacao precisa ser re-tentada manualmente apos abort"
],
"docs_to_check": [
"Redis WATCH command docs",
"Redis transactions documentation"
],
"provider": "gemini",
"model": "gemini-2.5-flash"
}
Verdict: YES | NO | PARTIAL | OUTDATED | UNCERTAIN. Confidence: HIGH | MEDIUM | LOW.
second_opinion_compare
Compare two approaches with per-criterion breakdown.
| Parameter | Type | Required | Description |
|---|---|---|---|
approach_a |
{name, description} |
yes | First approach |
approach_b |
{name, description} |
yes | Second approach |
criteria |
string[] | no | Comparison criteria (default: performance, maintainability, complexity, scalability) |
context |
string | yes | Context for the comparison |
{
"winner": "APPROACH_A",
"confidence": "HIGH",
"comparison": [
{
"criterion": "performance",
"winner": "TIE",
"reason": "Ambos operam em microsegundos para operacoes simples de key-value"
},
{
"criterion": "features",
"winner": "APPROACH_A",
"reason": "Redis tem TTL nativo e pub/sub, facilitando gerenciamento de sessoes"
}
],
"recommendation": "Redis e a melhor escolha para sessoes. TTL nativo elimina logica de expiracao manual.",
"provider": "gemini",
"model": "gemini-2.5-flash"
}
Winner: APPROACH_A | APPROACH_B | TIE | DEPENDS. Per-criterion winner: APPROACH_A | APPROACH_B | TIE.
Recommended Usage
Add this to your project's CLAUDE.md (or equivalent AI instructions file):
Before committing critical code (auth, payments, sensitive data),
use the `second_opinion_review` tool to get an external review.
If the verdict is FAIL or score < 6, fix the issues before proceeding.
This is not a chat — it is a structured review with JSON output, numeric score, findings per criterion, and fix suggestions. It integrates into any workflow: CI pipelines, pre-commit hooks, or manual checks.
How It Works
- Your AI tool calls one of the 4 MCP tools with structured input
- The server builds a prompt that forces JSON-only output for the configured provider (Gemini, OpenAI, Groq, or DeepSeek)
- The response goes through a parse pipeline:
JSON.parse-> retry with correction prompt -> regex extraction - The parsed object is validated against a Zod schema. If it passes, the structured verdict is returned to the caller
Every response follows a fixed schema. No markdown, no chat, no surprises.
Configuration
| Variable | Description |
|---|---|
GEMINI_API_KEY |
Google Gemini API key |
OPENAI_API_KEY |
OpenAI API key |
GROQ_API_KEY |
Groq API key |
DEEPSEEK_API_KEY |
DeepSeek API key |
SECOND_OPINION_PROVIDER |
Force a specific provider (skips auto-detection) |
SECOND_OPINION_MODEL |
Force a specific model (overrides provider default) |
Only one API key is required. See .env.example for details and links to get each key.
Limitations
- Responses are in Brazilian Portuguese (pt-BR) by default
- One provider at a time (no multi-provider consensus)
- 30-second timeout per request
- Rate limits depend on your provider plan (free tiers have lower limits; paid plans remove most restrictions)
- Gemini free tier may return 503 errors if billing is not enabled on your Google Cloud project or if you exceed the free quota. If this happens, enable billing at https://console.cloud.google.com/billing or switch to another provider
- LLM responses are non-deterministic; the same input may produce different verdicts across calls
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。