Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
fix(opencode): use type=local + environment field for MCP config (#1380) (#1388)
Peter Lodria51bbfb6a56f
diff --git a/tests/test_mcp_registry_opencode.py b/tests/test_mcp_registry_opencode.pyindex 2340ad649..34ea814ba 100644--- a/tests/test_mcp_registry_opencode.py+++ b/tests/test_mcp_registry_opencode.py@@ -419,6 +419,42 @@ def test_spec_to_entry_roundtrip() -> None:assert restored.env == original.env+def test_spec_to_entry_no_env_has_no_environment_key() -> None:+ """_spec_to_entry omits 'environment' key when spec has no env vars."""+ from headroom.mcp_registry.base import ServerSpec++ spec = ServerSpec(name="headroom", command="headroom", args=("mcp", "serve"))+ entry = _spec_to_entry(spec)+ assert entry["type"] == "local"+ assert "url" not in entry+ assert "environment" not in entry+ assert "env" not in entry+++def test_entry_to_spec_reads_environment_field() -> None:+ """_entry_to_spec reads the 'environment' field (not legacy 'env')."""+ entry = {+ "type": "local",+ "command": ["headroom", "mcp", "serve"],+ "environment": {"HEADROOM_PROXY_URL": "http://127.0.0.1:8787"},+ "enabled": True,+ }+ spec = _entry_to_spec("headroom", entry)+ assert spec.env == {"HEADROOM_PROXY_URL": "http://127.0.0.1:8787"}+++def test_entry_to_spec_falls_back_to_legacy_env_field() -> None:+ """_entry_to_spec falls back to 'env' when 'environment' is absent."""+ entry = {+ "type": "local",+ "command": ["headroom", "mcp", "serve"],+ "env": {"LEGACY_KEY": "value"},+ "enabled": True,+ }+ spec = _entry_to_spec("headroom", entry)+ assert spec.env == {"LEGACY_KEY": "value"}++def test_diff_specs_all_fields() -> None:"""_diff_specs reports differences in all fields."""from headroom.mcp_registry.base import ServerSpec