@bentlyr/midown
v2.0.11
Published
Headless local context engine and CLI to map codebase dependencies for AI consumption.
Downloads
4,802
Maintainers
Keywords
Readme
Midown CLI
Architect Your Systems. Let AI Understand Them.
Midown is a headless local context engine and CLI built for developers. It maps your entire codebase into a structured node graph, visualizes the architecture locally, and exposes it via Model Context Protocol (MCP) to any AI coding assistant — keeping your prompt context hyper-efficient and intelligent.
By analyzing the Abstract Syntax Trees (AST) and generating semantic summaries of your files, Midown enables your AI tools (like Claude Desktop, Cursor, or VS Code Copilot) to intrinsically understand your repository layout without exhausting context window limits.
🚀 Installation
Install Midown globally using npm to ensure the CLI is available across all your projects:
npm i -g @bentlyr/midown📖 Basic Workflow
To get Midown working with your codebase, follow this simple 4-step workflow:
1. Pin your project
Navigate to your project directory and run the add command to set the target workspace.
cd /path/to/your/project
midown add .2. Setup Your Local or Cloud Model (Recommended: Use Local model with huge context window)
Setup your AI provider via the interactive set command. Download your local models first via Ollama, or grab a cloud API key from your provider.
midown set
// [1] Local-based (Ollama) | [2] Cloud-based (OpenAI, Google, Anthropic, OpenRouter)
// [Local] → Automatically fetches all downloaded Ollama models
// [Cloud] → Enter API key → Fetches available models from the provider
// Select your model
// 🧠 The max context window for <model> is <N> tokens. ← shown automatically
// Enter the max context window to use (or press Enter to accept the default)For local models, Midown auto-detects the exact context window from Ollama's model metadata. For cloud models, it shows a well-known estimate based on the selected model (e.g. Gemini 1.5 Pro = 2M, GPT-4o = 128K, Claude 3.5 = 200K). You can always override the value with your own budget.
3. Index your workspace
Process and parse the codebase. Midown builds a massive local spatial edge index, mapping files, functions, and relational databases.
midown push4. Start the Context Engine (MCP)
Start the background server process, making the indexed graph available to AI tools on stdio.
midown start🧠 AI Engine Features
Midown uses an advanced ingestion engine designed to seamlessly handle massive codebases without crashing:
- Resilient Cloud Indexing: Implements automatic exponential backoff to handle intermittent 500 errors and rate limits from cloud providers (OpenAI, Google, Anthropic).
- Strict Local LLM Jailbreaking: Optimized specifically for local inference (Ollama, Qwen, Llama). Prevents local models from leaking their internal "Chain of Thought" processing into your database summaries via strict prompt constraints.
- Flawless Console Output: Background progress bars and processing warnings execute cleanly via smart ANSI line-clearing.
🎨 Interactive Visualization
Midown comes with a stunning built-in visualizer. Once you've indexed your codebase using midown push, you can launch a local dashboard to explore the topological node network visually!
midown visualizeThis opens a premium, interactive web dashboard on http://localhost:3456 where you can:
- Search for any file, function, or database schema.
- Filter between raw code components and data flows.
- Interact dynamically: Drag file nodes and watch all associated child functions logically follow them through the physics simulation.
- Inspect node relationships, abstract syntax connections, and AI semantic summaries in real-time.
🛠️ CLI Commands Reference
midown add [directory]- Pins a folder structure to the engine memory map. Defaults to the current working directory.midown set- Interactively configures your AI provider, selects a model, and sets the max context window budget (auto-detected for local Ollama models).midown push- Processes and indexes the directory node-edges natively via AST & Semantic Summaries.midown start- Starts the background MCP server process over standard input/output.midown visualize- Launches a local web-app visualization tool to let you explore the network visually.midown switch <directory>- Changes the active operational environment context to a different folder path.
🤖 MCP Integration
Once Midown is indexing a project, you can attach it to any MCP-compliant AI assistant.
For example, to configure Claude Desktop, add the following to your claude_desktop_config.json:
{
"mcpServers": {
"midown": {
"command": "midown",
"args": ["start"]
}
}
}Now, your AI can automatically query the get_codebase_graph, search_nodes, and get_file_context tools provided by Midown!
🔗 Links
- Website: midown.net
- Author: bntlyr
