MCP Server
Laconic ships as a Model Context Protocol (MCP) server that any MCP-compatible agent can call directly. The agent decides when compression is worth it; Laconic provides the tools.
Setup
Build the MCP server binary:
cargo build --release --bin laconic-mcp
cp target/release/laconic-mcp /usr/local/bin/
Agent Configuration
Add this to your MCP client config (Windsurf, Cursor, Claude Desktop, or any MCP-compatible agent):
{
"mcpServers": {
"laconic": {
"command": "laconic-mcp",
"args": []
}
}
}
The server communicates over stdio — no ports, no HTTP, no configuration.
Available Tools
compress_markdown
Compresses a markdown string and returns the result with token statistics.
Input:
{
"markdown": "# Title\n\n[]\n\n| Col | Col |\n|---|---|\n| A | B |"
}
Output:
{
"text": "# Title\n\nCol,Col\nA,B",
"original_tokens": 45,
"compressed_tokens": 12,
"tokens_saved": 33,
"savings_pct": 73.3
}
estimate_savings
Returns token statistics and a recommendation without the compressed text. Useful for agents that want to decide whether compression is worthwhile before committing.
Input:
{
"markdown": "Some markdown content..."
}
Output:
{
"original_tokens": 500,
"compressed_tokens": 420,
"tokens_saved": 80,
"savings_pct": 16.0,
"recommendation": "Compress — 16% savings available."
}
Typical Agent Workflow
- Agent retrieves a document for context injection
- Agent calls
estimate_savingsto check if compression is worthwhile - If savings exceed a threshold (e.g., 5%), agent calls
compress_markdown - Agent uses the compressed text in its prompt
This keeps the agent in control of the cost/benefit tradeoff.
Testing the Server
You can test the MCP server manually by piping JSON-RPC messages:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | laconic-mcp
This returns the list of available tools and their schemas.