Keep big MCP responses out of your context window. Query them.
Project description
Sift
Sift is a local, single-tenant gateway for AI agent tool work. It fixes context bloat by storing large tool outputs as artifacts and returning only the slices an agent needs.
Use it with agents that talk through MCP, or run it directly in CLI workflows.
One Command, Two Modes
Sift uses one command handle: sift-gateway.
| Mode | How you run it | What it does |
|---|---|---|
| MCP gateway mode | sift-gateway (default server behavior) |
Proxies MCP traffic and persists tool outputs as artifacts |
| CLI mode | sift-gateway <artifact-command> |
Captures, queries, and computes over artifacts directly |
These modes are independent. You can run only MCP mode, only CLI mode, or both.
MCP Gateway Mode
Use this when an agent/client talks to tools over MCP.
Quick start
pipx install sift-gateway
sift-gateway init --from claude
sift-gateway --check
Then restart your MCP client.
--from shortcuts:
claude, claude-code, cursor, vscode, windsurf, zed, auto
(or pass an explicit config path).
Common gateway commands
sift-gateway --help
sift-gateway upstream add '<json>' --from claude
sift-gateway install pandas
sift-gateway uninstall pandas
sift-gateway --transport sse --host 127.0.0.1 --port 8080
Runtime behavior
- Mirrors upstream MCP tools with original schemas.
- Persists mirrored outputs as artifacts.
- Returns small responses inline and larger responses as handles.
CLI Mode
Use this when you want artifact workflows directly in terminal automation.
Quick start
pipx install sift-gateway
sift-gateway run -- echo '{"items":[{"id":1,"name":"a"}]}'
sift-gateway list --limit 10
Capture sources
# Capture command output
sift-gateway run -- git status --porcelain
# Capture stdin
cat payload.json | sift-gateway run --stdin
Query and inspect artifacts
sift-gateway schema art_123
sift-gateway get art_123
sift-gateway query art_123 '$.items' --select id,name --limit 50
sift-gateway code art_123 '$.items' --expr 'len(df)'
sift-gateway diff art_left art_right
CLI mode uses local state in .sift-gateway by default.
Use --data-dir to target a different instance.
MCP Artifact Query Model
In MCP workflows, retrieval happens through the artifact tool with
action="query".
Supported query_kind values:
| query_kind | Purpose |
|---|---|
describe |
Schema and metadata |
get |
Full payload retrieval |
select |
Projection/filtering from a root path |
search |
Search and list session artifacts in the current workspace |
code |
Execute constrained Python over artifact data |
Example query_kind="search":
artifact(
action="query",
query_kind="search",
query="github issues",
limit=25,
)
Example query_kind="select":
artifact(
action="query",
query_kind="select",
artifact_id="art_123",
root_path="$.items",
select_paths=["id", "name", "status"],
limit=50,
)
Context-Bloat Controls
SIFT_GATEWAY_PASSTHROUGH_MAX_BYTEScontrols inline-vs-handle threshold.- Default:
8192bytes. - Set to
0to force handle-first behavior.
Configuration Highlights
| Env var | Default | Description |
|---|---|---|
SIFT_GATEWAY_DATA_DIR |
.sift-gateway |
Instance root directory |
SIFT_GATEWAY_PASSTHROUGH_MAX_BYTES |
8192 |
Inline response threshold |
SIFT_GATEWAY_CODE_QUERY_ENABLED |
true |
Enable code queries |
SIFT_GATEWAY_SECRET_REDACTION_ENABLED |
true |
Redact likely outbound secrets |
SIFT_GATEWAY_AUTH_TOKEN |
unset | Required for non-local HTTP binds |
Full reference: docs/config.md
Security Notes
- Code queries use AST/import/time/memory guardrails, not full OS sandboxing.
- Outbound secret redaction is enabled by default.
Disable code queries if needed:
export SIFT_GATEWAY_CODE_QUERY_ENABLED=false
More: SECURITY.md
Documentation
docs/quickstart.mddocs/config.mddocs/api_contracts.mddocs/recipes.mddocs/deployment.mddocs/errors.mddocs/observability.mddocs/architecture.mddocs/openclaw/README.md
Development
git clone https://github.com/lourencomaciel/sift-gateway.git
cd sift-gateway
uv sync --extra dev
UV_CACHE_DIR=/tmp/uv-cache uv run python -m ruff check src tests
UV_CACHE_DIR=/tmp/uv-cache uv run python -m mypy src
UV_CACHE_DIR=/tmp/uv-cache uv run python -m pytest tests/unit/ -q
License
MIT - see LICENSE.
Project details
Release history Release notifications | RSS feed
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 sift_gateway-0.2.2.tar.gz.
File metadata
- Download URL: sift_gateway-0.2.2.tar.gz
- Upload date:
- Size: 253.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09e2a7772c9c2f56f432fc2ee6e1ab29e3398ba0a3f4b70f208724dba00fc9b4
|
|
| MD5 |
2fe884505d65cf2858887c760dec5f94
|
|
| BLAKE2b-256 |
583fc3eb4342f14ef1f302f6288024c2a320e84203c5a8df6879d1ae098bb1ee
|
Provenance
The following attestation bundles were made for sift_gateway-0.2.2.tar.gz:
Publisher:
release.yml on lourencomaciel/sift-gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sift_gateway-0.2.2.tar.gz -
Subject digest:
09e2a7772c9c2f56f432fc2ee6e1ab29e3398ba0a3f4b70f208724dba00fc9b4 - Sigstore transparency entry: 967857252
- Sigstore integration time:
-
Permalink:
lourencomaciel/sift-gateway@028fd2d66db0720b3b714eeac585b0e381f63d80 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/lourencomaciel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@028fd2d66db0720b3b714eeac585b0e381f63d80 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sift_gateway-0.2.2-py3-none-any.whl.
File metadata
- Download URL: sift_gateway-0.2.2-py3-none-any.whl
- Upload date:
- Size: 327.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0caf2390961d8ece2a79f490e21360dc1f81a808528754debcad924c937b51e1
|
|
| MD5 |
67fd26fab1afa74b20601f53d0f8a434
|
|
| BLAKE2b-256 |
f9794c9ed9d1ad5012edae9a95874d5501c466cbe8680ff02d4c9db3ca6ec999
|
Provenance
The following attestation bundles were made for sift_gateway-0.2.2-py3-none-any.whl:
Publisher:
release.yml on lourencomaciel/sift-gateway
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sift_gateway-0.2.2-py3-none-any.whl -
Subject digest:
0caf2390961d8ece2a79f490e21360dc1f81a808528754debcad924c937b51e1 - Sigstore transparency entry: 967857297
- Sigstore integration time:
-
Permalink:
lourencomaciel/sift-gateway@028fd2d66db0720b3b714eeac585b0e381f63d80 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/lourencomaciel
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@028fd2d66db0720b3b714eeac585b0e381f63d80 -
Trigger Event:
push
-
Statement type: