v2.0.0 Β· MCP Native Β· KiloCode Ready

πŸ₯œ PeanutAgent
Enterprise

A production-ready AI Gateway with native MCP Server, Ollama local inference, Docker management, and enterprise-grade security.
Zero API costs. Full privacy. Runs on your machine.

TypeScript 5.7 Next.js 15 MCP 2024-11-05 Python 3.10+ 80% Coverage MIT License
πŸš€ Get Started ⭐ Star on GitHub πŸ“– Documentation
7
MCP Tools
80%+
Test Coverage
0
API Costs
AES-256
Encryption
DDD
Architecture

Core Features

Everything you need for
local AI development

PeanutAgent bridges local LLMs with enterprise-grade tooling β€” all running on your machine.

πŸ”Œ
MCP Server (v2.0.0)
Full Model Context Protocol server at /mcp. KiloCode discovers and uses your local Ollama models as native tools. 7 tools, 4 resources, 2 prompts β€” spec-compliant.
New in v2.0.0
πŸ€–
Local AI Backend
Use PeanutAgent as a free, private AI backend for KiloCode. Supports qwen2.5, llama3.2, codellama, and any Ollama model. No data leaves your machine.
Zero API Costs
🐳
Docker Management
Manage containers directly from KiloCode via MCP tools. List, start, stop, inspect, and stream logs β€” all from your IDE without switching context.
πŸ”’
Enterprise Security
JWT httpOnly cookies, TOTP 2FA (RFC 6238), scrypt password hashing, AES-256-GCM encrypted secrets, and an immutable SHA-256 audit chain.
πŸ“Š
Admin Dashboard
Next.js 15 dashboard with real-time metrics, agent management, Docker control, WebSocket terminal, and a dedicated KiloCode MCP integration page.
βš–οΈ
Smart Load Balancing
OpenClaw Orchestrator implements Smooth Weighted Round-Robin (Nginx algorithm) with health-based routing, per-agent metrics, and 30s health checks.
🧠
RAG Memory System
Python agent with JSONL append-only memory store, Ollama embeddings, and cosine similarity retrieval. Learns from past successful interactions.
πŸ”„
Reflection Loop
Auto-correction system with Pydantic schema validation. Up to 3 retries with improved inputs. Heuristic fallback for malformed JSON responses.
πŸ“‘
OpenTelemetry
Full distributed tracing with OTEL SDK. Auto-instrumented Node.js with OTLP HTTP exporter. Trace every MCP call, agent dispatch, and Docker operation.

Enterprise Dashboard

Beautiful. Fast. Powerful.

The new enterprise dashboard features glassmorphism design, animated metrics, neon effects, and real-time monitoring.

PeanutAgent Enterprise Dashboard
PeanutAgent Login
πŸ” Secure Login
JWT + TOTP 2FA authentication
Dashboard Overview
πŸ“Š Live Metrics
Real-time agent & container monitoring

KiloCode Integration

Connect in 30 seconds.
Use local AI for free.

PeanutAgent v2.0.0 ships a full MCP server that KiloCode discovers natively. Free, private AI inference directly in your IDE.

~/.kilo/mcp_settings.json
{ "mcpServers": { "peanut-agent": { "url": "http://localhost:3001/mcp", "description": "PeanutAgent Enterprise β€” Local AI Gateway" } } }
πŸ€–
peanut_dispatch_agent
Send tasks to local Ollama agents β€” free, private inference with zero API costs
πŸ“‹
peanut_list_agents
Discover available local AI agents with health status and model info
🐳
peanut_docker_list
List Docker containers with real-time status and resource metrics
⚑
peanut_docker_control
Start, stop, or restart Docker containers directly from KiloCode
πŸ“œ
peanut_docker_logs
Retrieve container logs for debugging β€” tail N lines or stream live
πŸ’š
peanut_gateway_status
Check PeanutAgent gateway health, version, and MCP service status
πŸ”—
peanut_kilo_complete
Proxy completions through PeanutAgent to Kilo Code API with encrypted key

Architecture

Domain-Driven Design.
Four clean layers.

The gateway follows strict DDD principles. Pure domain entities, isolated application services, and clean infrastructure adapters.

