A Model Context Protocol (MCP) server for fetching documentation from URLs, generating embeddings, storing them in a Qdrant vector database, and enabling semantic search. This allows you to augment LLMs like Claude with relevant context from your own documentation sources.
- Add Documentation: Fetch content from a URL, chunk it, generate embeddings, and store it in Qdrant.
- Search Documentation: Perform semantic search over the stored documentation using a query string.
- List Sources: View the base URLs of the documentation sources currently indexed.
- Configurable Embeddings: Supports Ollama (local) and OpenAI (cloud) for embedding generation.
- MCP Compliant: Integrates with MCP-compatible clients like Claude Desktop via stdio.
- Node.js: v18.x or later (Download)
- npm: Comes with Node.js
- Qdrant: A running instance (v1.8.0 or later recommended). See Qdrant Installation Docs. (Docker is often the easiest way).
- Ollama (Optional): A running instance if using Ollama for embeddings. See Ollama Website. Make sure your desired embedding model (e.g.,
nomic-embed-text) is pulled:ollama pull nomic-embed-text. - OpenAI API Key (Optional): Required if using OpenAI for embeddings.
- Clone the repository:
git clone https://github.com/obviousworks/mcp-ragdocs.git cd mcp-ragdocs - Install dependencies:
npm install
- Create Environment File: Copy the example environment file:
cp .env.example .env
- Edit
.env: Open the.envfile in a text editor and configure the variables according to your setup:QDRANT_URL: Set the correct URL for your Qdrant instance.EMBEDDING_PROVIDER: Chooseollamaoropenai.OLLAMA_URL/OLLAMA_EMBED_MODEL: Configure if using Ollama.OPENAI_API_KEY/OPENAI_EMBED_MODEL: Configure if using OpenAI.- Ensure the necessary service (Qdrant, Ollama) is running.
Compile the TypeScript source code to JavaScript:
npm run buildThis will create the compiled output in the build/ directory.
You can run the server directly. This is useful for direct testing but not for connecting to Claude Desktop via stdio.
npm startThe server will attempt to connect to Qdrant and listen for MCP requests (though it doesn't set up an HTTP listener by default).
The MCP Inspector provides a web UI to test tool calls.
npm run inspectorOpen your browser to http://127.0.0.1:6274 (or the address shown in the terminal).
For persistent running, use a process manager like pm2.
- Install
pm2globally (if you haven't already):npm install pm2 -g
- Start the server:
pm2 start build/index.js --name mcp-ragdocs
- Manage the process:
- Check status:
pm2 status - View logs:
pm2 logs mcp-ragdocs - Stop:
pm2 stop mcp-ragdocs - Restart:
pm2 restart mcp-ragdocs - Delete:
pm2 delete mcp-ragdocs
- Check status:
Claude Desktop uses the stdio transport to communicate with local MCP servers.
- Open Claude Desktop Settings: Navigate to the MCP server/tools management section.
- Add Custom MCP: Choose the option to add a new server.
- Configure Stdio:
- Transport Type: Select
stdio. - Command: Provide the absolute path to Node.js and the server's entry script. For example:
(Replace
node /Users/your_user/path/to/mcp-server-ragdocs/build/index.js/Users/your_user/path/to/with the actual absolute path to the cloned project directory). - Name: Give it a descriptive name (e.g., "Local RAG Docs").
- Save the configuration.
- Transport Type: Select
Once connected to an MCP client (like Claude via stdio or the Inspector), you can use the following tools:
-
add_documentation: Adds content from a URL.- Parameters:
url(string, required): The URL of the documentation page to ingest.
- Example:
add_documentation(url="https://example.com")
- Parameters:
-
search_documentation: Searches the indexed documentation.- Parameters:
query(string, required): The search term or question.limit(number, optional, default: 5): Maximum number of results.
- Example:
search_documentation(query="how to configure qdrant", limit=3)
- Parameters:
-
list_sources: Lists the unique base URLs of indexed documents.- Parameters: None.
- Example:
list_sources()
-
test_ollama/test_openai(Available viatest_ollamatool name, usesproviderparameter): Tests embedding generation. Can be used to switch the active embedding provider and model for the current server instance.- Parameters:
text(string, required): Sample text to embed.provider(string, optional, default:ollama):ollamaoropenai.apiKey(string, optional): OpenAI key ifprovider=openai.model(string, optional): Specific model name for the provider.
- Example:
test_ollama(text="test embedding", provider="ollama", model="nomic-embed-text")
- Parameters:
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.