JM

jalehman/mcp-sage

Developer tools

Эта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал

10 stars 5 forks Качество 49 Тренд 8

MCP Server for getting second opinions/reviews on large amounts of code.

Обзор

An MCP (Model Context Protocol) server that provides tools for sending prompts to OpenAI's GPT-5, GPT-4.1, Google's Gemini 2.5 Pro, or Anthropic's Claude Opus 4.1 based on token count and configuration. The tools embed all referenced filepaths (recursively for folders) in the prompt. This is useful for getting second opinions or detailed code reviews from models that can handle large amounts of context accurately. I make heavy use of Claude Code. It's a great product that works well for my workflow. Newer models with large amounts of context seem really useful though for dealing with more complex codebases where more context is needed. This lets me continue to use Claude Code as a development tool while leveraging the large context capabilities of GPT-5, Gemini 2.5 Pro, and other models to augment Claude Code's limited context. The server automatically selects the appropriate model based on token count, with configuration defined in models.

README

Показан фрагмент оригинального README. Открыть оригинал.

mcp-sage

An MCP (Model Context Protocol) server that provides tools for sending prompts to OpenAI’s GPT-5, GPT-4.1, Google’s Gemini 2.5 Pro, or Anthropic’s Claude Opus 4.1 based on token count and configuration. The tools embed all referenced filepaths (recursively for folders) in the prompt. This is useful for getting second opinions or detailed code reviews from models that can handle large amounts of context accurately.

Rationale

I make heavy use of Claude Code. It’s a great product that works well for my workflow. Newer models with large amounts of context seem really useful though for dealing with more complex codebases where more context is needed. This lets me continue to use Claude Code as a development tool while leveraging the large context capabilities of GPT-5, Gemini 2.5 Pro, and other models to augment Claude Code’s limited context.

Model Selection

The server automatically selects the appropriate model based on token count, with configuration defined in models.yaml:

  • For smaller contexts (≤ 400K tokens): Uses OpenAI’s GPT-5 (if OPENAI_API_KEY is set)
  • For medium contexts (≤ 1M tokens): Uses Google’s Gemini 2.5 Pro (if GEMINI_API_KEY is set)
  • For fallback (≤ 1M tokens): Uses OpenAI’s GPT-4.1
  • If the content exceeds 1M tokens: Returns an informative error

Fallback behavior:

  • API Key Fallback:
    • If OPENAI_API_KEY is missing, Gemini will be used for all contexts within its 1M token limit
    • If GEMINI_API_KEY is missing, only smaller contexts can be processed with OpenAI models
    • If required API keys are missing, an informative error is returned

Inspiration

This project draws inspiration from two other open source projects:

Overview

This project implements an MCP server that exposes two primary tools:

sage-opinion

  1. Takes a prompt and a list of file/dir paths as input
  2. Packs the files into a structured XML format
  3. Measures the token count and selects the appropriate model:
    • GPT-5 for ≤ 400K tokens
    • Gemini 2.5 Pro for > 400K and ≤ 1M tokens
    • GPT-4.1 as fallback for ≤ 1M tokens
  4. Sends the combined prompt + context to the selected model
  5. Returns the model’s response

sage-review

  1. Takes an instruction for code changes and a list of file/dir paths as input
  2. Packs the files into a structured XML format
  3. Measures the token count and selects the appropriate model:
    • GPT-5 for ≤ 400K tokens
    • Gemini 2.5 Pro for > 400K and ≤ 1M tokens
Открыть полный README на GitHub

Установка

npx -y @smithery/cli install @jalehman/mcp-sage --client claude
Новичок в MCP? Начните с руководства на mcpskill.org →