๐ Civitai MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to fully access Civitai's extensive collection of AI models, creators, and generated content. Effortlessly browse, search, and discover AI models via your preferred MCP-compatible AI assistant.

๐ Quick Start
The Civitai MCP Server is a powerful tool that allows AI assistants to access a wide range of AI models, creators, and generated content on Civitai. Here's how you can get started quickly.
โจ 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.
๐ฆ Installation
Prerequisites
- Node.js 18+
- npm or yarn
- A Civitai API key (optional, but recommended for higher rate limits)
Quick Start
- Clone the repository:
git clone https://github.com/Cicatriiz/civitai-mcp-server.git
cd civitai-mcp-server
- Install dependencies:
npm install
- Build the server:
npm run build
- Set up your API key (optional):
export CIVITAI_API_KEY="your_api_key_here"
- Run the server:
npm start
Getting a Civitai API Key
- Visit Civitai API Keys.
- Log in to your Civitai account.
- Generate a new API key.
- Copy the key and set it as an environment variable.
๐ป Usage Examples
Basic Model Search
Search for SDXL LoRA models related to anime:
- Tool: search_models
- Query: "anime"
- Types: ["LORA"]
- BaseModels: ["SDXL 1.0"]
Find Popular Models
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"
๐ Documentation
Available Tools
| Property |
Details |
search_models |
Search models with filters. Key Parameters: query, types, sort, baseModels |
get_model |
Get detailed model info. Key Parameters: modelId |
get_model_version |
Get version details. Key Parameters: modelVersionId |
get_model_version_by_hash |
Find model by file hash. Key Parameters: hash |
browse_images |
Browse generated images. Key Parameters: sort, period, modelId |
get_creators |
Search creators. Key Parameters: query, limit |
get_tags |
Browse model tags. Key Parameters: query, limit |
get_popular_models |
Most popular models. Key Parameters: period, limit |
get_latest_models |
Newest models. Key Parameters: limit |
get_top_rated_models |
Highest rated models. Key Parameters: period, limit |
search_models_by_tag |
Models with specific tag. Key Parameters: tag, sort |
search_models_by_creator |
Models by creator. Key Parameters: username, sort |
get_models_by_type |
Filter by model type. Key Parameters: type, sort |
get_download_url |
Get model download URL. Key Parameters: 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
๐ง Technical Details
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
npm install
npm run build
npm test
npm run dev
Testing
npm test
node test.js
node comprehensive-test.js
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
- Fork the repository.
- Create a feature branch.
- Make your changes.
- Add tests for new functionality.
- 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
๐ Related Projects
๐ Support