Dad Joke MCP Server

Dad Joke MCP Server

A Python-based MCP server that generates creative dad joke prompts on any topic in various styles, enabling AI agents to produce dad jokes through natural language requests.

Category
访问服务器

README

Dad Joke MCP Server 🎭

A Python-based MCP (Model Context Protocol) server that generates creative dad joke prompts. Connect your AI agent to this server and request dad jokes on any topic in various styles!

While this project was entirely vibe slopped, shoutout to OrenGrinker's Dad Joke MCP Server for inspiration and possibly examples the vibe coding LLM referenced.

Features

  • 🎪 8 Joke Styles: pun, wordplay, observational, anti-humor, question-answer, one-liner, knock-knock, and classic
  • 🛠️ MCP Tools: joke_styles and build_dad_joke_prompt for automated prompt building
  • 🌐 Network Support: Runs over SSE (Server-Sent Events) transport with standardized endpoints (/sse and /messages)
  • 📝 Extensive Logging: Full request/response logging with structured JSON format
  • 🐳 Docker Ready: Complete Docker configuration for standalone deployment

How It Works

When you request a dad joke through an MCP client:

  1. User Request: "Add a dad joke about fish"
  2. MCP Server Returns: A prompt like "You are an expert comedian skilled with puns. Create a joke about fish that is appropriate for a workplace."
  3. AI Agent Executes: The prompt and generates the actual joke
  4. Result: "Why was the fish unsuccessful? He dropped out of school!"

Installation

Local Installation

  1. Clone or navigate to the project directory:

    cd joke-poc-mcp-server
    
  2. Create a virtual environment (recommended):

    python3 -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Configure environment (optional):

    cp .env.example .env
    # Edit .env with your preferred settings
    
  5. Run the server:

    python -m src.server
    

The server will start on http://0.0.0.0:8000 by default.

  • SSE Connection: http://localhost:8000/sse (or /messages for compatibility)
  • Message Posting: http://localhost:8000/messages

Docker Installation

  1. Build and run with Docker Compose:

    docker-compose up -d
    
  2. View logs:

    docker-compose logs -f dad-joke-mcp
    
  3. Stop the server:

    docker-compose down
    

Alternatively, use Docker directly:

# Build the image
docker build -t dad-joke-mcp-server .

# Run the container
docker run -d -p 8000:8000 --name dad-joke-mcp dad-joke-mcp-server

# View logs
docker logs -f dad-joke-mcp

Configuration

Configure the server using environment variables or a .env file:

Variable Default Description
HOST 0.0.0.0 Server host address
PORT 8000 Server port
LOG_LEVEL INFO Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
LOG_FORMAT json Log format (json or text)
LOG_FILE logs/dad-joke-mcp.log Log file path
LOG_TO_FILE false Enable file logging
LOG_REQUESTS true Log incoming requests
LOG_RESPONSES true Log outgoing responses

MCP Client Configuration

Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "dad-joke": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Cline (VS Code Extension)

Add to your Cline MCP settings:

{
  "mcpServers": {
    "dad-joke": {
      "url": "http://localhost:8000/sse",
      "transport": "sse"
    }
  }
}

Usage

Prompts

Use the dad_joke prompt to generate a prompt for an LLM:

  • Required: topic
  • Optional: style (default: classic)

Tools

The server provides tools for automated interaction:

  1. joke_styles: Returns a list of all available joke styles.

    • Arguments: None
  2. build_dad_joke_prompt: Programmatically generates a dad joke prompt.

    • Arguments:
      • topic (string, required): The subject of the joke.
      • style (string, optional): The style of the joke.

Available styles:

  • pun - Clever wordplay and multiple meanings
  • wordplay - Creative word combinations and homophones
  • observational - Funny observations about everyday situations
  • anti-humor - Subverted expectations with literal punchlines
  • question-answer - Classic "Why did..." or "What do you call..." format
  • one-liner - Short, punchy single-sentence jokes
  • knock-knock - Traditional knock-knock joke format
  • classic - Traditional dad joke style (default)

Examples

Cursor

build_dad_joke_prompt( football ) and use the output as a prompt and then append the result of that prompt to the test.txt file. Only append the result, oo not include the call to the tool or the parameters. Calls the tool and uses the output as a prompt

append /dad-joke/dad_joke to the test.txt file Uses the prompt (the slash will trigger a dialog asking for the topic and style)

Logging

The server provides extensive logging with full request/response details:

JSON Format (Default)

{
  "timestamp": "2026-02-01T20:24:00.123Z",
  "logger": "dad_joke_mcp",
  "level": "INFO",
  "message": "Generated dad joke prompt",
  "request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "topic": "fish",
  "style": "classic",
  "prompt_length": 145
}

Text Format

Set LOG_FORMAT=text for human-readable logs:

2026-02-01 20:24:00,123 - dad_joke_mcp - INFO - Generated dad joke prompt

Architecture

┌─────────────────┐
│   MCP Client    │
│ (Claude/Cursor) │
└────────┬────────┘
         │ SSE/HTTP
         ▼
┌─────────────────┐
│  Dad Joke MCP   │
│     Server      │
│                 │
│  ┌───────────┐  │
│  │ Prompts / │  │
│  │   Tools   │  │
│  │ Handlers  │  │
│  └───────────┘  │
│                 │
│  ┌───────────┐  │
│  │  Logger   │  │
│  │ (JSON)    │  │
│  └───────────┘  │
└─────────────────┘

Development

Running Tests

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

Project Structure

joke-poc-mcp-server/
├── src/
│   ├── __init__.py       # Package initialization
│   ├── config.py         # Configuration management
│   └── server.py         # Main MCP server
├── Dockerfile            # Docker image definition
├── docker-compose.yml    # Docker Compose configuration
├── pyproject.toml        # Project metadata
├── requirements.txt      # Python dependencies
├── .env.example          # Example environment config
└── README.md             # This file

Troubleshooting

Server won't start

  • Check if port 8000 is already in use: lsof -i :8000
  • Verify Python version: python --version (requires 3.11+)
  • Check logs for error messages

MCP client can't connect

  • Ensure server is running: curl http://localhost:8000/sse
  • Verify firewall settings allow connections on port 8000
  • Check client configuration matches server host/port (ensure using /sse for GET)

No logs appearing

  • Set LOG_LEVEL=DEBUG for verbose logging
  • Verify LOG_REQUESTS=true and LOG_RESPONSES=true
  • Check console output or log file if LOG_TO_FILE=true

License

Free, as in beer... use this for anything, no attribution required, steal this code, say it's your own, etc.


Made with ❤️ and terrible puns

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选