MCP Joke Server with Authentication
@flowsoft-org
Play around with mcp-servers and their mcp-client authentication options
Overview
What is MCP Joke Server with Authentication?
This is a sample implementation of a Model Context Protocol (MCP) server that serves programming jokes with token-based authentication using FastAPI. It is intended as a demonstration for integration with GitHub Copilot in VS Code.
How to use MCP Joke Server with Authentication?
Open the project folder in VS Code, click “Reopen in Container” to use the devcontainer, then run python server.py. The server starts on http://localhost:8000. Access the SSE endpoint at /sse with a Bearer token: use valid_token for this demo.
Key features of MCP Joke Server with Authentication
- Single MCP tool called
tell_joke - Returns a different programming joke on each invocation
- Token-based authentication for the SSE endpoint
- FastAPI-based HTTP server
- Designed for VS Code Copilot integration
Use cases of MCP Joke Server with Authentication
- Providing a custom joke-telling agent for GitHub Copilot in VS Code
- Demonstrating MCP server setup with authentication
- Learning how to build a simple MCP server with FastAPI
FAQ from MCP Joke Server with Authentication
What does the server do?
It cycles through a collection of programming-related jokes each time the tell_joke tool is called, returning one joke per invocation.
What dependencies or runtime are required?
The server runs inside a VS Code devcontainer that automatically installs dependencies from requirements.txt. Python and FastAPI are the primary requirements.
How is authentication handled?
The server uses a simple Bearer token for the SSE endpoint. A valid token (valid_token) must be included in the HTTP header. Requests without a valid token receive a 401 Unauthorized response.
Are there any known limits?
This is a demonstration implementation; it is not production-ready. For production, you should use proper token validation, secure secrets, HTTPS, and rate limiting.
Where does the joke data live?
Jokes are stored in‑memory as a collection, and the server cycles through them on each call. No external database is used.