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.
Before installing the MCP Waifu Queue server, you'll need:
You can obtain a Gemini API key from Google AI Studio and install Redis from the official Redis website.
git clone <YOUR_REPOSITORY_URL>
cd mcp-waifu-queue
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
pip install -e .[test]
Create a file with your Gemini API key:
echo "YOUR_API_KEY_HERE" > ~/.api-gemini
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)Ensure your Redis server is running.
In one terminal with your virtual environment activated:
python -m mcp_waifu_queue.worker
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
The MCP server provides the following API endpoints:
To generate text using the Gemini API:
Send a request to the generate_text
tool:
{
"prompt": "Your text prompt here"
}
The server will return a job ID:
{
"job_id": "rq:job:..."
}
Check the status of your generation job:
job://{job_id}
resource using the job ID returned above{
"status": "queued|started|finished|failed",
"result": "Generated text appears here when complete"
}
~/.api-gemini
or set as the GEMINI_API_KEY
environment variablepython -m mcp_waifu_queue.worker
).env
Run the test suite with:
pytest tests
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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