Skip to content

About

🦞 Modern self-hosted AI chat server with streaming, multi-user support, and admin panel. Built for Ollama.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

88 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌸 Ash Server

Ash Server β€” Secure AI Orchestrator

Security-first, privacy-first, locally-running AI backend β€” built as a hardened alternative to OpenClaw, powered by gemma4-turbo.

License: MIT .NET 10 Model: gemma4-turbo


Why Ash Server Exists

Self-hosted AI platforms like OpenClaw have grown rapidly β€” but without security foundations. The result is a class of real vulnerabilities:

Problem OpenClaw Ash Server
Identity layer ❌ None βœ… JWT auth + RBAC roles
External chat permissions ❌ Anyone can invoke agent βœ… Permission-gated by linked identity
Prompt injection protection ❌ None βœ… 7-pattern injection guard
Rate limiting ❌ None βœ… Per-user sliding window
Credential management ❌ Edit JSON files βœ… Admin panel, masked storage
Audit trail ❌ None βœ… Full per-action audit log
Discord/Slack/Telegram security ❌ No gates βœ… RBAC via identity linking
Service deployment ❌ Manual βœ… Windows/Linux/macOS installer

Ash Server is not a wrapper around OpenClaw β€” it is a clean reimplementation in C# / ASP.NET Core with safety and trust built into every layer.


Powered by Gemma 4 Turbo

Ash Server ships with first-class support for ssfdre38/gemma4-turbo β€” a purpose-built quantization of Google's Gemma 4 family:

  • IQ4_XS non-linear quantization applied to original bf16 source weights (not re-quantizing already-quantized weights)
  • Full vision + multimodal capabilities preserved
  • Runs on commodity hardware β€” no GPU required
Tag Size RAM Best For
e2b 4.3 GB 8 GB+ Laptops, Raspberry Pi 5
e4b / latest 6.1 GB 10 GB+ Desktops, servers (recommended)
26b 15 GB 20 GB+ High quality
31b 18 GB 24 GB+ Maximum quality
ollama run ssfdre38/gemma4-turbo   # pull and run e4b (recommended)

17,300+ downloads on Ollama Hub as of submission date β€” the #2 most downloaded Gemma 4 model in the world, behind only Google's official release, with 6.8x more downloads than the next community model.


Quick Start

Option A β€” Pre-built binary (recommended)

Download from the latest release:

Platform Download
Windows (x64) ash-server-*-windows-x64-setup.exe
Linux (x64) ash-server-*-linux-x64.zip
Linux (arm64) ash-server-*-linux-arm64.zip
macOS (Apple Silicon) ash-server-*-osx-arm64.zip
macOS (Intel) ash-server-*-osx-x64.zip

Windows β€” run the .exe installer as Administrator. Done.

Linux / macOS β€” unzip and run the bundled install script:

unzip ash-server-*-linux-x64.zip -d ash-server
sudo bash ash-server/build/linux/install.sh ash-server/ash-server

Option B β€” Install from source (git clone)

Requires .NET 10 SDK and Ollama.

Linux / macOS:

git clone https://github.com/ssfdre38/ash-server
sudo bash ash-server/install.sh          # build + install as system service
# β€” or β€”
bash ash-server/install.sh --run         # build + run in foreground (no root needed)

Windows (PowerShell as Administrator):

git clone https://github.com/ssfdre38/ash-server
cd ash-server
.\install.ps1           # build + install as Windows Service
# β€” or β€”
.\install.ps1 -Run      # build + run in foreground (no admin needed)

Pull the recommended model first:

ollama pull ssfdre38/gemma4-turbo

Open http://localhost:18799 β€” the first registered user becomes admin automatically.

Uninstall

# Linux / macOS:
sudo bash ash-server/install.sh --uninstall

# Windows (Administrator PowerShell):
.\install.ps1 -Uninstall

Install as a System Service (from an already-built binary)

# Windows (run as Administrator):
ash-server.exe install-service

# Linux / macOS (run as root):
sudo ash-server install-service

Registers with the native service manager: Windows SCM, systemd, or launchd.


Security Architecture

External Message (Discord / Slack / Telegram)
        β”‚
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  ExternalRateLimiter        β”‚  sliding window per user
  β”‚  (5 req / 10s default)      β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ pass
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  PromptGuard                β”‚  7 injection patterns
  β”‚  (instruction override,     β”‚  jailbreak, persona hijack,
  β”‚   base64, delimiters…)      β”‚  delimiter injection, etc.
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ clean
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  IdentityResolver           β”‚  Discord/Slack/Telegram user
  β”‚                             β”‚  β†’ linked ash-server account
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ resolve
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  RBAC Permission Check      β”‚  role-based: can_chat,
  β”‚                             β”‚  can_use_agent, can_use_tools
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚ authorized
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  ChatHandler / AgentRunner  β”‚  streams from gemma4-turbo
  β”‚                             β”‚  via Ollama backend
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
               β”‚
        β–Ό
  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚  Audit Log                  β”‚  every action recorded
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Features

