Documentation
Installation
The two paths are functionally identical — only the index backend differs. Requires Node >= 20.
The tarball prints a SQLITE BACKEND upgrade hint at startup; on a networked machine cd malong && npm ci upgrades it to the full backend.
Both install paths bundle the Rust parsing binary — the MCP server auto-starts it on launch; no manual start needed.
Linux / macOS communicate over a Unix socket (default /tmp/malong-parse-$(id -u).sock); Windows uses TCP 127.0.0.1:31001 and the server spawns malong-parse.exe automatically.
Override the socket, port or binary with MALONG_SOCKET / MALONG_PORT / MALONG_PARSE_BIN (see environment variables).
Quick start
Index → locate the target symbol → assess blast radius → transactional edit (reversible) → run tests → lint/typecheck to finish.
MCP clients
The MCP layer is standard JSON-RPC over stdio, so any MCP client works. All configs below are tested end-to-end.
{ "$schema": "https://opencode.ai/config.json",
"mcp": {
"malong": {
"type": "local",
"command": ["node", "--max-old-space-size=512", "malong/mcp-server.js", "--workspace", "."],
"enabled": true
}
}
}
{ "mcpServers": {
"malong": { "command": "node", "args": ["/path/to/malong/mcp-server.js"] }
}
}
claude mcp add liuhe -- node /path/to/malong/mcp-server.js --workspace /path/to/project claude mcp list # → "liuhe … ✔ Connected" # Headless example claude -p "index the workspace with reindex, then find createDb with symbol_search" \ --allowedTools "mcp__liuhe__reindex" "mcp__liuhe__symbol_search"
model = "deepseek-v4-flash" model_provider = "opencode-zen" [model_providers.opencode-zen] name = "OpenCode Zen" base_url = "https://opencode.ai/zen/go/v1" # any OpenAI-compatible endpoint wire_api = "chat" env_key = "OPENCODE_ZEN_API_KEY" # codex reads the API key from this env var [mcp_servers.liuhe] command = "node" args = ["/path/to/malong/mcp-server.js", "--workspace", "/path/to/project"]
Version note: recent codex releases force the OpenAI Responses API — use a version that still supports wire_api = "chat" (verified with 0.50.0).
bash malong/dsh/install-dsh.sh # idempotent; edits ~/.dsh/profiles/web/cordis.patch.yml with backup pkill -f "dsh web"; dsh web --port 3456 --host 0.0.0.0 --trusted-host <LAN IP>
The bridge registers all 38 tools as malong__<tool> and auto-fills workspace_dir from the current conversation's workspace (explicit paths still win). Full guide incl. index rules: malong/dsh/DSH接入说明.md
CLI options
| Option | Description |
|---|---|
| --workspace <dir> | Root directory to index and operate on |
| --concurrency <n> | Number of parallel tasks |
| --max-old-space-size=<MB> | V8 heap cap, 512 recommended; warns at startup if unset and the heap is unlimited |
| --expose-gc | Enables periodic GC + memory monitoring (pairs with the health / gc tools) |
Environment variables
All optional — sensible defaults apply when unset.
| Variable | Default | Purpose |
|---|---|---|
| MALONG_STATE_DIR | ~/.config/malong | Where usage / feedback / edit-stats files are written; override for tests or sandboxed hosts |
| MALONG_SOCKET | /tmp/malong-parse-$(id -u).sock | Unix socket path to the parse daemon (Linux / macOS) |
| MALONG_PORT | 31001 | TCP port for the parse daemon (Windows) |
| MALONG_PARSE_BIN | bundled / PATH | Binary used when the client auto-starts the daemon |
| MALONG_PARSE_MODE | rust-service | Parse transport; only rust-service is supported in the current version |
| MALONG_WS_GC_DAYS | 14 | Days a workspace index cache may sit untouched before health cleanup prunes it; 0 disables |
44 MCP tools
Every tool is pure regex / AST — zero LLM calls, reproducible, auditable, CI-friendly. Expand a group for per-tool descriptions.
I/O primitives 3 ▸
Index & search 5 ▸
Analysis 8 ▸
Editing & refactor 7 ▸
Quality & security 8 ▸
Engineering 8 ▸
Deps & system 5 ▸
Tool Routing Map
All 44 tools split into 4 sequence diagrams — every ok/err route is drawn (green solid = ok, red dashed = err); dashed card = target lives in another group; thick green = main chain. The edit → test loop (edit_transaction ↔ diff_facts ↔ test_bridge ↔ debug_runner) is fully inside 2/4.
Legend
Node index (T01–T44) (44)
Language support
Symbol-level read / write (read & write_symbol) supports 10 language families, with automatic syntax self-check after writes (node --check / py_compile).