Small-Model Harness MCP

Small-Model Harness MCP

Provides context management, task classification, and routing tools for small models (1B-12B) in production agentic workflows.

Category
Visit Server

README

Small-Model Harness

Defensive harness for running 1B–12B parameter models in production agentic workflows.

Five-layer architecture: routing → validation → constraint → circuit break → context management. Delivered as a Hermes plugin (deterministic enforcement) + MCP server (analysis tools).

The Problem

Small models (1B–12B) have dramatically closed the quality gap with frontier models, but the reliability gap persists:

Failure Mode Impact Source
Doom Loops — repetitive death spirals under greedy sampling Qwen3.5-4B: 22.9% loop rate Antidoom (FTPO)
Context Rot — degradation with input length, not position Effective window = ~1/3 of stated window Chroma/NVIDIA
Format Drift — tool call fragility on long chains 87% accuracy vs GPT-4o's 92% Qwen3-32B eval

Architecture

              ┌─────────────────────────────────────────┐
              │        ENTRY POINT / TASK DISPATCH      │
              └────────────────┬────────────────────────┘
                               │
              ┌────────────────▼────────────────────────┐
 LAYER 1      │         TASK CLASSIFIER                 │
 ROUTING      │  Classify complexity, route to model    │
              │  T1 (<4B) → T2 (4-8B) → T3 (9-12B) →   │
              │  T4 (cloud) cascade with confidence     │
              └────────────────┬────────────────────────┘
                               │
              ┌────────────────▼────────────────────────┐
 LAYER 2      │      PRE-CALL VALIDATION                │
 GUARDRAIL    │  Schema check, loop detection, budget   │
              │  Blocks bad calls BEFORE execution      │
              └────────────────┬────────────────────────┘
                               │
              ┌────────────────▼────────────────────────┐
 LAYER 3      │     CONSTRAINED DECODING ENGINE         │
 OUTPUT       │  XGrammar token masking (40μs)          │
 ENFORCEMENT  │  Guarantee valid JSON/tool call output  │
              │  (NOT YET IMPLEMENTED)                  │
              └────────────────┬────────────────────────┘
                               │
              ┌────────────────▼────────────────────────┐
 LAYER 4      │       CIRCUIT BREAKER                   │
 LOOP         │  3-state: closed → open → half-open     │
 DETECTION    │  Detect loops, break circuits, escalate  │
              └────────────────┬────────────────────────┘
                               │
              ┌────────────────▼────────────────────────┐
 LAYER 5      │      CONTEXT BUDGET                     │
 CONTEXT      │  Sliding window compaction              │
              │  1/3 effective window rule              │
              └─────────────────────────────────────────┘

Components

Component What It Does Status
Hermes Plugin pre_tool_call hooks — schema validation, loop detection, circuit breaker, context budget, routing awareness ✅ Phase 1
MCP Server 5 tools: context status, compaction, task classification, routing, reset ✅ Phase 2+3
Task Classifier Rule-based complexity scoring and model tier assignment ✅ Phase 3
Context Router Tier cascade (T1→T2→T3→T4) with failure-based escalation ✅ Phase 3
Output Enforcement Constrained decoding (XGrammar/Outlines) for guaranteed valid output ⏳ Planned
Output Verifier Post-generation validation of tool call correctness 📋 Planned

Installation

As a Hermes Plugin

# Copy plugin to Hermes plugins directory
cp -r hermes-plugin ~/.hermes/profiles/dev/plugins/small-model-harness

# Enable it
hermes plugins enable small-model-harness

As an MCP Server

Add to ~/.hermes/config.yaml or ~/.hermes/profiles/dev/config.yaml:

mcp_servers:
  small-model-harness:
    command: python3
    args: ["/path/to/mcp-server/server.py"]
    enabled: true

MCP Server Tools

Tool Description
harness_context_status Query context budget utilization for a session
harness_compact Compact session context (sliding window summarization)
harness_classify_task Classify task complexity and suggest model tier
harness_route Route task to model tier with cascade logic
harness_reset Reset all harness state for a session

Tier Reference

Tier Model Size Example Models Use Case
T1 <4B SmolLM3, phi-4-mini Simple extraction, classification
T2 4-8B Qwen3-8B, Llama 3.2-8B Single tool calls, basic routing
T3 9-12B Ornith-1.0-9B, Qwen3-30B-A3B Multi-step, reasoning, planning
T4 Cloud DeepSeek V4, GPT-4o Complex chains, security-critical

Development

# Setup
uv sync --group dev

# Run tests
uv run pytest tests/ -v

# Test MCP server
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2026-07-28","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}' | python3 mcp-server/server.py

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured