Fastmcp Joke Chat Tool Bot
This project is a simple AI-powered bot system using FastMCP, featuring a chat tool for general conversation and a joke tool for explaining or generating jokes, all accessible via a unified server and a command-line client.
Ask AI about Fastmcp Joke Chat Tool Bot
Powered by Claude Β· Grounded in docs
I know everything about Fastmcp Joke Chat Tool Bot. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
fastmcp-joke-chat-tool-bot
An example project demonstrating a simple Multi-Context Protocol (MCP) server and client using FastMCP, with two tools: a chatbot and a joke explainer.
Features
- Chat Tool: General-purpose AI chatbot using OpenAI's API.
- Joke Tool: Explains jokes or cracks new ones using OpenAI's API.
- MCP Server: Unified server exposing both tools via HTTP.
- Async Client: Command-line client to interact with the server and select tools automatically.
Project Structure
servers/server.py: Starts the MCP server and registers tools.servers/mcp_app.py: Initializes the FastMCP app instance.servers/tools/chat_tool.py: Implements the chat tool.servers/tools/joke_tool.py: Implements the joke tool.clients/client.py: Async CLI client for interacting with the server.requirements.txt: Python dependencies.
Setup
- Clone the repository
- Install dependencies:
pip install -r requirements.txt - Set environment variables:
- Create a
.envfile with your OpenAI API key:OPENAI_API_KEY=your_openai_api_key OPENAI_MODEL=gpt-4o-mini
- Create a
Running the Server
python servers/server.py
The server will start on http://127.0.0.1:8000/mcp.
Using the Client
python clients/client.py
Type your message. If it contains the word "joke", the joke tool is used; otherwise, the chat tool is used. Type exit to quit.
Example
You: Tell me a joke about computers.
[explain_joke] β (AI-generated joke or explanation)
You: How do I reverse a list in Python?
[chat] β (AI-generated answer)
Credits
- Built with FastMCP and OpenAI API.
MIT License