╔══════════════════════════════════════════════════════════════════════╗ β•‘ PeanutAgent Enterprise v2.0.0 β•‘ ╠══════════════════════╦═══════════════════════════════════════════════╣ β•‘ Next.js 15 Dashboard β•‘ Fastify API Gateway β•‘ β•‘ (Port 3000) β•‘ (Port 3001) β•‘ β•‘ ───────────────── β•‘ ────────────────────────────── β•‘ β•‘ β€’ Auth (2FA TOTP) β•‘ β€’ OpenClaw Orchestrator (SWRR) β•‘ β•‘ β€’ Agent Management β•‘ β€’ JWT Auth (httpOnly cookies) β•‘ β•‘ β€’ Docker Control β•‘ β€’ Immutable Audit Chain (SHA-256) β•‘ β•‘ β€’ Audit Log Viewer β•‘ β€’ Adaptive Rate Limiting β•‘ β•‘ β€’ WS Terminal β•‘ β€’ Docker Management API β•‘ β•‘ β€’ KiloCode MCP Page β•‘ β€’ Kilo Code Bridge (AES-256-GCM) β•‘ β•‘ β•‘ β€’ MCP Server (7 tools, 4 resources) β•‘ ╠══════════════════════╩═══════════════════════════════════════════════╣ β•‘ Data & Infrastructure β•‘ β•‘ SQLite (WAL) β”‚ Ollama LLM β”‚ Docker Socket β”‚ OpenTelemetry β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• ↕ MCP Protocol (2024-11-05) ╔══════════════════════════════════════════════════════════════════════╗ β•‘ KiloCode IDE β•‘ β•‘ peanut_dispatch_agent Β· peanut_docker_* Β· peanut_list_agents β•‘ β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

Security

Enterprise-grade security.
Zero compromises.

Every layer is hardened. From authentication to audit trails, PeanutAgent is built for production.

πŸ”‘ JWT Sessions

httpOnly, Secure, SameSite=Strict cookies. 8-hour expiry. Revokable sessions stored in SQLite.

πŸ“± TOTP 2FA

RFC 6238 via otplib. 10 single-use backup codes. Per-user rate limiting with exponential backoff.

πŸ” Password Hashing

scrypt (N=2¹⁴, r=8, p=1). 64-byte output with random 32-byte salt. Industry-standard parameters.

πŸ”’ AES-256-GCM

API keys encrypted at rest. Encryption key stored in env, never in database. Keys never exposed to frontend.

⛓️ Audit Chain

Immutable SHA-256 fingerprint chain. Each entry links to previous. Any modification breaks the chain β€” tamper detection is automatic.

πŸ›‘οΈ Security Headers

@fastify/helmet with HSTS, CSP, X-Frame-Options. CORS with configurable origins. SameSite=Strict cookies.


Tech Stack

Modern. Typed. Tested.

Built on the latest stable versions of the best tools in the ecosystem.

TypeScript 5.7
Next.js 15.1
Fastify 4.x
React 19.x
SQLite (WAL) 11.x
MCP Protocol 2024-11-05
Ollama Latest
Python 3.10+
Docker Any
Vitest 3.x
OpenTelemetry 1.x
Tailwind CSS 3.x

Quick Start

Up and running
in minutes.

Node.js 20+, pnpm 9+, and optionally Docker and Ollama.

STEP 1
Install Dependencies
Clone the repo and install all monorepo dependencies with pnpm.
pnpm install
STEP 2
Configure Secrets
Generate JWT secret and AES-256 encryption key, add to .env file.
openssl rand -hex 32
STEP 3
Start Gateway
Launch the Fastify API Gateway on port 3001 with hot reload.
pnpm --filter @peanut/gateway dev
STEP 4
Start Dashboard
Launch the Next.js 15 admin dashboard on port 3000.
pnpm --filter @peanut/dashboard dev
STEP 5
Connect KiloCode
Add the MCP server URL to KiloCode settings and start using local AI.
http://localhost:3001/mcp
PROD
Docker Compose
Deploy all services including Ollama with a single command.
docker compose up -d
bash β€” Full setup
# Clone & install git clone https://github.com/your-org/peanut-agent.git && cd peanut-agent pnpm install && pnpm --filter @peanut/shared-types build # Configure (generate secrets) cp services/gateway/.env.example services/gateway/.env # Edit .env: JWT_SECRET and KILO_ENCRYPTION_KEY # Start development servers pnpm --filter @peanut/gateway dev # Terminal 1 β†’ port 3001 pnpm --filter @peanut/dashboard dev # Terminal 2 β†’ port 3000 # Open dashboard β†’ http://localhost:3000 # Login: admin@peanut.local / PeanutAdmin@2024!

Ready to go local-first?

Free, private AI inference. Enterprise security. KiloCode native.

⭐ Star on GitHub πŸ“– Read the Docs πŸ‡ͺπŸ‡Έ Leer en EspaΓ±ol