PluginBench
MCP Server
Active
MIT

io.github.lennney/mcp-slim-guard MCP Server

io.github.lennney/mcp-slim-guard

76% fewer MCP tokens with schema validation and result recovery—same upstream calls, exact recovery.

What is the io.github.lennney/mcp-slim-guard MCP server?

MCP Slim Guard is a proxy MCP server that reduces token usage by 76% while maintaining full schema validation and exact result recovery. It provides three operational modes (Native, Compact, Extreme) to control the host surface and token efficiency, with built-in authorization, SSRF protection, rate limiting, and injection detection.

MCP Slim Guard sits between a host and upstream MCP servers, filtering tool access through allow/deny rules and reducing token overhead. It validates calls against original schemas before invoking upstream tools, and can recover oversized results without re-invoking. Choose from three modes: Native for standard MCP catalogs, Compact for predictable small surfaces, or Extreme for context-sensitive hosts that benefit from smaller initial results.

How to install io.github.lennney/mcp-slim-guard

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "mcp-slim-guard": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-slim-guard"
      ]
    }
  }
}
Cursor
~/.cursor/mcp.json
{
  "mcpServers": {
    "mcp-slim-guard": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-slim-guard"
      ]
    }
  }
}
Windsurf
~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "mcp-slim-guard": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-slim-guard"
      ]
    }
  }
}
VS Code
.vscode/mcp.json
{
  "servers": {
    "mcp-slim-guard": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "mcp-slim-guard"
      ]
    }
  }
}
Claude Code
claude mcp add mcp-slim-guard -- npx -y mcp-slim-guard

Tools & capabilities

Tools this server exposes to the agent.

  • find_toolSearch authorized tool catalog with query validation; rejects unknown fields and queries over 256 Unicode code points; returns up to three matches with full original schemas.
  • call_toolInvoke authorized upstream tools with schema validation before upstream contact; returns structured errors if arguments don't match original schema without invoking upstream.
  • read_resultRecover oversized results without re-invoking upstream; supports bounded fragment queries or cursor-based pagination to retrieve exact snapshot.

Use cases

  • Reduce token usage in MCP tool calls by ~76% while maintaining full schema fidelity and exact result recovery.
  • Control which upstream tools are accessible to a host using allow/deny patterns with SSRF and injection detection.
  • Validate tool arguments against original schemas locally before contacting upstream, catching errors early without wasted calls.
  • Handle large tool responses efficiently by delivering partial results first and recovering the exact snapshot on demand.
  • Integrate with Codex (Native mode), Claude Code (Compact/Extreme modes), or other MCP hosts with predictable tool surfaces.

io.github.lennney/mcp-slim-guard MCP server FAQ

What is MCP Slim Guard?

MCP Slim Guard is a proxy MCP server that reduces token usage by ~76% in standard benchmarks while preserving exact upstream behavior. It validates calls against original schemas, enforces authorization rules, and can recover oversized results without re-invoking the upstream tool.

Is it free?

Yes, MCP Slim Guard is open-source (available on GitHub). The current version (0.1.1-alpha.2) is a source candidate not yet published to npm; install from a reviewed checkout.

How do I install it?

Clone the repository, run `npm ci && npm run build && npm link`, then use `mcp-slim-guard init` to create configuration. For Codex, use Native mode; for Claude Code, use Compact or Extreme. Configure your host with the appropriate command and args.

What authorization does it support?

MCP Slim Guard uses allow/deny patterns in YAML configuration to control which tools are accessible. It also includes SSRF protection, rate limiting, and injection detection to secure upstream tool access.

What are the three modes?

Native: exposes authorized original tool names and full schemas (best for Codex). Compact: provides find_tool, call_tool, and read_result with discovery returning full schemas (default for Claude Code). Extreme: uses Compact surface with smaller initial results for context-sensitive hosts.

Does it require authentication?

No authentication is required for MCP Slim Guard itself. Configuration is file-based (YAML) with upstream server settings and security rules. Upstream servers may have their own auth requirements.

README (reference)

Source of truth, from the repository.

MCP Slim Guard

MCP Slim Guard gives a host one deliberate way to reach authorized upstream tools. It keeps input schemas intact, validates calls before the upstream is invoked, and can recover an oversized result exactly without repeating that invocation.

