Skip to content

Compress and decompress JSON using the ASON format directly in Zed IDE. Reduce token usage by 20-60% for LLM applications while maintaining 100% lossless round-trip fidelity.

License

Notifications You must be signed in to change notification settings

ason-format/zed-extension

ASON MCP Server for Zed

License: MIT Node.js

Model Context Protocol (MCP) extension for Zed that provides ASON compression/decompression tools in the AI assistant. Reduce token usage by 20-60% for LLM interactions while maintaining 100% lossless round-trip fidelity.

✨ Features

  • πŸ€– AI Assistant Integration: Use ASON tools directly in Zed's AI Assistant
  • πŸ“¦ Zero Configuration: Works out of the box, auto-installs dependencies
  • πŸ”„ Auto-Update: Automatically installs and uses latest MCP server from npm
  • ⚑ Fast: Native Rust extension compiled to WebAssembly

Available Tools

  • compress_json - Compress JSON to ASON format (20-60% token reduction)
  • decompress_ason - Decompress ASON back to JSON (lossless)
  • get_compression_stats - Analyze compression metrics
  • configure_compressor - Customize compression settings

πŸ“¦ Installation

Prerequisites

Option 1: From Zed Extensions (Recommended)

Coming soon - pending submission to Zed extensions repository

  1. Open Zed
  2. Press Cmd+Shift+X (Extensions)
  3. Search for "ASON MCP Server"
  4. Click Install

Option 2: Local Development Installation

# Clone the repository
git clone https://github.com/ason-format/zed-extension
cd zed-extension

# Install Rust dependencies and build
cargo build --release

# Install as dev extension in Zed
# In Zed: Cmd+Shift+P β†’ "zed: install dev extension" β†’ Select this folder

πŸš€ Usage

Once installed, the ASON MCP server is available in Zed's AI assistant:

Compress JSON

Ask the assistant: "Compress this JSON using ASON"
{
  "users": [
    {"id": 1, "name": "Alice", "age": 25},
    {"id": 2, "name": "Bob", "age": 30}
  ]
}

The assistant will use the compress_json tool and return:

users:[2]{id,name,age}
1|Alice|25
2|Bob|30

Decompress ASON

Ask the assistant: "Decompress this ASON to JSON"
users:[2]{id,name,age}
1|Alice|25
2|Bob|30

Returns the original JSON structure.

Get Compression Stats

Ask the assistant: "Show me compression stats for this JSON"
{"data": [...]}

Returns detailed metrics:

  • Original vs compressed tokens
  • Byte size comparison
  • Reduction percentage

πŸ”§ Configuration

Enable the Context Server

After installing the extension, enable it in your Zed settings.json:

{
  "context_servers": {
    "ason-mcp/ason": {
      "source": "extension",
      "enabled": true,
      "settings": {}
    }
  }
}

The extension will automatically:

  1. Install @ason-format/mcp-server@latest from npm
  2. Start the MCP server using Node.js
  3. Make ASON tools available in the AI Assistant

No additional configuration needed!

πŸ“Š How It Works

This extension provides a thin Rust wrapper around the @ason-format/mcp-server npm package:

  1. Extension loads β†’ Rust code initializes in Zed
  2. MCP server installs β†’ Uses npm_install_package API to get latest version
  3. Server starts β†’ Executes Node.js with installed package path
  4. Tools available β†’ AI assistant can use ASON compression tools
  5. Auto-updates β†’ Checks and installs latest version on each launch

πŸ—οΈ Architecture

Zed AI Assistant
    ↓ loads
Rust Extension (WebAssembly)
    ↓ installs
@ason-format/mcp-server (npm)
    ↓ executes
Node.js + MCP Server
    ↓ provides
MCP Tools (compress/decompress/stats/configure)
    ↓ uses
@ason-format/ason (core library)

πŸ› οΈ Development

Requirements

  • Rust (via rustup)
  • Node.js v18+

Build

# Build the extension
cargo build --release

# Test locally in Zed
# Cmd+Shift+P β†’ "zed: install dev extension"

Project Structure

zed-extension/
β”œβ”€β”€ Cargo.toml          # Rust dependencies (zed_extension_api, serde, schemars)
β”œβ”€β”€ extension.toml      # Zed extension manifest
β”œβ”€β”€ src/
β”‚   └── lib.rs         # Extension implementation (context_server_command)
β”œβ”€β”€ scripts/
β”‚   └── release.sh     # Release automation
β”œβ”€β”€ CHANGELOG.md        # Version history
└── README.md           # This file

🎯 Use Cases

1. Reduce LLM Token Costs

"Compress this API response before sending to GPT"
{large JSON object}

Save 20-60% on token costs.

2. Analyze Data Efficiency

"Show me how much this JSON could be compressed"
{your data}

Get metrics before committing to ASON.

3. Store Compressed Data

"Convert this to ASON format for storage"
{data to store}

Reduce database storage size.

πŸ“š What is ASON?

ASON (Aliased Serialization Object Notation) is a token-optimized JSON compression format designed for LLMs.

Key Features:

  • 20-60% token reduction
  • 100% lossless fidelity
  • Human-readable
  • Multiple compression techniques

Compression Techniques:

  1. Sections: @section - Organize related objects
  2. Tabular Arrays: key:[N]{fields} - CSV-like format for uniform arrays
  3. Semantic References: $var - Deduplicate repeated values
  4. Pipe Delimiter: | - More token-efficient than commas
  5. Dot Notation: user.profile.name:Alice - Flatten nested objects

Learn More:

πŸš€ Publishing

To release a new version:

./scripts/release.sh

# 1. Select version bump (patch/minor/major)
# 2. Update CHANGELOG.md when prompted
# 3. Confirm push

# Then submit to Zed Extensions:
# https://github.com/zed-industries/extensions

πŸ“ License

MIT Β© ASON Project Contributors

🀝 Contributing

Contributions welcome! Please open an issue or pull request.

πŸ”— Links

About

Compress and decompress JSON using the ASON format directly in Zed IDE. Reduce token usage by 20-60% for LLM applications while maintaining 100% lossless round-trip fidelity.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published