Skip to main content

SchemaSlim

Python 3.12+ MCP Protocol v1.3+ Platform Tests Security Audit License: MIT

Local virtualizing reverse-proxy for the Model Context Protocol (MCP). Eliminates Tool Explosion and context window exhaustion by replacing static multi-server tool schemas with on-demand semantic retrieval (schemaslim_search) and lazy proxy dispatch (schemaslim_call).


Architecture

┌─────────────────────────┐
│       LLM Client        │  (Claude Desktop, Antigravity, Cursor)
└────────────┬────────────┘
             │ Exposes exactly 2 Meta-Tools:
             │  • schemaslim_search(query, limit)
             │  • schemaslim_call(namespaced_name, arguments)
┌────────────▼────────────┐
│       SchemaSlim        │  ◄── FastEmbed + sqlite-vec (Dense + FTS5 BM25)
└────────────┬────────────┘
             │ Lazy Persistent Sessions (MCPSessionPool)
    ┌────────┴───────────────────────────┐
    │                                    │
┌───▼──────────────────┐        ┌────────▼─────────────┐
│ Stdio MCP Subprocess │        │    SSE MCP Server    │
│  (GitHub, Git, ...)  │        │   (Postgres, APIs)   │
└──────────────────────┘        └──────────────────────┘

Benchmark & Token Economy

Evaluated on 4 realistic MCP servers (git_server, db_server, fs_server, api_server) with 20 tools:

Metric Direct MCP (Baseline) SchemaSlim (Virtualized) Impact
Active Tools in Prompt 20 tools 2 meta-tools -90% prompt tools
Context Size / Turn 1,925 tokens ~502 tokens ~74% token reduction
Tokens Saved (20-Turn Session) 0 tokens ~28,460 tokens saved Significant cost reduction
Search Routing Latency ~50–55 ms (p50: 53ms) Near-instant local search
Transport Stream Purity JSON-RPC JSON-RPC (100% pure stdout) Logs & TUI isolated to stderr

Quickstart

1. Installation

Install via uv (recommended) or pip:

# Global tool via uv
uv tool install schemaslim

# Or inside a project virtualenv
pip install schemaslim

2. Configuration

Generate a configuration file:

schemaslim config init

Configure child servers in schemaslim.json (or ~/.schemaslim/config.json):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "./workspace"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_..." }
    }
  },
  "settings": {
    "db_path": "~/.schemaslim/index.db",
    "top_k": 3
  }
}

Harvest and index tool schemas into the local vector database:

schemaslim index

3. Client Integration

Claude Desktop (claude_desktop_config.json)

{
  "mcpServers": {
    "schemaslim": {
      "command": "schemaslim",
      "args": ["serve"]
    }
  }
}

Google Antigravity IDE (antigravity.json)

{
  "mcpServers": {
    "schemaslim": {
      "command": "schemaslim",
      "args": ["serve"]
    }
  }
}

CLI Reference

Command Options Description
schemaslim wrap [-p PATH] [-y] [--no-index] Auto-discover MCP client configs, migrate servers to global index, and wrap client
schemaslim unwrap [-p PATH] [-y] Restore original client configuration from .schemaslim.bak backup
schemaslim index [-c CONFIG] [--allow-cwd] [-f] [-v] Harvest schemas from child servers and update vector index
schemaslim search "<query>" [-l LIMIT] [-t THRESHOLD] [-c CONFIG] [--allow-cwd] Test hybrid semantic search query matching
schemaslim serve [-c CONFIG] [--allow-cwd] [--tui/--no-tui] Run virtualizing proxy server over stdio
schemaslim stats [-c CONFIG] [--allow-cwd] Display catalog footprint and token economy metrics
schemaslim benchmark [-r RUNS] [-o table|json] Run synthetic stress benchmark measuring savings and latency
schemaslim config validate [PATH] [--allow-cwd] [-v] Validate configuration against Pydantic schema
schemaslim config show [PATH] [--allow-cwd] Display active configuration in formatted JSON
schemaslim config init [PATH] [-f] Generate a starter configuration template

Security Architecture

SchemaSlim is hardened against common proxy and supply-chain vulnerabilities:

  • Host Secret Isolation: Child subprocesses do not inherit os.environ. Only explicitly configured environment variables (config.env) are passed; otherwise, the MCP SDK default environment filter applies.
  • Untrusted CWD Protection: Loading configurations from the current working directory (./schemaslim.json) is blocked by default. Requires --allow-cwd or SCHEMASLIM_ALLOW_CWD=1. Trusted global paths (~/.schemaslim/config.json) are prioritized.
  • Confused Deputy Prevention: Server identifiers are restricted to ^[a-zA-Z0-9_-]+$ without __. Tool overwrites across server boundaries are strictly rejected by the storage layer.
  • DoS & Recursion Guards: The token estimator safely handles deeply nested payloads and circular references without uncaught RecursionError.
  • SQLite Variable Safety: Search limit is capped at 20, and all batch queries (WHERE IN) are chunked in batches of 500 parameters.
  • Process Timeouts: Child server connections (15.0s) and tool invocations (60.0s) are bounded by timeouts, converting child hangs into structured is_error=True responses.

Configuration Presets

Pre-configured production templates are available in examples/:


Testing

Run the automated test suite (93 unit, integration, and security tests):

uv run pytest -v

License

MIT License © 2026 SchemaSlim Team.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

schemaslim-0.1.2.tar.gz (941.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schemaslim-0.1.2-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

File details

Details for the file schemaslim-0.1.2.tar.gz.

File metadata

  • Download URL: schemaslim-0.1.2.tar.gz
  • Upload date:
  • Size: 941.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for schemaslim-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c77d8fe3af37ce0f2a554a12e12d311583775557ff7a317450382aef93662a7e
MD5 392d5b106a31d21a8367500e899f6868
BLAKE2b-256 1aa69327340c852d71fdc1f3f5fe56bd3cd2288fc3fb9bede22af131f6d38328

See more details on using hashes here.

File details

Details for the file schemaslim-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: schemaslim-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 50.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.9 {"installer":{"name":"uv","version":"0.12.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for schemaslim-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f477de7b41b9b816999bd39ebbf47b47860518b40e2262a39813ad08be4142ea
MD5 621668b0337eb8009ed12617af315ad4
BLAKE2b-256 000c9f632335fdf2b368f848b0877a255c453e223ffc7cde075abedcd7c3f794

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

This release

0.1.2 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page