Intro
SDXL and other anime / anime blend models are trained on Danbooru tags, so using the right tags in your prompts matters. I’ve long tried to get LLMs to write XL/IL prompts using danboruu tags for me, but since the tags need to be precise, this has not worked well at all. You can’t just infer tags, they need to be exact. So i contemplated making a database of this, but lo and behold, someone has made an open one now.
Examples are on Arch Linux
Using Danbooru Tag Search with LM Studio via MCP
danbooru-rag-mcp is an MCP server that does semantic search over ~60,000 Danbooru tags — you describe what you want in plain language and it returns the actual tags the model knows. It works with anything that supports MCP: Claude Code, Claude Desktop, LM Studio, etc.
Since this is a semantic database, it’s very efefctive at returning similar /releated keywords, not word matches, and the LLM you use can pick the ones it needs, or search further to find more.
Ran locally, together with a reasoning model that can do multiple passes, like huihui-qwen3.5-4b-claude-4.6-opus-abliterated this is perfect for me. I have however not found a good LLM node in comfyui that supports reasoning models from LMStudio API, i’d love suggestions.
A problem i ran into is the default install method times out on first run. So here’s how i set it up.
Why it times out
The README suggests using uvx --from git+https://... as the MCP command. This works eventually, but on first launch it has to:
- Clone the git repo
- Build the package
- Download multiple embedding models
- Build a LanceDB index over 60,000 tags
Steps 3 and 4 only happen once, but they take a few minutes. MCP clients like LM Studio and Claude Desktop have connection timeouts, so the server gets killed before it finishes setting up.
Local install
Clone the repo and install it into its own venv:
git clone https://github.com/Zaozaotvk40/danbooru-rag-mcp.git ~/danbooru-rag-mcp
cd ~/danbooru-rag-mcp
uv venv && uv pip install -e .
Now run it once manually so it can download the embedding model and build the index without a timeout killing it:
uv run danbooru-rag-mcp
You’ll see it download multilingual-e5-small and build the LanceDB index. Once it prints that the MCP server is ready, kill it with Ctrl+C. The index will then be cached at ~//danbooru-rag/lancedb — it won’t rebuild next time.
LM Studio config
In LM Studio, go to Settings > MCP Servers and add a new server. Point it at your local install:
{
"danbooru-rag": {
"command": "uv",
"args": ["run", "--directory", "/home/youruser/danbooru-rag-mcp", "danbooru-rag-mcp"]
}
}
Since the model and index are already cached, startup is near-instant. No more timeouts.
Using it
Once the MCP server is connected, your LLM gets a semantic_search tool. You can ask it things like:
- “Girl reading in a cafe with sunlight through the window”
- “What Danbooru tags describe a fantasy sunset landscape?”
- “Tags for twin-tailed blue-haired character casting magic”
It returns ranked Danbooru tags you can paste straight into your image gen workflow. It handles both English and Japanese queries since it uses a multilingual embedding model.
The short version
git clonethe repouv venv && uv pip install -e .uv run danbooru-rag-mcponce to cache the model and index- Point your MCP client at the local install with
uv run --directory
The first-run model download is the only thing that makes this tricky. Once that’s done it just works.
Use with a good syystem prompt, like
You’ll get results like this
Everything is a valid danboru tag and depending on your ImageGen Model will produce a decent result