Autonomous coding agent with MCP, LangGraph and Docker - npm wrapper
npm install @midewev/midewev-clibash
npm
npm install -g @midewev/midewev-cli
yarn
yarn global add @midewev/midewev-cli
pnpm
pnpm add -g @midewev/midewev-cli
`
$3
The npm package provides a CLI wrapper, but requires the Python backend to be installed separately:
`bash
Clone the repository
git clone https://github.com/LunarBs7/Midewev-CLI.git
cd Midewev-CLI
Install Poetry (if not already installed)
pip install poetry
Install Python dependencies
poetry install
Verify installation
poetry run codeforge --version
`
$3
- Node.js 18.0.0 or higher
- Python 3.11 or higher
- Poetry for Python dependency management
- Docker (optional, for sandbox execution)
Quick Start
$3
Simply run midewev without arguments to launch the beautiful interactive interface:
`bash
midewev
`
You'll be greeted with:
- Stunning ASCII art logo with welcome message
- Interactive menu with arrow key navigation
- Quick action templates: Tests, Bug Fixes, Refactoring, Documentation, Code Review
- Real-time spinners and colored output
- Easy-to-use prompts for all options
See INTERFACE.md for a complete visual guide!
$3
Or use direct commands for automation and scripting:
`bash
Initialize in your project
midewev init
Execute a task directly
midewev execute "Add unit tests for authentication module"
Start interactive chat mode
midewev interactive
Start MCP server
midewev agent --mcp-server
View statistics
midewev stats
`
CLI Commands
$3
Initialize Midewev CLI in your project:
`bash
midewev init
midewev init --project-path /path/to/project
midewev init --force # Overwrite existing configuration
`
$3
Execute a coding task:
`bash
midewev execute --prompt "Task description"
midewev execute --prompt "Fix bug in auth.py" --output-format json
midewev execute --prompt "Refactor user service" --thread-id my-thread
`
Options:
- --prompt (required): Task description
- --output-format: Output format (markdown or json)
- --checkpoint: Enable checkpointing (default: true)
- --thread-id: Thread ID for checkpointing
$3
Start interactive mode:
`bash
midewev interactive
`
Type your requests naturally, type exit to quit.
$3
Start the MCP server:
`bash
midewev agent --mcp-server
`
$3
View agent statistics:
`bash
midewev stats
`
$3
Start GitHub webhook handler:
`bash
midewev github --port 8080
`
Programmatic API
You can also use Midewev CLI programmatically from Node.js:
`javascript
import midewev from '@lunarbsdev/midewev-cli';
// Initialize project
await midewev.init('./my-project');
// Execute a task
const result = await midewev.executeTask(
'Add error handling to user service',
{
format: 'json',
threadId: 'task-123',
onProgress: (output) => console.log(output)
}
);
console.log(result.summary);
// Get statistics
const stats = await midewev.getStats();
console.log(Total tasks: ${stats.tool_calls.total});
// Start MCP server
const server = midewev.startMCPServer({ detached: true });
`
$3
#### execute(command, args, options)
Execute any Midewev CLI command:
`javascript
const result = await midewev.execute('execute', ['--prompt', 'Task'], {
env: { LOG_LEVEL: 'DEBUG' },
onStdout: (data) => console.log(data),
onStderr: (data) => console.error(data)
});
`
#### init(projectPath)
Initialize Midewev in a project:
`javascript
await midewev.init('./my-project');
`
#### executeTask(prompt, options)
Execute a task:
`javascript
const result = await midewev.executeTask('Add tests', {
format: 'json',
threadId: 'thread-1',
onProgress: (output) => {}
});
`
#### getStats()
Get agent statistics:
`javascript
const stats = await midewev.getStats();
`
#### startMCPServer(options)
Start MCP server:
`javascript
const server = midewev.startMCPServer({
stdio: 'inherit',
detached: false
});
// Stop server
server.kill();
`
Configuration
Create a .env file in your project:
`env
Required
OPENAI_API_KEY=sk-...
Optional
ANTHROPIC_API_KEY=sk-ant-...
GITHUB_TOKEN=ghp_...
DOCKER_ENABLED=true
MIN_TEST_COVERAGE=90
LOG_LEVEL=INFO
`
Architecture
Midewev CLI consists of:
1. Node.js Wrapper (this package) - Provides npm installation and CLI interface
2. Python Backend - Core agent with MCP server, LangGraph orchestration, and Docker sandbox
3. MCP Protocol - Communication between components
`
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Node.js CLI (midewev command) ā
āāāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāāāāā
ā (spawn)
āāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāāā
ā Python Backend (Poetry/pip) ā
ā - MCP Server (13 tools) ā
ā - LangGraph Orchestrator ā
ā - Docker Sandbox ā
ā - ChromaDB Memory ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
`
Features
- š¤ Autonomous Agent: Plan, execute, validate, and report
- š§ 13 MCP Tools: File ops, git, code analysis, testing, web fetch, monitoring
- š§ LangGraph Workflow: Planner ā Executor ā Validator ā Reporter
- š Secure Sandbox: Docker isolation with resource limits
- š¾ Vector Memory: ChromaDB for long-term context
- ā
Validation Pipeline: Static analysis, security scan, style check, tests
- š Observability: Comprehensive metrics and logging
- š Extensible: Custom tool registry
Troubleshooting
$3
`bash
Install Python 3.11+
macOS
brew install python@3.11
Ubuntu/Debian
sudo apt install python3.11
Windows
Download from https://www.python.org/downloads/
`
$3
The installer will fall back to pip automatically. You can also install Poetry manually:
`bash
curl -sSL https://install.python-poetry.org | python3 -
`
$3
Docker is optional. Disable it in .env:
`env
DOCKER_ENABLED=false
`
$3
On Linux/macOS, you may need to add execute permissions:
`bash
chmod +x $(which midewev)
`
Development
`bash
Clone repository
git clone https://github.com/LunarBs7/Midewev-CLI.git
cd Midewev-CLI
Install npm dependencies
cd npm
npm install
Link locally
npm link
Now you can use 'midewev' command globally
midewev --help
``