JM

jalehman/mcp-sage

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

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
GitHub で README 全文を見る

インストール

npx -y @smithery/cli install @jalehman/mcp-sage --client claude
MCP 初心者?mcpskill.org のガイドから始めましょう →