local-docs-mcp

local-docs-mcp

Enables AI assistants to perform semantic, hybrid, and filtered search on indexed local documentation with RAG capabilities.

Category
访问服务器

README

Local Docs MCP

A modular semantic search system with MCP (Model Context Protocol) integration for searching local documentation. The Retrieval-Augmented Generation (RAG) system not only lets you manage document chunks for knowledge retrieval but also gives AI assistants semantic search capabilities through the MCP.

Key Features

Core Capability Technical Implementation
Document Indexing A full indexing pipeline that processes documents from the docs/ directory, chunks them, and creates embeddings using Ollama. With Cocoindex, it updates only the parts that have changed — when users edit or add new content, the system detects those changes and updates selectively.
Vector Database Uses Qdrant to store document embeddings for semantic search.
Retrieval The search service provides semantic search capabilities with multiple strategies (semantic, hybrid, and filtered).
MCP Integration The MCP server exposes these retrieval capabilities to AI assistants.

Quick Start

Installation

  1. Clone and setup the project:
git clone git@github.com:nguyenchiencong/local-docs-mcp.git
cd local-docs-mcp
  1. Start required services:
# Start Qdrant
docker run -d -p 6334:6334 -p 6333:6333 qdrant/qdrant

# Make sure Ollama is running with the embedding model
ollama pull hf.co/Qwen/Qwen3-Embedding-0.6B-GGUF:F16

# Setup postgres for cocoindex
docker compose -f <(curl -L https://raw.githubusercontent.com/cocoindex-io/cocoindex/refs/heads/main/dev/postgres.yaml) up -d
  1. Configure environment:
# Edit .env with your specific configuration
cp .env.example .env

# Don't forget to setup your .cocoignore file
cp .cocoignore.example .cocoignore
  1. Install dependencies:
uv sync

Usage

Before indexing, add your documents to the docs folder.

To index your documents:

uv run python -m src.indexing.main_flow
# To run the force reindex utility
uv run python -m src.indexing.force_reindex

To start the MCP server:

uv run python -m src.mcp_server.server

Make the CLI available on your PATH

If you want to run local-docs-mcp from any directory:

  • Windows (PowerShell):

    setx PATH "path\to\local-docs-mcp\.venv\Scripts;$($env:Path)"
    
  • Linux/macOS (bash/zsh):

    echo 'export PATH="/path/to/local-docs-mcp/.venv/bin:$PATH"' >> ~/.bashrc
    

To run MCP tools directly from the CLI (one-off calls):

# Start the server (default behavior)
local-docs-mcp

# Run a semantic search once and exit
local-docs-mcp semantic_search --query "vector search overview" --limit 5

# Run hybrid search
local-docs-mcp hybrid_search --query "async await" --semantic-weight 0.7 --limit 5

# Run a filtered search with metadata (JSON object)
local-docs-mcp search_with_metadata_filter --query "UI tutorial" --metadata-filter '{"filename": "ui.md"}' --limit 5

# Retrieve a specific document by ID
local-docs-mcp document_retrieval --document-id "doc-123"

# Fetch collection info
local-docs-mcp get_collection_info --json

Configuration

System Settings

All configuration is managed in pyproject.toml under the [tool.local-docs] section:

[tool.local-docs]
# Qdrant configuration
qdrant_url = "http://localhost:6334"
qdrant_collection = "local-docs-collection"

# Ollama configuration
ollama_url = "http://localhost:11434"
ollama_model = "hf.co/Qwen/Qwen3-Embedding-0.6B-GGUF:F16"
embedding_dimension = 1024

# Document configuration
docs_directory = "docs"
supported_extensions = [".md", ".rst", ".txt"]

# Search configuration
search_limit = 10

# Chunking configuration
chunk_size = 1200
chunk_overlap = 200

# Search configuration
search_limit = 10
similarity_threshold = 0.15
search_hnsw_ef = 256
hybrid_semantic_weight = 0.85
mmr_lambda = 0.75

Environment Variables: Override any setting with LOCAL_DOCS_* environment variables:

export LOCAL_DOCS_SEARCH_LIMIT=20
export LOCAL_DOCS_OLLAMA_MODEL="different-model"

MCP Client Setup

Add this to your MCP client configuration (e.g., Claude Code):

{
  "mcpServers": {
    "local-docs-mcp": {
      "command": "uv",
      "args": ["run", "--project", "/path/to/local-docs-mcp", "-m", "src.mcp_server.server"]
    }
  }
}

MCP Tools

The MCP server exposes the following semantic search tools to AI assistants:

Tool Purpose Parameters Example Prompt
semantic_search Perform semantic search on indexed documents. Finds content based on meaning and context rather than exact keywords. query (required string), limit (optional number, default: 10), min_similarity_score (optional number, default: 0.0) "Find information about error handling patterns in the codebase"
hybrid_search Combine semantic search with keyword matching. Useful when exact terminology matters alongside conceptual meaning. query (required string), semantic_weight (optional number, default: 0.7), limit (optional number, default: 10), min_similarity_score (optional number, default: 0.0) "Search for 'async await' patterns and asynchronous programming concepts"
document_retrieval Retrieve complete document by ID. Use this when you need the full context of a specific document found in search results. document_id (required string) "Get the full document for ID 'doc_12345'"
search_with_metadata_filter Search with metadata constraints. Use this to narrow down search results by specific document properties. query (required string), metadata_filter (optional object), limit (optional number, default: 10), min_similarity_score (optional number, default: 0.0) "Search for API documentation in files with filename containing 'api'"
get_collection_info Get information about the indexed document collection, including statistics and status. none "Show me collection statistics and indexing status"

Use cases

Documentation Research:

  • "What are signals and how do they work in Godot?"
  • "Find tutorials about character controllers"
  • "Explain the difference between KinematicBody and RigidBody"

Problem Solving:

  • "How do I fix 'node not found' errors?"
  • "What are the best practices for performance optimization?"
  • "Search for debugging techniques in Godot"

Learning Paths:

  • "I'm a beginner, show me getting started content"
  • "What should I learn after basic GDScript?"
  • "Find intermediate tutorials about physics"

Specific Searches:

  • "Show me the top 5 most relevant results about animations"
  • "Find only tutorial files about UI design"
  • "Look for performance optimization guides"

Development

Running Tests

uv run pytest tests/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Add tests for new functionality
  4. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Related Projects

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选