MCP with RAG Demo
@thinklytics
About MCP with RAG Demo
This demonstration project shows how to implement a Model Context Protocol (MCP) server with Retrieval-Augmented Generation (RAG) capabilities. The demo allows AI models to interact with a knowledge base, search for information, and add new documents.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mcp-demo-thinklytics": {
"command": "python",
"args": [
"-m",
"venv",
"mcp-env"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is MCP with RAG Demo?
MCP with RAG Demo is an example implementation of a Model Context Protocol (MCP) server integrated with Retrieval-Augmented Generation (RAG) capabilities. It allows AI models to interact with a knowledge base, search for information, and add new documents. The project is intended for developers learning how to build MCP servers with RAG.
How to use MCP with RAG Demo?
Install dependencies with pip install -r requirements.txt, then start the MCP server in either SSE mode (python server.py --sse) or stdio mode (python server.py --stdio). Run the client example with python client_example.py --sse http://localhost:8000 for SSE or python client_example.py --stdio --command python --args "server.py --stdio" for stdio. An OpenAI integration example is also available via python openai_example.py after setting the OPENAI_API_KEY environment variable.
Key features of MCP with RAG Demo
- MCP server with tool and resource support
- RAG implementation with in-memory storage fallback
- Client example for interacting with the MCP server
- Support for both SSE (HTTP) and stdio communication modes
- Simple prompt templates for greetings
Use cases of MCP with RAG Demo
- Demonstrating how to build an MCP server with RAG capabilities
- Adding documents to a knowledge base and searching them with AI
- Testing MCP communication over SSE or stdio
- Integrating OpenAIβs API with an MCP server
FAQ from MCP with RAG Demo
What tools are available in MCP with RAG Demo?
The demo provides five tools: echo, add, add_document, rag_search, and list_documents. Each tool has a specific purpose, such as echoing messages or adding documents to the knowledge base.
What communication modes does the server support?
The server supports SSE (HTTP) mode using Server-Sent Events and stdio mode for standard input/output communication. Default SSE host is 0.0.0.0:8000, customizable with --host and --port.
What are the runtime requirements?
Python 3.8+ and pip are required. Dependencies are listed in requirements.txt and include the mcp-sdk package. An OpenAI API key is needed for the OpenAI example.
Where does the knowledge base data live?
The knowledge base uses in-memory storage (no persistent database). Documents are held only while the server is running. Sample data is available from the sample://data resource.
How do I troubleshoot connection issues?
Ensure the server is running in another terminal, check the URL (default http://localhost:8000), and verify the server is listening on the expected interface. Use --debug for verbose output. The client automatically appends /sse if missing.
Frequently asked questions
What tools are available in MCP with RAG Demo?
The demo provides five tools: `echo`, `add`, `add_document`, `rag_search`, and `list_documents`. Each tool has a specific purpose, such as echoing messages or adding documents to the knowledge base.
What communication modes does the server support?
The server supports SSE (HTTP) mode using Server-Sent Events and stdio mode for standard input/output communication. Default SSE host is `0.0.0.0:8000`, customizable with `--host` and `--port`.
What are the runtime requirements?
Python 3.8+ and pip are required. Dependencies are listed in `requirements.txt` and include the `mcp-sdk` package. An OpenAI API key is needed for the OpenAI example.
Where does the knowledge base data live?
The knowledge base uses in-memory storage (no persistent database). Documents are held only while the server is running. Sample data is available from the `sample://data` resource.
How do I troubleshoot connection issues?
Ensure the server is running in another terminal, check the URL (default `http://localhost:8000`), and verify the server is listening on the expected interface. Use `--debug` for verbose output. The client automatically appends `/sse` if missing.
Basic information
More Memory & Knowledge MCP servers
Notion MCP Integration
danhilseA simple MCP integration that allows Claude to read and manage a personal Notion todo list
Rust Docs MCP Server
Govcraftπ¦ Prevents outdated Rust code suggestions from AI assistants. This MCP server fetches current crate docs, uses embeddings/LLMs, and provides accurate context via a tool call.
π GistPad MCP
lostintangentπ An MCP server for managing your personal knowledge, daily notes, and re-usable prompts via GitHub Gists
MCP server for Obsidian
MarkusPfundsteinMCP server that interacts with Obsidian via the Obsidian rest API community plugin
Context7 MCP - Up-to-date Docs For Any Cursor Prompt
upstashContext7 Platform -- Up-to-date code documentation for LLMs and AI code editors
Comments