home / mcp / trivia mcp server

Trivia MCP Server

Provides access to the Trivia By Api Ninjas API through an MCP server with API key-based authentication.

Installation
Add the following to your MCP client configuration file.

Configuration

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

This MCP server provides access to the Trivia By Api Ninjas API, enabling you to fetch trivia data from your applications through a standardized MCP interface for quick integration and centralized management.

How to use

You run the MCP server locally and connect to it with an MCP client. The server exposes a trivia API through the MCP channel, and you supply your API key to authenticate requests. Use your MCP client to select this server, then issue trivia queries as you would with any API-backed trivia source.

How to install

Prerequisites: you need Python for this server’s package, and you should have an MCP runtime or environment that supports stdio MCP servers.

# Install the Python package (python package manager is assumed available)
pip install bach-trivia_by_api_ninjas

# If you prefer a development setup from source, you can install in editable mode
# (from a checked-out copy of the repository that contains setup.py or pyproject.toml)
pip install -e .

Additional configuration and usage notes

The server requires an API key for Trivia By Api Ninjas. Set the API key in your environment before starting the MCP server.

{
  "mcpServers": {
    "trivia_api_ninjas": {
      "command": "uvx",
      "args": ["--from", "bach-trivia_by_api_ninjas", "bach_trivia_by_api_ninjas"],
      "env": {
        "API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Security and environment variables

Keep your API key secret. Do not expose it in client-side code or public repositories. When running in production, consider securing the environment where the MCP server executes and rotate keys periodically.

Available tools

v1trivia

Trivia API endpoint to fetch trivia items. Endpoint: GET /v1/trivia with parameters category and limit.