Chat & Agent

  • Streaming chat β€” WebSocket token-by-token, just like ChatGPT
  • Agent mode β€” tool-calling loop (web search, URL fetch, calculator, file ops)
  • Multimodal β€” image input via gemma4-turbo vision encoder
  • Conversation export β€” download as JSON, Markdown, or plain text
  • Full-text search β€” search across all conversations (SQLite FTS5)
  • Personality system β€” soul.json + per-user context files

Security & Trust

  • JWT authentication β€” RS256-compatible, configurable secret
  • RBAC roles & permissions β€” DB-backed, fully managed via admin UI
  • Prompt injection guard β€” 7 regex patterns, block or log mode
  • Rate limiting β€” per-user sliding window (external) + fixed window (HTTP API)
  • External identity linking β€” Discord/Slack/Telegram users link to accounts
  • Audit log β€” every external chat action recorded with provider, channel, user
  • Masked credential storage β€” tokens shown as β€’β€’β€’β€’ + last 4 chars

Integrations

  • Discord bot β€” full gateway bot with /link command, thread support
  • Slack bot β€” Socket Mode, rate-limited, permission-gated
  • Telegram bot β€” polling-based, per-chat conversation state
  • All integrations: PromptGuard + ExternalRateLimiter enforced on every message

Admin Panel (/admin.html)

  • User management + role assignment
  • AI backend CRUD (Ollama, OpenAI-compatible)
  • MCP App Store β€” browse, configure required variables, and install servers with a single click
  • Update Center β€” view current vs latest version, inspect release notes, and hot-swap binary updates
  • Third-Party Chat credentials management
  • Channel configs + allowUnlinked policy
  • External identity link management
  • Audit log viewer
  • Analytics dashboard (messages/day, active users)

Deployment & Lifecycle

  • Cross-platform service installer: Windows Service, systemd, launchd
  • Native Self-Updating System: Hot-swaps running locked binary executables and web assets seamlessly on all platforms (SCM, Systemd, Launchd)
  • Single binary β€” dotnet publish produces self-contained executable
  • SQLite β€” zero external DB dependencies
  • config.json overlay β€” override settings without touching the repo

P2P AI Compute Grid & VPN Binding (v1.2)

Ash Server version 1.2 introduces two powerful network-level capabilities to support decentralized, private, and distributed local AI architectures:

1. P2P AI Compute Grid

Ash Server features a built-in hub-and-spoke peer compute sharing system. Multiple instances of Ash Server can cluster together to distribute LLM inference work across different physical machines:

  • Master Node (Orchestrator): Receives client requests, maintains connection pools, and routes tasks based on the capabilities, CPU/GPU, and memory parameters of connected workers.
  • Worker Node: Connects to the Master via secure WebSockets to process local inference queries.
    • To start in Worker Mode:
      ash-server --worker --master http://<master-ip>:18799 --token <pairing-token>
    • Auto-Pairing & Reconnection: Dynamically authenticates with a one-time pairing token, stores a secure generated worker identity, and automatically reconnects with exponential backoff if the link drops.

2. Generalized VPN & Adapter Binding

Rather than binding to all public interfaces (0.0.0.0) or being hardcoded to a single VPN, Ash Server features generic network interface auto-discovery and binding:

  • Zero-Trust Mesh & Tunnel Support: Natively scans and detects secure VPNs like NetBird, Tailscale, Proton VPN, WireGuard, OpenVPN, and custom adapters, resolving their statuses and IPs.
  • UI-Driven Interface Pinning: Exposes active interfaces in the Admin Panel network tab. Administrators can select an interface (e.g. "NetBird", "Tailscale Tunnel", or "ProtonVPN") to save BindInterface to config.
  • Resilient Startup: Dynamically binds Kestrel to the chosen network IP. If the VPN interface drops or is disabled, the server automatically binds to localhost (127.0.0.1) for local-only safety rather than failing to boot.

One-Click MCP App Store & Update System

Ash Server introduces a state-of-the-art administrative experience with two native subsystems built into the core:

1. One-Click MCP App Store

Instead of manually typing NPM packages, arguments, and environment keys to configure tools, Ash Server features a fully integrated App Store:

  • Git-based Registry: Automatically pulls available packages from the community-driven, public repository at ssfdre38/mcp-registry.
  • Dynamic Variable Substitution: Renders customized input forms for required keys (like GitHub personal tokens or folder paths), formats them into command-line arguments and environment variables, writes them to SQLite, and dynamically boots the server instantly in the background.
  • Pre-built High-Fidelity Apps: Includes out-of-the-box configurations for Filesystem, Google Search, GitHub Integration, PostgreSQL, Puppeteer Browser, and SQLite Database Manager.
  • Universal Tool Calling: Leverages our fully integrated OpenAI tool-calling adapter to enable multi-step agents and MCP tool execution for OpenAI, Groq, Mistral, Together AI, OpenRouter, and local OpenAI endpoints (LM Studio, Jan, LocalAI).

