python-mcp-handson is a hands-on project demonstrating the Model Context Protocol (MCP) server using Python. It provides practical tools for AI agents, including a Retrieval-Augmented Generation (RAG) system that combines Weaviate vector database with OpenAI API.
-
greet - A simple greeting tool
- Returns a personalized greeting message
-
search_docs - Semantic search over indexed documents
- Searches the
docs/directory using natural language queries - Returns relevant document chunks with similarity scores
- Searches the
-
list_indexed_sources - List all indexed documents
- Returns file information for indexed documents
- Docker and Docker Compose
- OpenAI API key (for embeddings)
-
Set up environment variables:
export OPENAI_API_KEY="your-api-key"
-
Index documents (first time):
docker compose --profile index run --rm indexer
Place your documents in the
docs/directory before running this. -
Start the MCP server:
docker compose up
-
Use the tools:
- Call the
search_docstool with a natural language query to find relevant documents - Use
greetto test basic functionality - Query
list_indexed_sourcesto see which documents are indexed
- Call the
MIT