joke-mcp

joke-mcp

A simple MCP server that generates random jokes with setup and punchline

Category
访问服务器

README

🎭 Joke MCP Server

A simple yet powerful Model Context Protocol (MCP) server that brings humor to AI interactions. This MCP exposes random joke generation as tools that can be seamlessly integrated with Claude and other MCP-compatible clients.

✨ Features

  • get_random_joke - Get a random joke with setup and punchline
  • count_jokes - Get the total number of available jokes in the database
  • Simple & Lightweight - Minimal dependencies, fast execution
  • Easy Integration - Works with Claude Desktop and other MCP clients
  • Well-Documented - Clear schemas and usage examples

🚀 Quick Start

Prerequisites

  • Python 3.11 or higher
  • pip package manager

Installation

# Clone the repository
git clone https://github.com/tehrimaly/mcp-joke.git
cd mcp-joke

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\Activate.ps1
# On macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Running the Server

python joke-mcp.py

You should see:

🚀 Joke MCP Server starting...

📖 Usage

With Claude Desktop

Add this to your Claude Desktop configuration file:

macOS/Linux: ~/.config/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "joke-mcp": {
      "command": "python",
      "args": ["/path/to/joke-mcp.py"]
    }
  }
}

Then restart Claude Desktop and you can ask Claude to tell jokes!

API Reference

get_random_joke

Returns a random joke with setup and punchline.

Input: None

Output:

Setup: Why don't scientists trust atoms?

Punchline: Because they make up everything!

count_jokes

Returns the total number of jokes available in the database.

Input: None

Output:

Total jokes: 5

🏗️ Project Structure

mcp-joke/
├── joke-mcp.py          # Main MCP server implementation
├── requirements.txt      # Python dependencies
├── README.md            # This file
├── .gitignore           # Git configuration
└── LICENSE              # MIT License

🔧 Technical Details

Built With

  • Python 3.11+ - Programming language
  • MCP SDK v1.0.0 - Model Context Protocol library
  • Asyncio - Asynchronous programming

How It Works

The Joke MCP Server:

  1. Starts an MCP server listening on stdio
  2. Registers available tools with their schemas
  3. Handles incoming requests from MCP clients
  4. Returns formatted responses with joke data
# Tool registration example
@server.list_tools()
async def list_tools():
    return [
        Tool(
            name="get_random_joke",
            description="Get a random joke",
            inputSchema={...}
        )
    ]

# Tool execution
@server.call_tool()
async def call_tool(name: str, arguments: dict):
    if name == "get_random_joke":
        # Return random joke

📦 Dependencies

  • mcp==1.0.0 - Model Context Protocol SDK

See requirements.txt for complete dependency list.

🎯 Current Features

✅ 5 built-in jokes ✅ Async/await support ✅ Clean error handling ✅ Simple schema-based tool definition ✅ Stdout logging

🔮 Future Enhancements

  • [ ] Add joke categories (dad jokes, puns, dark humor)
  • [ ] Implement difficulty levels
  • [ ] Add joke ratings/feedback
  • [ ] Connect to external joke APIs
  • [ ] Persist user favorites
  • [ ] Multi-language support
  • [ ] Web UI for joke management

🤝 Contributing

Feel free to:

  • Add more jokes to the database
  • Improve documentation
  • Report bugs
  • Suggest new features

📝 License

This project is licensed under the MIT License - see LICENSE file for details.

🔗 Links

  • GitHub: https://github.com/tehrimaly/mcp-joke
  • MCP Specification: https://spec.modelcontextprotocol.io/
  • Anthropic MCP Docs: https://modelcontextprotocol.io/

💡 Example Use Cases

  1. AI Assistant Integration - Add humor to Claude interactions
  2. Slack Bot - Integrate jokes into team communication
  3. Learning Tool - Understand MCP implementation basics
  4. Template - Use as a starting point for your own MCP servers

🐛 Troubleshooting

Issue: Module not found error

pip install -r requirements.txt

Issue: Port already in use The server uses stdio, not a port. This shouldn't occur.

Issue: Server won't start

  • Check Python version (3.11+)
  • Verify all dependencies installed
  • Check for syntax errors

📧 Support

For issues, questions, or suggestions, please open a GitHub issue.


Made with ❤️ as part of the MCP learning journey

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选