2. Native Self-Updating System

Keeping a self-hosted AI orchestrator updated is traditionally complex, especially under different system service contexts:

  • Dynamic File Swapping: Renames locked executing binary files first (which filesystems permit) and writes the new build in place, recursively replacing web assets in wwwroot while fully preserving configurations and databases.
  • Deferred Service Restarts: Automatically detects your platform service manager (Windows SCM, systemd, or launchd) and schedules a delayed daemon shell script to stop, restart the service, and terminate the previous process.
  • Sleek Update Center Dashboard: An administrative center showing current vs latest tags, raw markdown release notes, and real-time installation log polling that automatically reconnects the browser session once the server is back online.

Configuration

appsettings.json (or create config.json beside the exe to override):

{
  "Port": 18799,
  "DatabasePath": "ash_server.db",
  "PersonalityDir": "personality",
  "Jwt": {
    "Secret": "change-me-32-chars-minimum-in-production"
  },
  "RateLimit": {
    "External": { "MaxRequests": 5, "WindowSeconds": 10 },
    "Http":     { "PermitLimit": 60, "WindowSeconds": 60 }
  },
  "PromptGuard": {
    "BlockOnDetect": true,
    "MaxMessageLength": 8000
  },
  "ThirdPartyChat": {
    "BotLinkSecret": "your-bot-secret",
    "Discord":  { "Enabled": false, "BotToken": "", "ApplicationId": "" },
    "Slack":    { "Enabled": false, "BotToken": "", "AppToken": "" },
    "Telegram": { "Enabled": false, "BotToken": "" }
  }
}

⚠️ Always change Jwt:Secret before exposing to the network.


Project Structure

ash-server/
β”œβ”€β”€ AI/              # Backend manager, Ollama + OpenAI-compat clients
β”œβ”€β”€ Agent/           # Tool definitions + agent runner loop
β”œβ”€β”€ Auth/            # JWT + BCrypt + permission evaluation
β”œβ”€β”€ Chat/
β”‚   β”œβ”€β”€ Discord/     # Discord.Net gateway bot + message router
β”‚   β”œβ”€β”€ Slack/       # Slack Events API bot (HMAC verified)
β”‚   β”œβ”€β”€ Telegram/    # Telegram polling bot
β”‚   β”œβ”€β”€ ChatHandler.cs      # Core WebSocket/streaming handler
β”‚   β”œβ”€β”€ IdentityResolver.cs # Provider β†’ RBAC resolution
β”‚   └── PromptGuard.cs      # Injection detection
β”œβ”€β”€ Controllers/     # REST API (auth, conversations, admin, MCP, bots)
β”œβ”€β”€ Data/            # SQLite + FTS5 database layer
β”œβ”€β”€ Middleware/      # ExternalRateLimiter
β”œβ”€β”€ Models/          # Records + DTOs
β”œβ”€β”€ Personality/     # soul.json loader + default personality/
β”œβ”€β”€ Plugins/         # Plugin manifest + manager
β”œβ”€β”€ Service/         # Cross-platform service installer
β”œβ”€β”€ build/
β”‚   β”œβ”€β”€ publish-all.ps1     # Build all 5 platform targets
β”‚   β”œβ”€β”€ publish-all.sh
β”‚   β”œβ”€β”€ windows/
β”‚   β”‚   └── installer.nsi   # NSIS Windows installer script
β”‚   β”œβ”€β”€ linux/
β”‚   β”‚   └── install.sh      # Linux systemd installer
β”‚   └── macos/
β”‚       └── install.sh      # macOS launchd installer
β”œβ”€β”€ .github/workflows/
β”‚   └── release.yml         # CI: build all targets + GitHub Release on tag push
β”œβ”€β”€ wwwroot/
β”‚   β”œβ”€β”€ index.html   # Chat UI (vanilla JS SPA)
β”‚   └── admin.html   # Admin panel
β”œβ”€β”€ install.sh       # One-liner: git clone + build + install (Linux/macOS)
β”œβ”€β”€ install.ps1      # One-liner: git clone + build + install (Windows)
β”œβ”€β”€ Program.cs       # Entry point, DI, service hosting
└── appsettings.json

The Ash Ecosystem

Project Description
ash-server This β€” secure AI backend
gemma4-turbo IQ4_XS Gemma 4 for Ollama β€” 17.3k+ downloads
ash-bot .NET 10 Discord bot β€” Ash's personality, 20 built-in tools, long-term memory
Discord Join us on the G4Turbo.com Discord server.

License

MIT β€” see LICENSE.

Model weights: Gemma Terms of Use.

About

🦞 Modern self-hosted AI chat server with streaming, multi-user support, and admin panel. Built for Ollama.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages