Malon
Local-first MCP server for AI coding agents that provides isolated code search, memory ledger, context rot detection, and cost governance.
README
Malon
Local-first MCP server for AI coding agents — search isolation, memory ledger, context rot detection, and cost governance.
Malon sits between your existing coding agent (Claude Code, Codex CLI, Cursor, Windsurf, Aider) and your codebase. It isolates the noisy search work into a cheap subagent so the primary model only sees the 2-3 file:line spans that actually matter — never the 40 grep hits and six dead-end files.
Quick start
# Initialize .malon/ directory, config, and full index
npx malon init
# Show session status, spend, rot flags, and tokens saved
npx malon status
# Full re-index
npx malon index
# Incremental re-index (uses git diff since last indexed sha)
npx malon init --incremental
# Delete regenerable index, cache, and usage data
npx malon reset
Setup
- Install:
npm install -g malonor run vianpx malon - Init: Run
npx malon initin your project root. This creates.malon/with:config.yml— pricing, search, rate limits, loggingindex.db— SQLite FTS5 index of your codebase (gitignored)memory/— git-tracked markdown ledger (decisions, conventions, sessions)
- Configure your agent: Add the AGENTS.md snippet to your agent's rules file
- Start the MCP server: Run
malon(or configure your IDE to launch it with STDIO)
How it works
Your Coding Agent ──→ malon_search("where is JWT validated?")
│
▼
Search Subagent (Haiku-class)
2-4 rounds of: fts_grep → read_span → graph_walk
│
▼
1-3 precise file:line spans
│
▼
Your agent reads only those spans
│
▼
Cost Governor logs tokens_saved
Rot Governor checks for context thrashing
Commands
malon init # Initialize .malon/ dir, config, and full index
malon init --incremental # Incremental re-index (git diff based)
malon index # Full re-index (re-parses all supported files)
malon status # Show session stats, spend, rot flags, tokens saved, memory summary
malon reset # Delete index.db, usage.log, and .malon.lock
Tools
Malon exposes MCP tools your coding agent can call:
| Tool | Purpose |
|---|---|
malon_search |
Search the indexed codebase and return 1-3 file:line spans with a one-line justification |
malon_memory_get |
Retrieve relevant memory entries from the ledger (decisions, conventions, sessions) |
malon_memory_write |
Write a new entry to the memory ledger. Scoped to .malon/memory/. Rejects secrets. |
malon_status |
Current session status: spend, tokens used, tokens saved vs. baseline, rot flags |
malon_checkpoint |
(Coming soon) — Explicitly trigger a rot checkpoint, saving session progress |
For your AGENTS.md
Add this snippet to your CLAUDE.md, AGENTS.md, or .cursorrules to teach
your coding agent how to use Malon:
## Malon MCP tools
Malon gives you search, memory, and status tools. Use them instead of
native grep/read when possible to stay focused on the answer.
1. When you have a question about "where is X" or "how does Y work,"
call `malon_search` first. It returns 1-3 precise file:line spans
with a one-line justification — enough to read the right slice
instead of guessing.
2. When you need cross-file context (callers, imports, related symbols),
call `malon_search` with the symbol name. The Subagent walks the
call graph; you don't have to.
3. When you finish a non-trivial change, call `malon_memory_write`
with the decision you made. Future sessions will see it via
`malon_memory_get` and pick up where you left off.
4. When you reopen a project after days/weeks, call `malon_memory_get`
with an empty query to get a "where we left off" summary. Call it
with a specific topic to load deeper context.
5. Call `malon_status` to check session spend, tokens saved vs.
baseline, and rot flags. If a `rot_flag` is set, consider starting
a fresh session — your progress is saved in the memory ledger.
6. **Don't bypass Malon with native tools for cross-file questions.**
The whole point of Malon is to keep the expensive primary model
from burning tokens on search noise. If Malon's search is missing
something, report it — don't silently work around it.
Security
- Local-first by default. Your code stays on your machine. The Search Subagent sends short code spans (1-3 file:line snippets) to your configured LLM provider — never full files.
- Secret scanning.
malon_memory_writerejects writes containing known secret patterns (API keys, tokens, private keys). - Path confinement. All filesystem operations are validated against the repo root. Path escape attacks are rejected at the code level.
- No telemetry. Zero outbound calls except to your configured LLM provider. Opt-in only.
- Lock file. A
.malon.lockprevents concurrent server starts in the same repo.
See SECURITY.md for the full security posture.
Tokens saved
Malon tracks the difference between what the primary agent would have spent
reading files natively and what it actually spent receiving Malon's search results.
This number is shown in malon status as tokens_saved_cumulative.
Important: This is a transparency signal, not an optimization target. The agent's thinking is never capped for cost reasons. If the metric is negative on a given call, the system logs it honestly and continues.
Error handling
When a tool encounters an error, the response includes a reference ID:
error: rate_limit: Rate limit exceeded
try: Wait for the rate limit window to reset, or adjust limits in config.yml
ref: 550e8400-e29b-41d4-a716-446655440000
Include this session ID when reporting issues.
Rate limits
Default per-session limits on malon_search:
- 100 calls per rolling 60-second window
- 500,000 tokens per session
Adjustable in .malon/config.yml under rate_limits:
rate_limits:
max_calls_per_session: 100
max_tokens_per_session: 500000
window_ms: 60000
Concurrent server protection
Malon uses .malon/.malon.lock to prevent multiple server instances from
running in the same repo simultaneously. If a second instance starts, it
exits with a clear message. Stale lock files from crashed processes are
detected and cleaned up automatically.
Configuration
All configuration lives in .malon/config.yml:
- pricing — LLM provider pricing tables with
last_verifieddate - search — Provider, model, timeout, max rounds for the Search Subagent
- cost — Hard dollar ceiling (default: none) and shadow heuristic for tokens-saved
- rate_limits — Per-session call/token limits
- log — Log level (info/debug) and optional file path
- telemetry — Opt-in telemetry (default: disabled)
Supported languages
Currently indexed and parsed:
- TypeScript / TSX
- JavaScript / JSX / MJS / CJS
- Python
- Go
- Rust
- Java
Documentation
- AGENTS.md — Full engineering manual with architecture, security posture, and development guide
- SECURITY.md — Security posture and data handling for end users
- TERMS.md — Terms of service
- PRIVACY.md — Privacy policy
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。