Skip to main content

Second Opinion MCP

Get independent AI reviews from Claude Code, DeepSeek V4 Pro, Kimi K3 (Moonshot), OpenAI (ChatGPT), and 300+ OpenRouter models through any MCP client.

What It Does

When working with Codex, Claude Code, Claude Desktop, or another MCP client, this server lets you:

  • Get alternative perspectives on code, architecture, and decisions
  • Run systematic code reviews with severity-classified issues
  • Stage multi-model debates where AI models argue opposing positions
  • Challenge proposals with anti-sycophancy mode (finds weaknesses, not validation)
  • Review architectural plans before coding begins
  • Review implementations against their original plans

Quickstart

1. Install

Windows

# Install Python 3.10+ from python.org if not installed
# Then install pipx
pip install pipx
pipx ensurepath

# Restart your terminal, then install
pipx install second-opinion-mcp

macOS

# Install Python 3.10+ via Homebrew if not installed
brew install python@3.12

# Install pipx
pip3 install pipx
pipx ensurepath

# Restart your terminal, then install
pipx install second-opinion-mcp

Linux (Ubuntu/Debian)

# Install Python and pipx
sudo apt update
sudo apt install python3 python3-pip python3-venv
pip3 install pipx
pipx ensurepath

# Restart your terminal, then install
pipx install second-opinion-mcp

Linux (Fedora/RHEL)

sudo dnf install python3 python3-pip
pip3 install pipx
pipx ensurepath

# Restart your terminal, then install
pipx install second-opinion-mcp

2. Setup

Run the interactive setup wizard:

second-opinion-mcp setup

The wizard will guide you through selecting providers and entering API keys. Keys are stored securely in your system's credential manager.

The wizard automatically verifies your setup when it finishes. To re-check later:

second-opinion-mcp verify

After setup completes, see Client Integration below for instructions specific to your MCP client.

Client Integration

After running the setup wizard, register the MCP server with your client.

The setup wizard is optional when you only want claude_second_opinion. That tool uses the Claude Code CLI's existing Claude Max login and does not require an API key. The seven API-backed tools remain listed but return configuration errors until their required providers are configured.

Claude Code CLI

Register the server:

claude mcp add -s user second-opinion -- second-opinion-mcp

The server auto-detects which providers have credentials configured (v0.8.0+). To restrict to specific providers, use the env var:

claude mcp add -s user second-opinion -e SECOND_OPINION_PROVIDERS="deepseek,moonshot" -- second-opinion-mcp

Restart Claude Code after registering.

Verify the server is registered:

claude mcp list | grep second-opinion

Codex CLI

Install Claude Code, run claude once to sign in with your Claude Max account, then register this stdio server:

codex mcp add second-opinion -- second-opinion-mcp

Verify the registration with codex mcp list. Codex can then call claude_second_opinion for difficult, ambiguous, or high-impact work.

Opus 5 xhigh reviews can run for several minutes. Set the MCP tool timeout to at least 630 seconds; 660 seconds leaves a small margin. Put this block in ~/.codex/config.toml; the 30-second startup timeout leaves room for the bounded Claude Max login check:

[mcp_servers.second-opinion]
startup_timeout_sec = 30.0
tool_timeout_sec = 660.0

[mcp_servers.second-opinion.tools.claude_second_opinion]
approval_mode = "approve"

The per-tool approval lets Codex consult Claude automatically while leaving the server's other tools under their existing approval policy.

claude_second_opinion is intended for Codex and other non-Claude clients. It refuses calls from inside Claude Code to prevent recursive Claude sessions; the other MCP tools remain available to Claude Code as before.

Claude Desktop App

Add to your claude_desktop_config.json:

Windows: %APPDATA%\Claude\claude_desktop_config.json

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "second-opinion": {
      "command": "second-opinion-mcp"
    }
  }
}

The server auto-detects providers from credentials (v0.8.0+). To restrict to specific providers, add an env block with "SECOND_OPINION_PROVIDERS": "deepseek,moonshot".

Restart Claude Desktop after saving. To verify, start a new conversation and check that the second-opinion tools appear in the available tools list.

OpenClaw

OpenClaw uses mcporter for MCP server integration.

Step 1: Run the setup wizard

second-opinion-mcp setup

This stores your API keys in ~/.second-opinion-config:

{
  "credentials": {
    "deepseek": "sk-...",
    "moonshot": "sk-..."
  }
}

