The Consult LLM MCP server enables Claude Code to consult more powerful AI models for complex problem analysis:
Query powerful AI models: Access OpenAI's o3 (default), Google's Gemini 2.5 Pro, and DeepSeek Reasoner for specialized problem-solving.
Context integration: Process markdown files as primary prompts while including other files as supplementary context.
Direct prompting: Submit simple text questions or construct automatic prompts from markdown and code files.
Git diff integration: Include code changes as additional context for more accurate analysis.
Task specialization: Address specific needs like code implementation, review, bug analysis, and architecture advice.
Usage tracking: Monitor interactions with cost estimation and comprehensive logging of prompts, responses, token usage, and parameters.
Provides ability to feed code changes through git diff as context for AI model queries
Enables querying Google's Gemini 2.5 Pro model with file context and automatically constructed prompts from markdown and code files
Supports automatic prompt construction from markdown files which become the main prompt when querying AI models
Enables querying OpenAI's o3 model with file context and automatically constructed prompts from markdown and code files
Consult LLM MCP
An MCP server that lets Claude Code consult stronger AI models (o3, Gemini 2. Pro, DeepSeek Reasoner) when Sonnet has you running in circles and you need to bring in the heavy artillery.
Features
Query powerful AI models (o3, Gemini 2.5 Pro, DeepSeek Reasoner) with relevant files as context
Direct queries with optional file context
Include git changes for code review and analysis
Comprehensive logging with cost estimation
Gemini CLI mode: Use the
geminiCLI to take advantage of free quotaWeb mode: Copy formatted prompts to clipboard for browser-based LLM services
Simple: provides just one MCP tool to not clutter the context
Usage with Claude Code
Installation
Add the MCP server to Claude Code:
Or for global availability:
Optionally you can provide environment variables directly in the MCP configuration:
Example workflows
Some real-world examples. Click to expand.
This is useful when:
You want to use a free browser-based LLM service instead of API credits
You prefer a specific LLM's web interface
You want to review the full prompt before submitting it
Web Mode
When you want Claude Code to prepare the prompt but send it through an LLM web
UI yourself (ChatGPT, Claude.ai, Gemini, etc.), ask it to "use consult LLM with
web mode." Claude will pass web_mode: true to consult_llm, the MCP will
assemble the full prompt (system prompt + files + git diff), and instead of
hitting an API it copies that text to your clipboard so you can paste it
wherever you like.
When to use: prefer a specific web UI, want to review the prompt first, or do not have API keys configured.
Workflow:
Tell Claude Code (or your MCP-aware agent) to "use consult LLM with web mode" so it invokes the tool with
web_mode: true.Paste the copied prompt into your browser-based LLM and wait for its response.
Paste that response back into Claude Code so it can continue.
See the "Using web mode..." example above for a concrete transcript of this flow.
Gemini CLI Mode
Use Gemini's local CLI when you want to take advantage of Google's free quota or
keep prompts off the API by enabling CLI mode so consult-llm spawns the gemini
binary locally rather than sending the prompt through the API.
When to use: you have the Gemini CLI installed and authenticated, want to stay within the CLI's free allowance.
Requirements:
Install the Gemini CLI and ensure the
geminicommand is on your$PATH.Authenticate via
gemini login(and any other setup the CLI requires).
Workflow:
When adding the MCP server, set
GEMINI_MODE=cli:claude mcp add consult-llm \ -e GEMINI_MODE=cli \ -- npx -y consult-llm-mcpAsk Claude Code to "consult Gemini" (or whichever phrasing you normally use). It will call
consult_llmwith the Gemini model, assemble the prompt, and shell out to the CLI automatically.
Configuration
Environment Variables
OPENAI_API_KEY- Your OpenAI API key (required for o3)GEMINI_API_KEY- Your Google AI API key (required for Gemini models in API mode)DEEPSEEK_API_KEY- Your DeepSeek API key (required for DeepSeek models)CONSULT_LLM_DEFAULT_MODEL- Override the default model (optional)Options:
o3(default),gemini-2.5-pro,deepseek-reasoner
GEMINI_MODE- Choose between API or CLI mode for Gemini models (optional)Options:
api(default),cliCLI mode uses the system-installed
geminiCLI tool
Custom System Prompt
You can customize the system prompt used when consulting LLMs by creating a
SYSTEM_PROMPT.md file in ~/.consult-llm-mcp/:
This creates a placeholder file with the default system prompt that you can edit to customize how the consultant LLM behaves. The custom prompt is read on every request, so changes take effect immediately without restarting the server.
To revert to the default prompt, simply delete the SYSTEM_PROMPT.md file.
MCP Tool: consult_llm
The server provides a single tool called consult_llm for asking powerful AI
models complex questions.
Parameters
prompt (required): Your question or request for the consultant LLM
files (optional): Array of file paths to include as context
All files are added as context with file paths and code blocks
model (optional): LLM model to use
Options:
o3(default),gemini-2.5-pro,deepseek-reasoner
web_mode (optional): Copy prompt to clipboard instead of querying LLM
Default:
falseWhen
true, the formatted prompt (including system prompt and file contents) is copied to clipboard for manual pasting into browser-based LLM services
git_diff (optional): Include git diff output as context
files (required): Specific files to include in diff
repo_path (optional): Path to git repository (defaults to current directory)
base_ref (optional): Git reference to compare against (defaults to HEAD)
Supported Models
o3: OpenAI's reasoning model ($2/$8 per million tokens)
gemini-2.5-pro: Google's Gemini 2.5 Pro ($1.25/$10 per million tokens)
deepseek-reasoner: DeepSeek's reasoning model ($0.55/$2.19 per million tokens)
Logging
All prompts and responses are logged to ~/.consult-llm-mcp/logs/mcp.log with:
Tool call parameters
Full prompts and responses
Token usage and cost estimates
CLAUDE.md example
While not strictly necessary, to help Claude Code understand when and how to use
this tool, you can optionally something like the following to your project's
CLAUDE.md file:
Claude Code seems to know pretty well when to use this MCP even without this instruction however.
Development
To work on the MCP server locally and use your development version:
Clone the repository and install dependencies:
git clone https://github.com/yourusername/consult-llm-mcp.git cd consult-llm-mcp npm installBuild the project:
npm run buildInstall globally from the local directory:
npm linkAdd the MCP server to Claude Code using the global command:
claude mcp add consult-llm -- consult-llm-mcp
Now when you make changes:
Rebuild:
npm run buildRestart Claude Code to pick up the changes
Alternatively, you can use the dev script for development without building:
This runs the TypeScript source directly with tsx, allowing faster iteration
without rebuilding.
To unlink the global version later:
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that enables Claude users to access specialized OpenAI agents (web search, file search, computer actions) and a multi-agent orchestrator through the MCP protocol.Last updated -410
- AsecurityAlicenseAqualityAn MCP server that implements Claude Code-like functionality, allowing the AI to analyze codebases, modify files, execute commands, and manage projects through direct file system interactions.Last updated -15282MIT License
- AsecurityFlicenseAqualityAn MCP server that connects Gemini 2.5 Pro to Claude Code, enabling users to generate detailed implementation plans based on their codebase and receive feedback on code changes.Last updated -214
- AsecurityAlicenseAqualityMCP server that provides Claude AI assistants with the ability to search the web, get news, and perform research using the You.com API.Last updated -42MIT License