原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

Model Shunt

作者:yasmanycastillo版本 1.2.1i★ –i在你的电脑上运行
注册名称io.github.yasmanycastillo/model-shunt

安装

概览

作者提供的说明(英文原文)

Model routing for AI agents: delegate bulk reads & boilerplate to cheap worker models.

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: stdio
  • 分类: 其他

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 注册中心没有列出需要填写的密钥。

你需要

  • npm已安装 Node.js(用于 npx 命令)

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

{
  "mcpServers": {
    "model-shunt": {
      "command": "npx",
      "args": [
        "-y",
        "model-shunt"
      ]
    }
  }
}

在终端中运行这条命令

claude mcp add model-shunt -- npx -y model-shunt

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

{
  "mcpServers": {
    "model-shunt": {
      "command": "npx",
      "args": [
        "-y",
        "model-shunt"
      ]
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "model-shunt": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "model-shunt"
      ]
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月8日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 yasmanycastillo 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“其他”中的其他服务器比较i

  • 星标数多于此分类中其他 18374 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 18374 个服务器的 51% 更新
  • 基础检查结果等于或优于此分类中其他 18374 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Model Shunt 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

注册中心没有列出必需的密钥,不过有些服务器会在首次使用时要求你登录。

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(1.2.1)于上个月进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Python (uv), Node.js。

有什么可以替代它?

同一分类中有:Spec Driven Development, Remote Desktop Commander, Happo

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

Spec Driven Development

作者:formulahendry

MCP Server that facilitates spec-driven development workflows, not just Vibe Coding.

在你的电脑上运行★ 440MIT14个月前更新
安装

Remote Desktop Commander

作者:desktop-commander

Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.

在云端运行★ 211前天更新
安装

Happo

作者:happo.io

Review Happo's visual and accessibility diffs: inspect comparisons, accept or reject, report flakes.

在云端运行今天更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

Model-Shunt 🔀

A decoupled, zero-dependency, universal implementation of the Shunt model-routing pattern (originally conceived by Spotify Engineering).

Model-Shunt allows AI coding agents (Antigravity, Cursor, Windsurf, Claude Code, Aider, OpenHands, etc.) to delegate token-heavy I/O (bulk file reading/code analysis) and repetitive boilerplate generation (tests, mocks, stubs, configs) to fast, economical, or local worker models (Gemini 2.5 Flash, Groq/Llama, Ollama, DeepSeek, GPT-4o-mini). This cuts primary agent token consumption by up to 90% while keeping the main context window clean.


⚡ Key Highlights

  • Zero External Dependencies: Built with pure Python 3 standard library (urllib, json, re, argparse). No pip install, no virtual environment, and no npm required.
  • Agent-Agnostic: Works transparently across any AI coding agent via standard MCP (Model Context Protocol), standalone CLI scripts, or PreToolUse lifecycle hooks.
  • Dynamic Model Discovery & Auto-Routing: Queries the worker endpoint in real time to discover available models and automatically routes to the best model for the task:
  • Reader Mode (Bulk I/O): Prioritizes massive context windows and ultra-low cost (e.g., gemini-2.5-flash, llama-3.3-70b-versatile, gpt-4o-mini).
  • Writer Mode (Code Generation): Prioritizes specialized coding models (e.g., qwen2.5-coder:latest, gemini-2.5-flash, deepseek-chat).
  • Bypasses Linux `ARG_MAX` Limits: Unlike naive implementations that pass file contents as CLI arguments (capped at ~128 KB on Linux), Model-Shunt streams corpus data over stdin, allowing analysis of hundreds of thousands of lines without buffer overflows.
  • Deterministic Line Numbering (`N|`): Automatically prefixes every line in file blocks with its 1-based index, forcing worker models to cite verifiable, exact line numbers instead of hallucinating locations.
  • Binary File Protection: Inspects byte headers to reject binary files (PDFs, images, compiled objects) before sending them to the LLM.
  • Network Resilience: Automatic exponential backoff retries for rate limits (HTTP 429) and transient server errors (HTTP 503/502), with configurable timeouts and token limits.
  • Map-Reduce for Oversized Corpora: When a bulk_read payload exceeds the direct limit (SHUNT_MAX_DIRECT_TOKENS, default ~200k tokens), Model-Shunt automatically splits the corpus into chunks, maps the question over each chunk (preserving absolute N| line numbers), and reduces the extracts into one cited answer. Giant single-line files (minified JSON/JS) are sliced by characters with explicit position markers. Rate-limit pacing waits out provider quota windows instead of failing.

📁 Repository Structure

model-shunt/

├── src/model_shunt/ │ ├── worker.py # Universal LLM worker engine with model discovery (zero-deps) │ └── server.py # Stdio MCP server exposing routing tools ├── bin/model-shunt.js # npm/npx launcher shim (requires local Python 3) ├── plugin/ │ ├── .claude-plugin/ # Plugin manifest for hook-compatible agents │ ├── hooks/ # PreToolUse interceptor hooks (check-file-size, check-bash-read) │ ├── scripts/ # Executable streaming CLIs (bulk-read, code-write) │ └── skills/ # Agent skill manifests (/bulk-reader, /code-writer) ├── pyproject.toml # PyPI packaging (uvx / pip install) ├── package.json # npm packaging (npx) ├── config.example.json # Configuration template ├── test_shunt.py # Automated test suite └── .gitignore # Credential and cache protection


⚙️ Configuration

Configure your worker model via environment variables or a config.json file (placed in ~/.config/model-shunt/config.json or in the project root):

Using config.json
{

"provider": "gemini", "model": "auto", "timeout": 90, "max_tokens": 8192 }

Tip: Setting "model": "auto" (or passing --auto-model in the CLI) will automatically inspect the provider's active models and pick the optimal one for reading vs writing.

Security: Do not put your API key in config.json — use environment variables instead (e.g. GEMINI_API_KEY, GROQ_API_KEY, or SHUNT_API_KEY). An api_key field exists as a last-resort fallback, but keeping secrets out of files is strongly recommended.

Using Environment Variables
# Google Gemini (Recommended: 1M token context, high speed, ultra-low cost)

export SHUNT_PROVIDER="gemini" export GEMINI_API_KEY="your-api-key"

Groq (Ultra-low latency inference)

export SHUNT_PROVIDER="groq" export GROQ_API_KEY="your-api-key"

Ollama (100% private, local, and free)

export SHUNT_PROVIDER="ollama" export SHUNT_BASE_URL="http://localhost:11434/v1"

OpenAI / DeepSeek / OpenRouter / Anthropic

export SHUNT_PROVIDER="deepseek" export DEEPSEEK_API_KEY="your-api-key"


🛠️ Usage Modes

Mode 1: Universal MCP Server (Recommended)

Model-Shunt provides a standard stdio MCP server exposing three tools:

  1. `get_available_models(provider?)`: Queries the provider endpoint and recommends reader and writer models. If discovery fails or is unsupported, returns built-in recommendations whose current availability is not verified.
  2. `bulk_read(question, file_paths, model?, provider?)`: Reads large or multiple files and outputs concise, structured bullets with exact line citations. A citation name (N|k) is dropped when source line k does not contain that name.
  3. `code_write(spec, reference_path, target_path?, model?, provider?)`: Generates code using a specification and reference file. Returns the code when target_path is omitted; otherwise creates missing parent directories and writes the code, overwriting an existing target file.

bulk_read sends the selected files and question to the configured worker provider; code_write sends the specification and reference file. The provider can be remote or local (such as Ollama). Token savings depend on the input and response.

The MCP server runs locally over stdio. Set provider credentials through environment variables. File access follows resolved paths, so symlinks pointing outside the allowed workspace roots are rejected. Invalid requests return structured errors and leave the server available for subsequent calls.

Installation

MCP Registry name: mcp-name: io.github.yasmanycastillo/model-shunt

Universal one-liner (detects uv / pip / pipx / npm, installs the model-shunt command, and registers it with Claude Code if present):

curl -fsSL https://yasmanycastillo.github.io/model-shunt/install.sh | bash

Manual alternatives:

claude mcp add model-shunt -- uvx model-shunt      # if you have uv

claude mcp add model-shunt -- npx -y model-shunt # if you have Node + Python

Any MCP client (Cursor, Windsurf, Antigravity, Claude Desktop, etc.) — add to its MCP settings. No clone, no absolute paths:

{

"mcpServers": { "model-shunt": { "command": "uvx", "args": ["model-shunt"], "env": { "SHUNT_PROVIDER": "gemini", "SHUNT_MODEL": "auto", "GEMINI_API_KEY": "your-api-key" } } } }

Fallback (offline / no uv / no npx): run straight from a clone with Python 3.9+ — replace "command"/"args" with "command": "python3", "args": ["/absolute/path/to/model-shunt/src/model_shunt/server.py"].

Security: by default bulk_read/code_write only operate on files inside the server's working directory (the agent workspace). Set SHUNT_ALLOWED_ROOTS (PATH-style list) to expand the sandbox.

Map-Reduce Tuning (optional)
VariableDefaultPurpose
SHUNT_MAX_DIRECT_TOKENS200000Payloads above this estimated size switch to map-reduce
SHUNT_CHUNK_CHARS600000Chunk size in characters (~150k tokens)
SHUNT_CHUNK_RETRIES3Retries per chunk on rate limits
SHUNT_CHUNK_RETRY_DELAY60Seconds to wait out a provider quota window (free-tier TPM)

Mode 2: PreToolUse Interceptor Hooks

For agents supporting pre-execution hooks (e.g., Claude Code, custom agent loops):

  1. File Read Interceptor (`check-file-size`):
  • If the agent attempts a whole-file read on a file exceeding the threshold (default: 350 lines, configurable via SHUNT_MIN_LINES), the hook blocks the call and instructs the agent to delegate to bulk-read.
  • Targeted reads with offset and limit are allowed, preserving surgical context for code editing.
  1. Terminal Guard (`check-bash-read`):
  • Prevents agents from bypassing the read hook by executing commands like cat, less, or more on large files directly in the terminal context.

Mode 3: Standalone CLI & Scripts

You can also use Model-Shunt directly from the command line or from agent bash sessions:

Discover Available Models & Recommendations
python3 src/model_shunt/worker.py --list-models --provider gemini
Run Bulk Reading Analysis
./plugin/scripts/bulk-read \

--question "How does the token refresh cycle work?" \ --paths src/auth.py src/tokens.py \ --auto-model

Generate Boilerplate Directly to Disk
./plugin/scripts/code-write \

--spec "Create unit tests for the BillingService covering charge and refund" \ --reference tests/test_user.py \ --target tests/test_billing.py \ --auto-model


🧪 Verification

Run the built-in test suite to verify your environment:

python3 test_shunt.py

The test suite validates:

  • Configuration resolution, fallback cascades, and model selection.
  • Binary file detection and rejection.
  • Hook decisions (surgical reads allowed, large file reads blocked, bash flag parsing).
  • MCP stdio protocol compliance and tool execution.
  • CLI discovery flags.

📄 License

MIT. Inspired by Spotify Engineering's Shunt architecture.

🔒 Privacy

See PRIVACY.md for filesystem scope, provider data handling, and credential practices.

问 PopNx