Step 2: Install mcporter

npm install -g mcporter

Step 3: Add to mcporter config

Create or edit ~/.mcporter/mcporter.json:

{
  "mcpServers": {
    "second-opinion": {
      "command": "second-opinion-mcp",
      "env": {
        "SECOND_OPINION_PROVIDERS": "deepseek,moonshot",
        "SECOND_OPINION_ALLOWED_ROOTS": "/opt/openclaw"
      }
    }
  }
}

Note: API keys are NOT in mcporter config. They stay in ~/.second-opinion-config, separate from server registration.

Step 4: Verify

mcporter list
mcporter tools second-opinion

OpenClaw automatically discovers servers configured in mcporter.

Other MCP Clients

For other MCP-compatible clients, the server requires:

  • Command: second-opinion-mcp
  • Optional: SECOND_OPINION_PROVIDERS=deepseek,moonshot to restrict providers (auto-detected from credentials by default)

Refer to your client's documentation for how to add stdio-based MCP servers.

Supported Models

DeepSeek V4 Pro (Recommended)

Extended thinking model with 1M context. Best for code reviews and complex analysis.

Kimi K3 (Moonshot)

Chinese AI model with thinking mode. Good for alternative perspectives and debates.

OpenAI (ChatGPT)

GPT-5.6 Sol (OAuth only), running at xhigh reasoning effort. Good for architectural reviews and implementation analysis.

The recommended way to authenticate is via the built-in OAuth login, which provides free access for ChatGPT Plus subscribers. Run the setup wizard and choose "Login with ChatGPT Plus (OAuth)":

second-opinion-mcp setup
# Select OpenAI, choose "Login with ChatGPT Plus (OAuth)"
# Browser opens for sign-in, tokens stored automatically

On headless systems (SSH, Docker), the wizard uses a device code flow instead: it displays a URL and code to enter on any device with a browser.

Two authentication methods are supported (checked in this order):

  1. Built-in OAuth token from setup wizard (free for ChatGPT Plus, stored in ~/.second-opinion-config)
  2. Codex CLI OAuth token from ~/.codex/auth.json (fallback if Codex CLI is installed)

Tokens are automatically refreshed when expired. The API-key authentication path is not available (the server is OAuth-only for OpenAI).

OpenRouter (Optional)

Access 300+ models through a single API. Enable for variety or specific model access.

Claude Code (Claude Max)

Claude Opus 5 runs through the locally installed Claude Code CLI at xhigh effort. Before every call, the adapter verifies that claude auth status --json reports a claude.ai login with subscription type max. It removes Anthropic API/provider overrides from the child environment and rejects other active credential methods, including an apiKeyHelper. It never reads or stores Claude credentials itself.

Available Tools

second_opinion

Get a straightforward second opinion on any question, code, or decision.

Use second_opinion to review this database schema: [paste schema]

claude_second_opinion

Ask Claude Opus 5 at xhigh effort for an independent opinion using your local Claude Max login. This tool is for Codex and other non-Claude MCP clients; it refuses recursive use from inside Claude Code. The tool is text-only and gives Claude no filesystem, shell, browser, skill, or MCP tools. Include all relevant code, diffs, errors, and constraints in prompt or context.

Use claude_second_opinion to challenge this implementation plan: [paste plan]

challenge

Anti-sycophancy mode. The model is instructed to find weaknesses, not validate.

Use challenge to critique: "We should use a global singleton for database connections"

code_review

Systematic directory-based code review with BLOCKER/CRITICAL/MAJOR/MINOR classifications.

Use code_review on directory="./src" with focus_areas=["security", "performance"]

consensus

3-way debate where DeepSeek, Moonshot, and OpenAI share independent opinions, cross-critique, and optionally rebut. Returns structured transcript plus synthesis directive for Claude Code client (Opus 4.7 at extended/high thinking budget).

Use consensus to debate: "GraphQL vs REST for internal microservices"

review_synthesis

Full workflow: three parallel reviews (DeepSeek, Moonshot, OpenAI), debate via consensus, then synthesis instructions for the client.

Perform a comprehensive code review of ./myproject using review_synthesis

architect_review

Review an implementation plan before coding begins. Identifies architectural risks, missing edge cases, security gaps, and over-engineering. Defaults to OpenAI if enabled.

Use architect_review to review this plan: [paste plan document]
Use architect_review with context="We're building a REST API for a fintech startup"
to review: [paste design document]

implementation_review

Review actual code changes after implementation, optionally against the original plan. Analyzes for bugs, security issues, and quality. Defaults to OpenAI if enabled.

Use implementation_review on directory="./src"
Use implementation_review on directory="./src" with plan="[paste original plan]"
and save_to="./docs/reviews"

New in v0.9.0: consensus and review_synthesis are 3-way and delegate final synthesis to the Claude Code client (designed for Opus 4.7 with extended thinking at high budget). The consensus tool no longer accepts stances or include_reasoning parameters; it returns raw material + a synthesis directive. The fast parameter is removed from all tools (single-model policy).

Usage Examples

Thorough Code Review Workflow

For comprehensive code reviews, use this prompt pattern with Claude Code:

MyProject: perform a comprehensive deep parallel code review with deepseek and kimi
using mcp server second-opinion - save resulting md files to the project folder
to the docs subfolder in md format.

After that perform Consensus debate + arbiter synthesis using same mcp server tools
with opus 4.5 compiling a final document for the final review.

First 2 tasks can be run in parallel.

This triggers parallel code_review calls to DeepSeek and Moonshot, then a consensus debate on findings, and finally Claude synthesizes the final review document.

Plan-Then-Review Workflow

Use architect_review before coding and implementation_review after:

1. Use architect_review to review my plan: [paste plan]
2. [Make changes based on feedback]
3. Use implementation_review on directory="./src" with plan="[paste plan]"

Quick Second Opinion

Use second_opinion to review this database schema:
CREATE TABLE users (
  id SERIAL PRIMARY KEY,
  email VARCHAR(255),
  password VARCHAR(255)
);

Critical Challenge

Use challenge to critique this proposal: "We should use a global singleton for
database connections because it's simpler"

Consensus Debate

Use consensus to debate: "GraphQL vs REST for our internal microservices API"

Code Review with Focus Areas

Use code_review on directory="./src" with focus_areas=["security", "error-handling"]
and save_to="./docs/reviews"

Configuration

Changing Providers

To reconfigure which providers are enabled, run the setup wizard again:

second-opinion-mcp setup

Or re-register the server with specific providers:

# Auto-detect all configured providers (default)
claude mcp add -s user second-opinion -- second-opinion-mcp

# Restrict to specific providers
claude mcp add -s user second-opinion -e SECOND_OPINION_PROVIDERS="deepseek,moonshot" -- second-opinion-mcp

API Key Management

Credentials are stored using platform-appropriate storage:

Platform Storage Location
Windows Windows Credential Manager
macOS (GUI) macOS Keychain
macOS (headless/SSH) ~/.second-opinion-config
Linux ~/.second-opinion-config

On Linux and headless macOS, credentials are stored in ~/.second-opinion-config with SSH-style permissions (600). This is the same security model used by SSH private keys.

OpenAI OAuth tokens are stored in ~/.second-opinion-config under openai_oauth and automatically refreshed at runtime. Codex CLI tokens from ~/.codex/auth.json are also supported as a fallback.

To update keys:

second-opinion-mcp setup

Or manually edit ~/.second-opinion-config (Linux/macOS headless):

{
  "credentials": {
    "deepseek": "sk-YOUR_DEEPSEEK_KEY",
    "moonshot": "YOUR_MOONSHOT_KEY",
    "openrouter": "sk-or-YOUR_OPENROUTER_KEY",
    "openai": "sk-YOUR_OPENAI_KEY"
  }
}

Then set permissions: chmod 600 ~/.second-opinion-config

Troubleshooting

"No API key configured" Error

Run the setup wizard again:

second-opinion-mcp setup

For OpenAI specifically, you can also authenticate via the setup wizard OAuth flow or Codex CLI:

# Recommended: built-in OAuth login
second-opinion-mcp setup  # Choose "Login with ChatGPT Plus (OAuth)"

# Alternative: Codex CLI
codex login

Connection Timeout

Check firewall, VPN, or proxy settings. Both DeepSeek (api.deepseek.com) and Moonshot (api.moonshot.ai) must be accessible.

Rate Limit Exceeded

Moonshot has rate limits (3 concurrent, 20 RPM at Tier 0). Wait a minute and retry.

Tool Not Found in Claude

Verify registration:

claude mcp list

If not listed, re-register:

claude mcp add -s user second-opinion -- second-opinion-mcp

Advanced Usage

Include Reasoning

