Gelbooru MCP server

Gelbooru MCP server

gelbooru-mcp•bycitronlegacy

An MCP server that wraps the Gelbooru API to search posts and tags and generate Stable Diffusion character prompts from real appearance data.

License: MIT License•Runtime: Awaiting documentation review•Category: search web

WHAT IT DOES

  • •Generates Stable Diffusion prompt strings for a character from real Gelbooru tag frequency data, with an eye, hair, and clothing/accessory breakdown.
  • •Searches Gelbooru posts with full tag syntax including AND, OR, wildcard, exclusion, meta-tags, sorting, and pagination.
  • •Looks up tags to check existence, post counts, and related tags, and can find user accounts and post comments.

BEST FOR

  • •Building a character prompt for an image generator from within an AI assistant.
  • •Finding images by quality threshold and resolution via tag queries.
  • •Checking how many posts a specific tag has.

ABOUT GELBOORU-MCP

Gelbooru MCP server is cataloged as an MCP server attributed to citronlegacy. An MCP server that wraps the Gelbooru API to search posts and tags and generate Stable Diffusion character prompts from real appearance data. It is categorized under search web. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Gelbooru MCP server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Can the server work without Gelbooru API credentials?

Yes, credentials are optional; without them the server still works but requests may be throttled and limited to 2 tags per query.

Are character prompt results cached?

Yes, results from the character tools are cached for 24 hours by default.

Upstream README

View this exact version on GitHub

README.md · 06e898f23c6c · Fetched 2026-11-13 12:40:26 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

gelbooru-mcp

Python License: MIT MCP

Gelbooru MCP server rating

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

ToolDescriptionKey Parameters
build_promptGenerate a Stable Diffusion prompt string for a charactercharacter_name, max_images, include_other
get_character_tagsGet structured tag breakdown with frequency countscharacter_name, max_images
search_postsSearch posts with full tag syntax supporttags, limit, pid, id
search_tagsLook up tags by name, pattern, or IDname, name_pattern, orderby, limit
search_usersFind Gelbooru user accountsname, name_pattern, limit
get_commentsRetrieve comments for a postpost_id
get_deleted_postsList recently deleted postslast_id, limit

📖 Tools Reference

build_prompt

Fetches the most-tagged rating:general solo posts for a character and assembles a ready-to-paste Stable Diffusion prompt string. Internally calls get_character_tags so results are cached after the first fetch.

Parameters

ParameterTypeRequiredDefaultDescription
character_namestring✅—Gelbooru character tag, e.g. misty_(pokemon)
max_imagesinteger❌300Posts to analyse. More = slower first fetch, more reliable tags. Cached afterward.
include_otherboolean❌trueInclude non-eye/hair tags (clothing, accessories, etc.). Set to false for appearance-only prompts.

Example response

{
  "prompt": {
    "character": "misty (pokemon)",
    "posts_analysed": 284,
    "cache_hit": false,
    "prompt_string": "misty (pokemon), green eyes, orange hair, side ponytail, gym leader, shorts, suspenders",
    "tags": {
      "eye":   ["green eyes"],
      "hair":  ["orange hair", "side ponytail"],
      "other": ["gym leader", "shorts", "suspenders"]
    }
  }
}

LLM Tip: Always use Gelbooru's underscore format (misty_(pokemon) not Misty (Pokemon)). If unsure of the exact tag, call search_tags with name_pattern first.


get_character_tags

Same data source as build_prompt but returns the full structured tag breakdown with frequency counts. Use this when you want to inspect, filter, or reformat tags yourself.

Parameters

ParameterTypeRequiredDefaultDescription
character_namestring✅—Gelbooru character tag, e.g. rem_(re:zero)
max_imagesinteger❌300Number of top-scored posts to analyse.

Example response

{
  "character_tags": {
    "name": "rem_(re:zero)",
    "posts_analysed": 300,
    "cache_hit": true,
    "eye": [
      { "tag": "blue eyes", "count": 261, "frequency": 0.87 }
    ],
    "hair": [
      { "tag": "blue hair",  "count": 274, "frequency": 0.913 },
      { "tag": "short hair", "count": 198, "frequency": 0.66  }
    ],
    "other": [
      { "tag": "maid", "count": 231, "frequency": 0.77 }
    ]
  }
}

frequency is the fraction of analysed posts that had that tag (0.0–1.0). Tags near 1.0 are near-universal; tags below 0.3 are situational.

Cache environment variables:

Env varDefaultDescription
GELBOORU_CACHE_DIR.gelbooru_cache/ next to scriptCustom cache folder path
GELBOORU_CACHE_TTL86400 (24 hours)Cache lifetime in seconds

search_posts

Search Gelbooru posts using any tag combination. Supports the full Gelbooru tag syntax including meta-tags, sorting, and filtering.

Parameters

ParameterTypeRequiredDefaultDescription
tagsstring❌—Tag query string (see Tag Syntax Reference below)
limitinteger❌20Posts to return (max 100)
pidinteger❌0Page number (0-indexed) for pagination
idinteger❌—Fetch a single post by its Gelbooru post ID
cidinteger❌—Fetch posts by change ID (Unix timestamp)

get_deleted_posts

Retrieve posts that have been deleted from Gelbooru, optionally filtered to those above a given post ID.

Parameters

ParameterTypeRequiredDefaultDescription
last_idinteger❌—Only return deleted posts whose ID is above this value. Useful for syncing a local mirror.
limitinteger❌20Posts to return (max 100)

search_tags

Look up Gelbooru tags by name, wildcard pattern, or ID. Useful for checking tag existence, finding post counts, discovering related tags, or autocomplete.

Parameters

ParameterTypeRequiredDefaultDescription
namestring❌—Exact tag name, e.g. blue_hair
namesstring❌—Space-separated list of exact tag names, e.g. cat_ears dog_ears fox_ears
name_patternstring❌—SQL LIKE wildcard: % = any chars, _ = one char. E.g. %schoolgirl%
idinteger❌—Look up a tag by its database ID
after_idinteger❌—Return tags with ID greater than this value
limitinteger❌20Tags to return (max 100)
orderstring❌—ASC or DESC
orderbystring❌—Sort field: date, count, or name

LLM Tip: If the user gives a character name in natural language (e.g. "Misty from Pokemon"), use name_pattern with %misty%_(pokemon)% to find the correct Gelbooru tag before calling get_character_tags or build_prompt.


search_users

Search for Gelbooru user accounts by name.

Parameters

ParameterTypeRequiredDefaultDescription
namestring❌—Exact username
name_patternstring❌—SQL LIKE wildcard username search
limitinteger❌20Results to return (max 100)
pidinteger❌0Page number for pagination

get_comments

Retrieve comments on a specific post.

Parameters

ParameterTypeRequiredDefaultDescription
post_idinteger✅—The Gelbooru post ID to fetch comments for

🏷️ Tag Syntax Reference

SyntaxMeaning
tag1 tag2Posts with both tag1 AND tag2
{tag1 ~ tag2 ~ tag3}Posts with tag1 OR tag2 OR tag3
-tag1Exclude posts with tag1
*tag1Wildcard prefix (tags ending with tag1)
tag1*Wildcard suffix (tags starting with tag1)
rating:generalFilter by rating: general, questionable, or explicit
-rating:explicitExclude a rating
score:>=50Score at least 50
width:>=1920Image width ≥ 1920px
height:>1080Image height > 1080px
user:bobUploaded by user "bob"
fav:1Posts favourited by user with ID 1
pool:2Posts in pool ID 2
sort:score:descSort by score (desc or asc)
sort:randomRandom order on every request
sort:random:1234Random order with a fixed seed (0–10000)
sort:updated:descSort by most recently updated

🤖 Notes for LLMs

  • Character tag format: Gelbooru uses character_(series) format with underscores. Always convert natural language names before passing to tools — "Rem from Re:Zero" → rem_(re:zero), "Saber from Fate" → saber_(fate).
  • Workflow for character prompts: If the exact tag is unknown, call search_tags with name_pattern first → confirm the tag exists and has posts → then call build_prompt.
  • Pagination: search_posts returns max 100 results per call. Use pid to walk through pages. get_character_tags and build_prompt handle their own pagination internally.
  • Cache: get_character_tags and build_prompt cache results for 24 hours. The cache_hit field in the response indicates whether live or cached data was used.
  • Ratings: Gelbooru uses general, questionable, and explicit. get_character_tags and build_prompt always filter to rating:general for cleaner, more representative character data.

⚠️ Known Limitations

  • Tag search limit: Gelbooru enforces a maximum of 2 tags per unauthenticated search query. For complex multi-tag queries, set GELBOORU_API_KEY and GELBOORU_USER_ID.
  • get_character_tags accuracy: Results depend on how consistently a character is tagged on Gelbooru. Niche or recently added characters may have fewer posts and less reliable frequency data.
  • rating:general only for character tools: build_prompt and get_character_tags intentionally restrict to rating:general for clean, representative appearance data. Explicit posts are excluded by design.
  • Cache is per (character_name, max_images) pair: Changing max_images busts the cache for that character.

🐛 Troubleshooting

Server won't start:

  • Ensure Python 3.10+ is installed: python --version
  • Verify the virtual environment was created: ls .venv/
  • Re-run the installer: bash install.sh

API rate limiting / throttled requests:

  • Set GELBOORU_API_KEY and GELBOORU_USER_ID environment variables
  • Gelbooru Patreon supporters receive unlimited requests

Character not found / empty results:

  • Confirm the tag exists with search_tags using name_pattern
  • Check spelling — Gelbooru uses character_(series) underscore format
  • Some characters may have very few consistently tagged posts

Tag syntax errors / too many tags:

  • Unauthenticated users are limited to 2 tags per query
  • Authenticate with API credentials for complex multi-tag searches

🤝 Contributing

Pull requests are welcome! If you find a character tag being miscategorised (e.g. a hair style tag missing from the hair bucket, or a noise tag slipping through the purge filter), please open an issue or PR with the tag and which list it belongs in.

Development Setup

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

📄 License

MIT License — see LICENSE for details.


Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Gelbooru MCP server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/gelbooru-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related search web MCP Servers

Alternative and complementary servers in the same category

View all in search web →

An MCP server that merges Google Search Console history with a live first-party crawl of your site to produce a prioritised, evidence-backed technical SEO audit inside Claude, complete with paste-ready fixes.

Repository stats unavailable
Search & Web Research

An MCP server that offers intelligent web search using OpenAI reasoning models, with support for fast iterations and deep research.

94
Search & Web Research