Choose a mode

ModeWhat the host seesBest fit
NativeAuthorized original tool names and full schemas, plus read_resultHosts that work well with a normal MCP catalog, including Codex
Compactfind_tool, call_tool, and read_result; discovery returns each match's full original schemaA small, predictable host surface
ExtremeThe Compact tool surface and schemas; only sufficiently large results receive a shorter recoverable first deliveryContext-sensitive hosts where a smaller first result is valuable

Compact is the default for start. Native is the default installation plan for Codex. Compact is the default for Claude Code; Claude Code supports Compact and Extreme installation plans, not Native.

All modes apply the same allow/deny authorization. Compact and Extreme return at most three discovery matches, each with the original required fields, enums, and nested schema. A call is validated against that original schema before the upstream server is contacted.

find_tool rejects unknown fields and queries longer than 256 Unicode code points locally. It searches only the current authorized catalog and never falls back to an unauthorized entry.

Quick start

0.1.1-alpha.2 is a source candidate and is not published to npm yet. From a reviewed checkout of this candidate:

npm ci
npm run build
npm link
cd /path/to/project-with-mcp-config
mcp-slim-guard init
mcp-slim-guard validate

# Run the default Compact mode.
mcp-slim-guard start

init writes mcp-slim-guard.yml with version 2. The file contains upstream and security settings only. Select a mode in the host command, not in YAML.

# Inspect a host-specific plan without changing host files.
mcp-slim-guard plan --host codex
mcp-slim-guard plan --host claude-code --mode extreme

# Verify the configured runtime without changing Host configuration or calling a business Tool.
mcp-slim-guard verify --host codex

# Apply a reviewed plan.
mcp-slim-guard install --host codex --mode native

Host entries

For Codex, use Native when you want the normal authorized MCP catalog:

[mcp_servers.slim_guard]
command = "mcp-slim-guard"
args = ["start", "--mode", "native"]
cwd = "/absolute/path/to/project"

For Claude Code, use Compact by default:

{
  "mcpServers": {
    "slim-guard": {
      "command": "mcp-slim-guard",
      "args": ["start", "--mode", "compact"],
      "cwd": "/absolute/path/to/project"
    }
  }
}

See host setup for the full configuration and verification steps.

Configuration

version: 2
tools:
  allow:
    - "upstream_*"
  deny:
    - "*_delete_*"
ssrf:
  mode: block
  block_private_ips: true
  allow_domains: []
  block_domains: []
rate_limit:
  default: "60/min"
injection_detection:
  enabled: true
  sensitivity: medium
  mode: block
audit:
  output: file
  filePath: mcp-slim-guard-audit.log
servers:
  upstream:
    command: npx
    args: ["-y", "@your/mcp-server"]

Version 1 configuration is intentionally unsupported. The removed compressor section is rejected rather than migrated automatically.

Repair an invalid call

If arguments do not match an authorized tool's original schema, Slim Guard returns a normal MCP tool error with structuredContent that identifies the schema failure and confirms that the upstream tool was not invoked. Correct the arguments and retry; submitted argument values are not echoed in that error.

Result recovery

When a response needs recoverable delivery, the first response includes a result_ref. Use read_result with query to locate up to three bounded local fragments, or omit query and follow next_cursor to recover the exact snapshot. Both paths use the same immutable capture and never invoke the upstream tool again. Do not combine query with cursor. Native and Compact use the standard delivery boundary. Extreme uses a smaller boundary only when the initial delivered response is at least half the size of the exact response; otherwise it passes the exact response through unchanged.

Evidence and checks

The repository includes a 24-task mode comparison, result-recovery fixtures, and a 100-tool / 8,000-row stress fixture. Run the current artifacts with:

npm run build
npm run bench:task
npm run bench:compression
npm run bench:stress
npm run bench:compression:verify

Their reports are mode-specific and are generated locally; do not treat older alpha benchmark figures as claims for this product line.

Development

npm run build
npm run typecheck
npm run lint
npm test
npm run verify:package-boundary
npm run smoke:package

This project is an alpha. Review authorization patterns and upstream settings before using it with privileged tools.

Related MCP servers

Free-first web search MCP for English and Chinese queries with zero API keys and inspectable evidence.

107
TypeScript
Apache-2.0
View repository →