See the model's chain-of-thought:

Use second_opinion with include_reasoning=true to analyze this algorithm

Focus Areas for Reviews

Use code_review with focus_areas=["security", "error-handling", "performance"]

Save Review Output

Use code_review on directory="./src" with save_to="./docs/reviews"

Updating

The server checks for updates on startup and notifies you if a new version is available.

To update manually:

pipx upgrade second-opinion-mcp

Or reinstall:

pipx uninstall second-opinion-mcp
pipx install second-opinion-mcp

Your API keys are preserved in the system keyring across updates.

Uninstalling

# Remove from Claude
claude mcp remove second-opinion

# Optional: remove stored API keys BEFORE uninstalling (requires pipx venv Python)
SOPYTHON=~/.local/share/pipx/venvs/second-opinion-mcp/bin/python3
$SOPYTHON -c "import keyring; keyring.delete_password('second-opinion', 'deepseek')"
$SOPYTHON -c "import keyring; keyring.delete_password('second-opinion', 'moonshot')"
$SOPYTHON -c "import keyring; keyring.delete_password('second-opinion', 'openrouter')"
$SOPYTHON -c "import keyring; keyring.delete_password('second-opinion', 'openai')"

# Uninstall package
pipx uninstall second-opinion-mcp

Security

API keys are stored in your OS keyring, not in environment variables or config files. OpenAI OAuth tokens are stored in ~/.second-opinion-config and refreshed automatically. Codex CLI tokens from ~/.codex/auth.json are also supported as a fallback. The code review tool:

  • Skips .env files, credentials, SSH keys, and certificates
  • Validates directories against allowed roots
  • Detects symlinks to prevent traversal attacks
  • Limits content size to prevent memory exhaustion

claude_second_opinion does not handle Claude credentials. It verifies an active Claude Max subscription through the CLI, launches Claude Code in safe mode from a neutral temporary directory, removes Anthropic API/provider environment overrides, passes the request over stdin, disables all tools, limits the run to one turn, and does not persist the session.

Cost Estimates

Per operation (typical usage):

Tool Approximate Cost
second_opinion / challenge ~$0.001
claude_second_opinion Claude Max subscription usage
code_review ~$0.01-0.05
consensus (2 rounds) ~$0.004-0.010
review_synthesis ~$0.02-0.10
architect_review ~$0.01-0.03
implementation_review ~$0.01-0.05

OpenAI costs are higher per token than DeepSeek/Moonshot. Using OAuth login with ChatGPT Plus provides free access (subject to rate limits). OAuth flow ported from OpenClaw (MIT, github.com/openclaw/openclaw).

License

MIT License. See LICENSE file.

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

second_opinion_mcp-0.11.0.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

second_opinion_mcp-0.11.0-py3-none-any.whl (59.1 kB view details)

Uploaded Python 3

File details

Details for the file second_opinion_mcp-0.11.0.tar.gz.

File metadata

  • Download URL: second_opinion_mcp-0.11.0.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for second_opinion_mcp-0.11.0.tar.gz
Algorithm Hash digest
SHA256 5bb94c18d865e32b0071106f58b894ea3e39e5e62ab68d5ffab639f952ae82ab
MD5 e030f59e65bdf63a065490e286e1c90a
BLAKE2b-256 35a011fff1c9d27e2b0ab2737cfffb9eb1650f494b6ec3ab9b4f744d907f7baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for second_opinion_mcp-0.11.0.tar.gz:

Publisher: publish.yml on MarvinFS/second-opinion-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file second_opinion_mcp-0.11.0-py3-none-any.whl.

File metadata

File hashes

Hashes for second_opinion_mcp-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c761921a8239697dc42b6c1ab7c4a6eefce5d4cc8a2bc9e891b9412631b1046e
MD5 4bc6cd2330b513a825601a6cfb63a95a
BLAKE2b-256 1b8c946e80ffff591a7b38df3961fd65ec6ab8bc2178d095dbb2c3f198671e6b

See more details on using hashes here.

Provenance

The following attestation bundles were made for second_opinion_mcp-0.11.0-py3-none-any.whl:

Publisher: publish.yml on MarvinFS/second-opinion-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.11.0 This release

2 files

0.10.0

2 files

0.9.2

2 files

0.9.1

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.1

2 files

0.4.1

2 files

0.4.0

2 files

0.3.8

2 files

0.3.6

2 files

0.3.5

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page