home / mcp / python mcp cat facts server

Python MCP Cat Facts Server

Provides a FastAPI MCP server delivering single cat facts and an SSE stream of facts.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "akream-mcppython": {
      "url": "http://0.0.0.0:8000/sse"
    }
  }
}

You run a lightweight MCP server written in Python using FastAPI that serves cat facts. It supports a single random fact retrieval and a real-time stream of facts delivered via Server-Sent Events, making it simple to explore the Model Context Protocol in a practical, interactive way.

How to use

Connect to the MCP server with a compatible client to retrieve either a single cat fact or subscribe to a continuous stream. Use the SSE transport endpoint to receive a steady flow of facts every 10 seconds. Your client can start by requesting a one-off fact, then switch to subscribing to the event stream for ongoing updates.

How to install

Prerequisites you need before installing this server are Python 3.12 or newer and a Python environment management tool.

Step 1: Create a project directory and navigate into it.

Step 2: Create a virtual environment.

python -m venv venv
source venv/bin/activate  # On Windows, use: venv\Scripts\activate

Step 3: Install dependencies in editable mode so you can run and test the server locally.

pip install -e .

Step 4: Start the server in SSE mode.

uv run start

Step 5: Verify the server is running. Open your browser or API client and visit the API root or automatic documentation endpoints.

Configuration and endpoints

The server exposes several endpoints you can use or observe in your MCP client. The SSE endpoint is the primary channel for streaming facts, while a simple GET endpoint can be used to fetch a single random fact. Typical endpoints include the homepage, informational pages, status, the SSE channel, and API docs.

GET http://localhost:8000/
GET http://localhost:8000/about
GET http://localhost:8000/status
GET http://localhost:8000/sse
GET http://localhost:8000/docs
GET http://localhost:8000/redoc

Available tools

single_fact

Fetch a single random cat fact on demand via the API root or a dedicated endpoint.

fact_stream

Subscribe to a Server-Sent Events stream to receive cat facts every 10 seconds in real time.