Sunglasses is a filter that sits ahead of your Zed AI assistant. Always ON. Any file content or tool response the assistant reads — the filter scans first. This page walks through the Zed MCP wiring.

Who this page is for

Zed users running the built-in AI assistant with MCP context servers. Scan untrusted content before the assistant acts on it.

The command

# In Zed settings.json under "context_servers": "context_servers": { "sunglasses": { "command": { "path": "python", "args": ["-m", "sunglasses.mcp"] } } }

Add Sunglasses as a Zed context server. Zed supports MCP via context_servers. Paste the sunglasses entry into your Zed settings.json, restart the editor. The assistant can now scan untrusted inputs through the filter before acting.

Benefit: Zed is fast. Sunglasses is 0.26ms per scan. Together — no measurable latency impact, full filter coverage.

Install Sunglasses first

If you haven't installed Sunglasses on your machine yet, do this first in a fresh terminal:

python3 -m venv sunglasses-env
source sunglasses-env/bin/activate
pip install --upgrade sunglasses

On modern macOS and many Linux systems, your system Python may block direct installs. A small virtual environment keeps the install clean. Windows: replace source sunglasses-env/bin/activate with sunglasses-env\Scripts\activate.

Full walkthrough in progress. The core command and identity are ready. Detailed step-by-step screenshots, real-world attack examples, and troubleshooting are being added.

FAQ

How do I add prompt injection protection to Zed?

Add sunglasses as a context_server in Zed's settings.json with command path 'python' and args ['-m', 'sunglasses.mcp']. Zed's AI assistant gets the scan tool automatically.

Does Sunglasses work with Zed's inline AI features?

Yes. Any AI feature in Zed that uses context servers can call the scan tool.

Is the filter local?

Yes. Zed talks to Sunglasses over local stdio. No cloud.

Can I force scanning on every input?

Add a rule in your Zed AI assistant's custom instructions telling it to scan untrusted content first.

Does this add latency in the editor?

No. 0.26ms average scan is invisible during typical editor use.

Where this wiring fits

Sunglasses is one filter with many wiring options. This page covers Zed. Other wiring paths:

Same filter underneath. Different wiring based on your stack.