BSD Ports

misc/lean-ctx 3.10.5.146 DragonFly

Hybrid Context Optimizer: MCP Server, reduces LLM token consumption

System
DragonFly
Repository
DPorts
Maintainer
[email protected] (as in FreeBSD)
License
MIT
Categories
misc
Package size
17400.4 KiB, 95500.9 KiB installed

Description

LeanCTX is a hybrid context optimizer designed to reduce token consumption in AI-assisted software engineering workflows. It acts as a cognitive filter between AI tools and Large Language Models (LLMs), stripping noise like comments and whitespace to lower costs and maximize context efficiency.

Features:

  • AST-Aware Compression: Uses Tree-sitter to parse 14 languages, preserving critical types and logic while reducing token counts by up to 90%25.
  • MCP Server Integration: Provides 24 tools that replace standard file reads with compressed alternatives for any MCP-enabled AI client.
  • Automated Shell Hook: Intercepts and compresses output from over 90 common command patterns (git, npm, cargo, docker, kubectl, etc.).
  • Privacy and Performance: Single Rust binary with zero dependencies and no cloud requirements.

In the other systems

The newest version among them is 3.12.6, as upstream numbers it.

SystemPortVersionVulnerabilitiesStatusMaintainerLast update
DragonFlymisc/lean-ctx3.10.5.146 behind since 2026-10-11none known-[email protected]-
FreeBSDmisc/lean-ctx3.12.6 newestnone known-[email protected]2026-11-16
MidnightBSDai/lean-ctx by name3.11.4_1 behind since 2026-10-30no data-[email protected]2026-11-13
HardenedBSDmisc/lean-ctx3.12.2 behind since 2026-11-11no data-[email protected]-
GhostBSDmisc/lean-ctx3.12.0 behind since 2026-11-05no data-[email protected]-

Version history 1

  1. 3.10.5.146

Upstream's version as each commit to the port's Makefile set it, or as this site first saw it in the system's packages; the tree's own revisions are not versions here.

Install

Binary package:

pkg install lean-ctx

From DPorts:

cd /usr/dports/misc/lean-ctx && make install clean

Dependency graph

Ports that need it on the left, what it needs to run on the right; at most 8 of each. "Dependencies" below lists them all.

Dependencies

Run dependencies 1

No port depends on this one.

Configuration

No options to configure.

Service scripts
none

Message after installing

lean-ctx is a Model Context Protocol (MCP) server.

The Model Context Protocol (MCP) is an open standard that allows developers
to build secure, two-way connections between their data sources and AI models.
It enables AI models to interact with external tools and data in a standardized
way.

Communication with lean-ctx can be done via multiple transports:
* STDIO: The default transport for local MCP servers, where the host
  communicates with the server over standard input and output.
* HTTP: Using Server-Sent Events (SSE) for server-to-client communication.

The HTTP transport is particularly beneficial as it allows lean-ctx to run
as a remote service, enabling multiple clients to connect to a single
server instance, and facilitating use cases where the AI model and the
data source are on different machines.

Note that using the HTTP transport requires setting up and starting the
lean_ctx service. You can enable it by adding lean_ctx_enable="YES"
to /etc/rc.conf and starting it with:
# service lean_ctx start