ModsJava
localserverassistantai
With local AI, you can ask questions and have conversations within the server and in Discord chat.
⬇ Download on HangarOpen in MCModsHubGet it on Google Play →# LocalServerAssistantAI
A **local AI-powered Markdown reference-type server guide + free chat + Discord integration** plugin for Paper 26.2+ Minecraft servers.
Uses Ollama or OpenAI-compatible local APIs to perform RAG search on `.md` files placed in `plugins/LocalServerAssistantAI/Documents/`.
This project was inspired by the desire to replicate the functionality of the paid cloud AI plugin [ServerAssistantAI](https://www.spigotmc.org/resources/serverassistantai-advanced-ai-powered-support-free-and-paid-llms-1-16-1-21-11.116241/) using local AI.
This project was created using AI and is inspired by [Tribie's project on X](https://x.com/tribiee_0425/status/2078741478193729671).
## Features
- **RAG Search**: Splits Markdown documents into sections by heading, indexes them, and passes only relevant parts to the AI
- **Hybrid Japanese n-gram + Embedding Search**: Combines lexical and semantic search for high-precision document retrieval
- **Server Query Mode** (`/sai ask` / `/sai mode docs`): Generates answers based only on reference documents
- **Free Chat Mode** (`/sai chat` / `/sai mode chat`): Conversational AI with maintained history
- **Chat Hijack Mode**: Enable with `/sai mode` to redirect all chat input to the AI
- **Discord Integration**: Configure separate channels for questions and free chat
- **Ollama / OpenAI-Compatible Local API** support (LM Studio / LocalAI / llama.cpp server)
- **Rate Limiting, Concurrency Control, History Clearing**: Server load and spam protection
- **Fully Asynchronous**: Does not block Paper's main thread while waiting for AI responses
## Requirements
- **Paper 26.2+** (Minecraft 1.21.4)
- **Java 25+**
- **Local AI Server** (Recommended: Ollama)
- **Discord Bot** (only if using Discord integration)
## Build
```bat
build.bat
```
```bash
./build.sh
```
On first run, Gradle 9.6.1 and Java 25 toolchain will be downloaded automatically.
Output: `build/libs/LocalServerAssistantAI-1.0.1.jar`
## Ollama Setup
### Install Ollama
**Windows:**
Download the installer from [ollama.com](https://ollama.com) and run it.
**Linux:**
```bash
curl -fsSL https://ollama.com/install.sh | sh
```
**macOS:**
Download the macOS app from [ollama.com](https://ollama.com) or use Homebrew:
```bash
brew install ollama
```
### Pull Models
```bash
ollama pull qwen3:8b
ollama pull embeddinggemma
```
## Configuration
Edit `plugins/LocalServerAssistantAI/config.yml`.
```yaml
ai:
provider: ollama
ollama:
base-url: "http://127.0.0.1:11434"
chat-model: "qwen3:8b"
embedding-model: "embeddinggemma"
```
Environment variables can also be used:
- `LOCAL_SERVER_ASSISTANT_AI_API_KEY` - API key for OpenAI-compatible APIs (was `LOCAL_SERVER_ASSISTANT_CLONE_API_KEY` before v1.0.1)
- `LOCAL_SERVER_ASSISTANT_AI_DISCORD_TOKEN` - Discord Bot token (was `LOCAL_SERVER_ASSISTANT_CLONE_DISCORD_TOKEN` before v1.0.1)
## Usage (Minecraft)
| Command | Description |
|---|---|
| `/sai ask ` | Search documents and answer |
| `/sai chat ` | Free chat with AI |
| `/sai mode docs` | Switch chat input to query mode |
| `/sai mode chat` | Switch chat input to conversation mode |
| `/sai mode off` or `/sai off` | End mode |
| `/sai clear` | Clear history |
| `/sai status` | Show status |
| `/sai reindex` | Reindex documents (admin) |
| `/sai reload` | Reload config + reindex (admin) |
## Permissions
> **Note:** From v1.0.1, the `.clone.` part has been removed from permission node names.
| Permission | Default |
|---|---|
| `localserverassistantai.use` | Everyone |
| `localserverassistantai.ask` | Everyone |
| `localserverassistantai.chat` | Everyone |
| `localserverassistantai.admin` | OP |
## Discord Integration
Configure the `discord` section in `config.yml`.
```yaml
discord:
enabled: true
token: "BOT_TOKEN"
guild-id: "DISCORD_SERVER_ID"
ask-channel-ids: ["CHANNEL_ID"]
chat-channel-ids: ["CHANNEL_ID"]
command-prefix: "!ai"
answer-all-messages-in-configured-channels: true
```
In ask channels, use `!ai ask `. In chat channels, use `!ai chat `.
## Example Documents Structure
```
Documents/
├── rules.md
├── commands.md
└── worlds/
└── resource-world.md
```
Run `/sai reindex` after making changes.
## License
MIT License
localserverassistantai is a free Minecraft Java mod. Compatible with Minecraft 26.2. Available via Hangar. Download it and open it directly in the game.
Explore more