home / mcp / riddles by api ninjas mcp server

Riddles By Api Ninjas MCP Server

MCP server to access Riddles By Api Ninjas API and fetch random riddles.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "bach-ai-tools-bachai-riddles-by-api-ninjas": {
      "command": "python",
      "args": [
        "server.py"
      ],
      "env": {
        "API_KEY": "your_api_key_here"
      }
    }
  }
}

You can connect to the Riddles By Api Ninjas API through this MCP server, enabling you to fetch random riddles from your applications with a simple, unified interface. This setup uses a local, stdio-based MCP server that you run on your machine or in your environment, and it requires an API key for authentication.

How to use

You will run the MCP server locally and connect to it from your MCP client. The server exposes an API surface for retrieving riddles from the Riddles By Api Ninjas service. To use it, you start the MCP server with the appropriate runtime command and provide your API key as an environment variable. Once the MCP server is running, you can select the riddles tool from your MCP client and request random riddles as needed.

How to install

Prerequisites you need before installation:
- Python is installed on your system (for pip-based installation).
- A working shell or terminal.
- An API key for the Riddles By Api Ninjas API.
# Install the MCP server package from PyPI
pip install bach-riddles_by_api_ninjas

# Optional: install in editable/development mode if you are developing
# pip install -e .

Manual run options

You have several options to run the MCP server after installation. Choose the one that best fits your workflow.

# Option 1: Run with uvx (recommended, auto-installs if needed)
uvx --from bach-riddles_by_api_ninjas bach_riddles_by_api_ninjas

# Option 2: Run in development mode directly with Python
python server.py

# Option 3: Run after installation as a command (underscore in the command name)
bach_riddles_by_api_ninjas

Additional setup when using API keys

Set your API key in the environment so the MCP server can authenticate to the Riddles By Api Ninjas API.

export API_KEY="your_api_key_here"

Available tools

v1riddles

Endpoint to retrieve one or more random riddles from the Riddles By Api Ninjas API. You can specify a limit to control how many results are returned (1-20).