Gelbooru MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/citronlegacy/gelbooru-mcp.git
cd gelbooru-mcp
pip install mcp
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add gelbooru-mcp -- node "<FULL_PATH_TO_GELBOORU_MCP>/dist/index.js"

Replace <FULL_PATH_TO_GELBOORU_MCP>/dist/index.js with the actual folder you prepared in step 1.

README.md

Search posts, look up tags, and generate Stable Diffusion prompts from Gelbooru.

gelbooru-mcp

A Python MCP server that wraps the Gelbooru API. Connect it to any MCP-compatible client (Claude Desktop, Cursor, etc.) to search posts, look up tags, and generate Stable Diffusion prompts from real character appearance data — all directly from your AI assistant.


✨ Features

🎨 **Stable Diffusion Prompt Generation**

  • Character Prompts: Auto-generate accurate SD prompts from real Gelbooru tag frequency data
  • Appearance Breakdown: Separate eye, hair, and clothing/accessory tag categories
  • Smart Caching: Results cached for 24 hours — no repeated API hits

🔍 **Post & Tag Search**

  • Advanced Filtering: Search by tags, score, resolution, rating, uploader, pool, and more
  • Full Tag Syntax: AND, OR, wildcard, exclusion, meta-tags, sorting, and pagination
  • Tag Lookup: Check tag existence, post counts, and discover related tags

👥 **Community Tools**

  • User Search: Find Gelbooru user accounts by name or wildcard pattern
  • Comments: Retrieve post comments for any post ID
  • Deleted Posts: Track removed content above a given post ID

📦 Installation

Prerequisites

  • Python 3.10+
  • git

Quick Start

  1. Clone the repository:
git clone https://github.com/citronlegacy/gelbooru-mcp.git
cd gelbooru-mcp
  1. Run the installer:
chmod +x install.sh && ./install.sh
# or without chmod:
bash install.sh
  1. Or install manually:
pip install mcp

Note: Add .gelbooru_cache/ and .venv/ to your .gitignore to avoid committing cached data or your virtual environment.

Getting a Gelbooru API Key

  1. Visit your Gelbooru account options page
  2. Log in to your Gelbooru account
  3. Copy your API Key and User ID
  4. Set them as environment variables (see below)

🔑 Authentication

API credentials are optional but strongly recommended — unauthenticated requests are throttled and limited to 2 tags per query. Gelbooru Patreon supporters receive unlimited requests.

export GELBOORU_API_KEY="your_api_key"
export GELBOORU_USER_ID="your_user_id"

Both values are on your Gelbooru account options page. Without them the server still works but requests may be throttled. Patreon supporters of Gelbooru are not rate-limited.


▶️ Running the Server

python gelbooru_mcp.py
# or via the venv created by install.sh:
.venv/bin/python gelbooru_mcp.py

⚙️ Configuration

Claude Desktop

Add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "gelbooru-mcp": {
      "command": "/absolute/path/to/.venv/bin/python",
      "args": ["/absolute/path/to/gelbooru_mcp.py"],
      "env": {
        "GELBOORU_API_KEY": "your_api_key",
        "GELBOORU_USER_ID": "your_user_id"
      }
    }
  }
}

Other MCP Clients

Configure according to your client's documentation:

  • Command: /absolute/path/to/.venv/bin/python
  • Args: /absolute/path/to/gelbooru_mcp.py
  • Transport: stdio

💡 Usage Examples

Generate a Stable Diffusion prompt for a character

"Build me a Stable Diffusion prompt for Rem from Re:Zero."

The LLM calls build_prompt with character_name: "rem_(re:zero)" and gets back:

rem (re:zero), blue eyes, blue hair, short hair, maid, maid headdress, maid apron, ...

Find high-quality wallpaper images

"Show me the top-rated scenery images that are at least 1920px wide."

The LLM calls search_posts with tags: "scenery width:>=1920 sort:score:desc".


Look up how popular a tag is

"How many posts does the tag 'misty_(pokemon)' have on Gelbooru?"

The LLM calls search_tags with name: "misty_(pokemon)" and reads the count field.


🛠️ Available Tools

Tool Description Key Parameters
build_prompt Generate a Stable Diffusion prompt string for a character character_name, max_images, include_other
get_character_tags Get structured tag breakdown with frequency counts character_name, max_images
search_posts Search posts with full tag syntax support tags, limit, pid, id
search_tags Look up tags by name, pattern, or ID name, name_pattern, orderby, limit

Tools (4)

build_promptGenerate a Stable Diffusion prompt string for a character
get_character_tagsGet structured tag breakdown with frequency counts
search_postsSearch posts with full tag syntax support
search_tagsLook up tags by name, pattern, or ID

Environment Variables

GELBOORU_API_KEYAPI key from Gelbooru account options page
GELBOORU_USER_IDUser ID from Gelbooru account options page

Configuration

claude_desktop_config.json
{"mcpServers": {"gelbooru-mcp": {"command": "/absolute/path/to/.venv/bin/python", "args": ["/absolute/path/to/gelbooru_mcp.py"], "env": {"GELBOORU_API_KEY": "your_api_key", "GELBOORU_USER_ID": "your_user_id"}}}}

Try it

Build me a Stable Diffusion prompt for Rem from Re:Zero.
Show me the top-rated scenery images that are at least 1920px wide.
How many posts does the tag 'misty_(pokemon)' have on Gelbooru?
Get a tag breakdown for the character 'asuka_langley_soryu'.

Frequently Asked Questions

What are the key features of Gelbooru MCP?

Auto-generate accurate Stable Diffusion prompts from real tag frequency data. Advanced post filtering by tags, score, resolution, rating, and more. Structured tag lookup including existence checks and post counts. Smart caching of API results for 24 hours to minimize requests.

What can I use Gelbooru MCP for?

Generating optimized Stable Diffusion prompts for specific anime characters. Researching tag popularity and frequency for image tagging workflows. Finding high-quality, high-resolution wallpapers based on specific criteria. Retrieving metadata and comments for specific Gelbooru posts.

How do I install Gelbooru MCP?

Install Gelbooru MCP by running: git clone https://github.com/citronlegacy/gelbooru-mcp.git && cd gelbooru-mcp && pip install mcp

What MCP clients work with Gelbooru MCP?

Gelbooru MCP works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Gelbooru MCP docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare