Skip to main content
Glama
Civitai MCP Server

Civitai MCP Server

by Cicatriiz

Civitai MCP Server

A Model Context Protocol (MCP) server that provides AI assistants with comprehensive access to Civitai's vast collection of AI models, creators, and generated content. Browse, search, and discover AI models seamlessly through your favorite MCP-compatible AI assistant.

License: MIT Node.js Version TypeScript

Features

šŸ” Model Discovery

  • Advanced Search: Find AI models with flexible filtering by type, creator, tags, and more

  • Browse Categories: Explore models by type (Checkpoints, LoRA, ControlNet, etc.)

  • Popular & Trending: Discover the most downloaded and highest-rated models

  • Latest Models: Stay up-to-date with newly uploaded models

  • Hash Lookup: Find models by file hash for verification

šŸ‘Øā€šŸ’» Creator & Community

  • Creator Profiles: Browse and search for model creators

  • Creator Collections: View all models from specific creators

  • Tag System: Explore models through Civitai's comprehensive tagging system

šŸ–¼ļø Generated Content

  • Image Gallery: Browse AI-generated images with detailed metadata

  • Generation Parameters: Access prompt, settings, and model information

  • Community Showcase: Discover inspiring creations from the community

šŸ“Š Model Intelligence

  • Detailed Model Info: Complete model specifications, versions, and files

  • Version History: Track model updates and improvements

  • Download URLs: Direct access to model downloads with authentication support

  • Content Safety: Access scan results for pickle and virus safety

Related MCP server: civitai-mcp-ultimate

Installation

Prerequisites

  • Node.js 18+

  • npm or yarn

  • A Civitai API key (optional, but recommended for higher rate limits)

Quick Start

  1. Clone the repository:

git clone https://github.com/Cicatriiz/civitai-mcp-server.git
cd civitai-mcp-server
  1. Install dependencies:

npm install
  1. Build the server:

npm run build
  1. Set up your API key (optional):

export CIVITAI_API_KEY="your_api_key_here"
  1. Run the server:

npm start

Getting a Civitai API Key

  1. Visit Civitai API Keys

  2. Log in to your Civitai account

  3. Generate a new API key

  4. Copy the key and set it as an environment variable

Configuration

MCP Client Setup

Add the server to your MCP client configuration:

Claude Desktop

Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "civitai": {
      "command": "node",
      "args": ["/path/to/civitai-mcp-server/dist/index.js"],
      "env": {
        "CIVITAI_API_KEY": "your_api_key_here"
      }
    }
  }
}

Other MCP Clients

Configure according to your client's documentation, using:

  • Command: node /path/to/civitai-mcp-server/dist/index.js

  • Transport: stdio

  • Environment: CIVITAI_API_KEY=your_key

Usage Examples

Search for SDXL LoRA models related to anime:
- Tool: search_models
- Query: "anime"
- Types: ["LORA"]
- BaseModels: ["SDXL 1.0"]
Get the most downloaded models this week:
- Tool: get_popular_models
- Period: "Week"
- Limit: 10

Model Details

Get comprehensive information about a specific model:
- Tool: get_model
- ModelId: 12345

Browse Generated Images

Explore recent AI-generated images:
- Tool: browse_images
- Sort: "Newest"
- Limit: 50
- NSFW: "None"

Available Tools

Tool

Description

Key Parameters

search_models

Search models with filters

query, types, sort, baseModels

get_model

Get detailed model info

modelId

get_model_version

Get version details

modelVersionId

get_model_version_by_hash

Find model by file hash

hash

browse_images

Browse generated images

sort, period, modelId

get_creators

Search creators

query, limit

get_tags

Browse model tags

query, limit

get_popular_models

Most popular models

period, limit

get_latest_models

Newest models

limit

get_top_rated_models

Highest rated models

period, limit

search_models_by_tag

Models with specific tag

tag, sort

search_models_by_creator

Models by creator

username, sort

get_models_by_type

Filter by model type

type, sort

get_download_url

Get model download URL

modelVersionId

API Reference

Model Types

  • Checkpoint - Full Stable Diffusion models

  • LORA - Low-Rank Adaptation models

  • TextualInversion - Embedding models

  • Hypernetwork - Hypernetwork models

  • ControlNet - ControlNet models

  • AestheticGradient - Aesthetic gradient models

  • Poses - Pose models

Sort Options

  • Highest Rated - Best community ratings

  • Most Downloaded - Most popular downloads

  • Newest - Recently uploaded

Time Periods

  • AllTime - No time restriction

  • Year - Past 12 months

  • Month - Past 30 days

  • Week - Past 7 days

  • Day - Past 24 hours

API Coverage

This MCP server implements all major Civitai API v1 endpoints:

  • āœ… /api/v1/models - List and search models

  • āœ… /api/v1/models/:id - Get specific model

  • āœ… /api/v1/model-versions/:id - Get model version

  • āœ… /api/v1/model-versions/by-hash/:hash - Get version by hash

  • āœ… /api/v1/images - Browse images

  • āœ… /api/v1/creators - List creators

  • āœ… /api/v1/tags - List tags

  • āœ… Download URLs with authentication support

Model Types Supported

  • Checkpoint: Full Stable Diffusion models

  • LORA: Low-Rank Adaptation models

  • TextualInversion: Textual inversion embeddings

  • Hypernetwork: Hypernetwork models

  • AestheticGradient: Aesthetic gradient models

  • Controlnet: ControlNet models

  • Poses: Pose models

Content Filtering

The server supports Civitai's content filtering system:

  • NSFW content levels (None, Soft, Mature, X)

  • Commercial use permissions

  • Model licensing options

Error Handling

The server includes comprehensive error handling for:

  • API rate limiting

  • Network connectivity issues

  • Invalid parameters

  • Authentication errors

  • Data validation

Development

Project Structure

civitai-mcp-server/
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ index.ts          # Main server implementation
│   ā”œā”€ā”€ civitai-client.ts # Civitai API client
│   └── types.ts          # TypeScript type definitions
ā”œā”€ā”€ dist/                 # Compiled JavaScript output
ā”œā”€ā”€ tests/                # Test files
└── docs/                 # Additional documentation

Building from Source

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run tests
npm test

# Development mode with hot reload
npm run dev

Testing

# Run comprehensive test suite
npm test

# Test specific endpoints
node test.js
node comprehensive-test.js

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

  1. Fork the repository

  2. Create a feature branch

  3. Make your changes

  4. Add tests for new functionality

  5. Submit a pull request

Limitations

  • Rate Limiting: Civitai API has rate limits. Use an API key for higher limits.

  • NSFW Content: Some content may be filtered based on your account settings.

  • Model Availability: Some models may be temporarily unavailable or require authentication.

Troubleshooting

Common Issues

Server won't start:

  • Ensure Node.js 18+ is installed

  • Check that all dependencies are installed (npm install)

  • Verify the build completed successfully (npm run build)

API rate limiting:

  • Get a Civitai API key and set the CIVITAI_API_KEY environment variable

  • Reduce request frequency if experiencing limits

Models not found:

  • Check model ID accuracy

  • Verify the model hasn't been removed or made private

  • Ensure proper spelling in search queries

License

MIT License - see LICENSE file for details

Support

Available Tools

14 tools
browse_imagesC

Browse AI-generated images from Civitai

Inputs: limit, modelId, modelVersionId, nsfw, +5 more.

get_creatorsC

Browse and search for model creators on Civitai

Inputs: limit, page, query.

get_download_urlC

Get the download URL for a specific model version

Inputs: modelVersionId (required).

get_latest_modelsC

Get the newest models uploaded to Civitai

Inputs: limit.

get_modelC

Get detailed information about a specific model by ID

Inputs: modelId (required).

get_models_by_typeC

Get models filtered by type (Checkpoint, LORA, etc.)

Inputs: type (required), limit, sort.

get_model_versionC

Get detailed information about a specific model version

Inputs: modelVersionId (required).

get_model_version_by_hashC

Get model version information by file hash

Inputs: hash (required).

get_tagsC

Browse and search for model tags on Civitai

Inputs: limit, page, query.

get_top_rated_modelsC

Get the highest rated models

Inputs: limit, period.

search_modelsC

Search for AI models on Civitai with various filters

Inputs: baseModels, limit, nsfw, page, +4 more.

search_models_by_creatorC

Search for models by a specific creator

Inputs: username (required), limit, sort.

search_models_by_tagC

Search for models by a specific tag

Inputs: tag (required), limit, sort.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools have distinct purposes focused on different aspects of the Civitai platform (browsing images, getting creators, downloading models, searching with various filters). However, there is some overlap between search_models, search_models_by_creator, and search_models_by_tag that could potentially cause confusion about which to use for specific search scenarios.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with clear, descriptive names. The naming convention is uniform throughout (get_, browse_, search_) with no mixing of styles or conventions.

    Tool Count5/5

    14 tools is well-scoped for a Civitai server covering models, creators, tags, and images. Each tool appears to serve a specific purpose within the domain without obvious redundancy or bloat.

    Completeness4/5

    The toolset provides comprehensive coverage for browsing, searching, and retrieving information about models, creators, tags, and images. Minor gaps might include operations like creating or updating content (if the API supports it), but for a read-only browsing interface, the coverage is quite complete.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables interaction with the Civitai API to search for AI models, browse images, and access creator information. It provides tools for filtering models by popularity, rating, or type and retrieving detailed version metadata.
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      A comprehensive MCP server for interacting with the Civitai API to search models, browse images with generation prompts, and manage downloads. It features extensive support for various base models like SDXL and Flux, includes NSFW filtering, and provides automated download commands for ComfyUI.
      21
      32 PyPI
      26
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to fully interact with the Civitai platform, including browsing models, images, and creators; posting, reacting, reviewing, following, collecting, writing articles and comments; sending DMs; and managing bounties and announcements.
      2
      Apache 2.0