Waifu Queue MCP server

Implements a conversational 'waifu' character server using Redis queue system for efficient handling of concurrent text generation requests with FastMCP and distilgpt2.
Back to servers
Setup instructions
Provider
WaifuAI
Release date
Mar 13, 2025
Language
Python
Stats
1 star

This is a Model Context Protocol (MCP) server for Google Gemini, providing an asynchronous queue system for AI text generation requests. It leverages Redis for job queuing and the FastMCP library to create a standardized API interface for your conversational AI applications.

Prerequisites

Before installing the MCP Waifu Queue server, you'll need:

  • Python 3.7+
  • Redis server (running)
  • Google Gemini API Key

You can obtain a Gemini API key from Google AI Studio and install Redis from the official Redis website.

Installation

Step 1: Clone the Repository

git clone <YOUR_REPOSITORY_URL>
cd mcp-waifu-queue

Step 2: Set Up Virtual Environment

Using venv:

python -m venv .venv
source .venv/bin/activate  # On Linux/macOS
# .venv\Scripts\activate  # On Windows CMD

Or using uv:

python -m uv venv .venv
source .venv/bin/activate

Step 3: Install Dependencies

pip install -e .[test]

Configuration

API Key Setup

Create a file with your Gemini API key:

echo "YOUR_API_KEY_HERE" > ~/.api-gemini

Environment Configuration

Copy the example environment file and adjust settings:

cp .env.example .env

Key configuration options in .env:

  • MAX_NEW_TOKENS: Maximum length of generated responses (default: 2048)
  • REDIS_URL: URL for your Redis server (default: redis://localhost:6379)

Running the Server

Step 1: Start Redis

Ensure your Redis server is running.

Step 2: Start the Worker

In one terminal with your virtual environment activated:

python -m mcp_waifu_queue.worker

Step 3: Start the MCP Server

In another terminal with your virtual environment activated:

uvicorn mcp_waifu_queue.main:app --reload --port 8000

Alternatively, on Linux/macOS you can use the provided script to start Redis and the worker:

chmod +x ./scripts/start-services.sh
./scripts/start-services.sh

Using the API

The MCP server provides the following API endpoints:

Text Generation Tool

To generate text using the Gemini API:

  1. Send a request to the generate_text tool:

    {
      "prompt": "Your text prompt here"
    }
    
  2. The server will return a job ID:

    {
      "job_id": "rq:job:..."
    }
    

Job Status Resource

Check the status of your generation job:

  1. Query the job://{job_id} resource using the job ID returned above
  2. Response format:
    {
      "status": "queued|started|finished|failed",
      "result": "Generated text appears here when complete"
    }
    

Troubleshooting

  • API Key Issues: Verify your API key is correctly saved in ~/.api-gemini or set as the GEMINI_API_KEY environment variable
  • Queue Not Processing: Ensure the worker process is running (python -m mcp_waifu_queue.worker)
  • Redis Connection Errors: Check that Redis is running and accessible at the URL specified in .env
  • API Errors: Review worker logs for detailed error messages from the Gemini API

Testing

Run the test suite with:

pytest tests

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "waifu-queue" '{"command":"uvicorn","args":["mcp_waifu_queue.main:app","--port","8000"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "waifu-queue": {
            "command": "uvicorn",
            "args": [
                "mcp_waifu_queue.main:app",
                "--port",
                "8000"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "waifu-queue": {
            "command": "uvicorn",
            "args": [
                "mcp_waifu_queue.main:app",
                "--port",
                "8000"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later