SchemaSlim
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 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-cwdorSCHEMASLIM_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
limitis 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 structuredis_error=Trueresponses.
Configuration Presets
Pre-configured production templates are available in examples/:
examples/full-stack-dev.json: GitHub, Filesystem, PostgreSQL, and Memory servers.examples/minimal.json: Minimal Filesystem and Fetch setup.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file schemaslim-0.1.0.tar.gz.
File metadata
- Download URL: schemaslim-0.1.0.tar.gz
- Upload date:
- Size: 932.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7a76675263a7d205aa1c25e60f2fa0764e4609e308a9efea892298e117a934
|
|
| MD5 |
7ab1628ba2de53c3756e96232cfee4cb
|
|
| BLAKE2b-256 |
8417285ab40c9a7eed4cd02313db4e93005fbdca70f14bbb3dca2e93af5e0884
|
File details
Details for the file schemaslim-0.1.0-py3-none-any.whl.
File metadata
- Download URL: schemaslim-0.1.0-py3-none-any.whl
- Upload date:
- Size: 42.9 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
393c2a6b29fd21ebbf771a8f50915fe8fa298ac3ab7dde9f254fb33d860142cc
|
|
| MD5 |
17a3568b63e1602f14d6d8d2f520747e
|
|
| BLAKE2b-256 |
66c6a7fce2814087688f8204a855660a2be157606b226cc003fd0c664e18ba51
|