MCP Integration
Connect AI assistants to Mimir using Model Context Protocol
What is MCP?
Model Context Protocol (MCP) is an open protocol that enables AI assistants to securely access external data sources and tools. Mimir provides an MCP server that connects your AI coding assistant directly to your documentation and codebase.
Features
- Configurable Backend: Set your own Mimir RAG backend URL via environment variables
- Customizable Server Name: Configure the MCP server name to match your organization
- Fast Semantic Search: Direct access to your documentation
- No Additional LLM Calls: Returns document chunks directly
- Works with Popular Assistants: Claude Code, VS Code, Claude Desktop, and more
Important Notes
Embeddings: The Mimir backend uses its own embedding model. You cannot use a different LLM provider for embeddings as this would cause compatibility issues.
Chat Completions: When using chat completions via the API, you'll need to provide your own LLM API keys (OpenAI, Anthropic, etc.) for the completion model. The embedding model is handled by the backend.
Installation
VS Code / Claude Code
- Open Command Palette (
Cmd+Shift+PorCtrl+Shift+P) - Select "MCP: Open User Configuration"
- Add:
{
"mcpServers": {
"mimir": {
"command": "npx",
"args": ["-y", "@your-org/your-mcp-name"],
"env": {
"MIMIR_API_URL": "https://your-backend-url.com",
"MCP_SERVER_NAME": "Your Custom MCP Server Name"
}
}
}
}Note: Replace @your-org/your-mcp-name with your published npm package name, and set your backend URL and server name.
- Restart VS Code or reload the MCP extension
Claude Desktop
Edit claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mimir": {
"command": "npx",
"args": ["-y", "@your-org/your-mcp-name"],
"env": {
"MIMIR_API_URL": "https://your-backend-url.com",
"MCP_SERVER_NAME": "Your Custom MCP Server Name"
}
}
}
}Note: Replace @your-org/your-mcp-name with your published npm package name, and set your backend URL and server name.
Local Development
For local development:
- Clone and Build:
cd your-mcp-directory
npm install
npm run build- Set Backend URL:
Set the
MIMIR_API_URLenvironment variable:
export MIMIR_API_URL=http://localhost:3000
export MCP_SERVER_NAME="My Local MCP Server"- Add to MCP Config:
{
"mcpServers": {
"mimir": {
"command": "node",
"args": ["/absolute/path/to/your-mcp/dist/index.js"],
"env": {
"MIMIR_API_URL": "http://localhost:3000",
"MCP_SERVER_NAME": "My Local MCP Server"
}
}
}
}Using the askDocs Tool
Once configured, your AI assistant has access to the askDocs tool. Simply ask questions:
- "Find documentation about authentication"
- "Search the docs for API endpoint examples"
- "What does the documentation say about error handling?"
The AI assistant will automatically:
- Invoke the
askDocstool - Retrieve relevant documentation chunks
- Synthesize an answer based on the retrieved content
Tool Parameters
The askDocs tool accepts these parameters:
- question (required): Your documentation search query
- matchCount (optional): Number of chunks to retrieve (default: 10)
- similarityThreshold (optional): Minimum similarity score (default: 0.2)
How It Works
- AI Assistant receives your question
- MCP Server (your custom MCP package) receives the tool invocation
- Backend (mimir-rag) performs semantic search using embeddings
- Document Chunks are returned with content and metadata
- AI Assistant synthesizes an answer from the retrieved content
Prerequisites
- A running mimir-rag server with ingested documentation
- Node.js 20 or later
- An AI assistant that supports MCP
Troubleshooting
Connection Issues
If the MCP server can't connect:
- Verify mimir-rag is running:
curl https://your-backend-url.com/health - For local development, ensure
MIMIR_API_URLis set tohttp://localhost:3000 - Check firewall and network settings
- Verify the
MIMIR_API_URLorMCP_BACKEND_URLenvironment variable is correctly set in your MCP configuration
Tool Not Available
If your AI assistant doesn't see the tool:
- Restart your AI assistant
- Verify MCP configuration JSON is valid
- Check MCP logs for errors
- Ensure the path to
dist/index.jsis absolute (for local dev)
Empty Results
If searches return no results:
- Verify documentation has been ingested
- Check embeddings were created successfully
- Try lowering
similarityThresholdfor broader matches