MCP Docs Server

MCP Docs Server

Aggregates documentation from multiple sources (llms.txt format or web scraping) and provides semantic search capabilities using vector embeddings and hybrid search for each documentation source.

Category
Visit Server

README

MCP Docs Server

A Model Context Protocol (MCP) server that aggregates documentation from multiple sources and provides semantic search capabilities using vector embeddings.

Features

  • Multiple source types: Support for llms.txt format and web scraping via Firecrawl
  • Semantic search: Hybrid search combining vector embeddings and FTS5 keyword search
  • Per-source tools: Each documentation source gets its own search_<name>_docs tool for easy discovery
  • Simple CLI: Add, remove, and manage documentation sources

Tech Stack

  • Runtime: Bun
  • MCP SDK: @modelcontextprotocol/sdk (stdio transport)
  • Database: LibSQL with vector embeddings and FTS5
  • Embeddings: Vercel AI SDK (configurable providers)
  • Web Scraping: Firecrawl

Setup

1. Install Dependencies

bun install

2. Configure Environment Variables

Create a .env file from the example:

cp .env.example .env

Edit .env and add your API keys:

# Database (optional - defaults to ~/.local/share/mcp-docs/docs.db)
# DATABASE_URL=file:./data/docs.db

# Embeddings (OpenAI)
OPENAI_API_KEY=sk-...

# Firecrawl (for web scraping)
FIRECRAWL_API_KEY=fc-...

3. Add Documentation Sources

# Add a source
bun run cli source add bun bun.sh
bun run cli source add react react.dev
bun run cli source add mylib example.com/docs

The CLI will automatically detect whether to use llms.txt or Firecrawl based on what's available at the URL.

4. Run Ingestion

# Ingest all sources
bun run cli ingest

# Or ingest a specific source
bun run cli ingest --source=bun

5. Configure MCP Client

bun run cli configure

This configures the MCP server in Claude Code. To also configure VSCode:

bun run cli configure --vscode

Usage

MCP Tools

Each documentation source you add creates a dedicated search tool:

  • search_bun_docs - Search Bun documentation
  • search_react_docs - Search React documentation
  • search_mylib_docs - Search your custom docs

Each tool accepts:

  • query (required): Search query
  • limit (optional): Number of results (default: 5)

Results are returned as markdown with title, path, URL, and relevant content.

CLI Commands

# Source management
bun run cli source add <name> <url>    # Add a new source
bun run cli source remove <name>        # Remove a source
bun run cli source list                 # List all sources

# Ingestion
bun run cli ingest                      # Ingest all sources
bun run cli ingest --source=<name>      # Ingest specific source
bun run cli ingest --dry-run            # Preview without writing

# Status
bun run cli status                      # Show database stats

# Configuration
bun run cli configure                   # Configure Claude Code / VSCode

Source Auto-Detection

When adding a source, the CLI automatically detects the best method:

  1. URLs ending in llms.txt or llms-full.txt are used directly
  2. Probes {url}/llms.txt - if found, uses llms.txt
  3. Probes docs.{domain}/llms.txt - if found, uses llms.txt
  4. Falls back to Firecrawl web scraping

Source Options

# Firecrawl options
bun run cli source add mysite example.com --crawl-limit=200
bun run cli source add docs example.com/docs --exclude-paths=blog/*,changelog/*

# llms.txt options
bun run cli source add bun bun.sh --include-optional

How It Works

  1. Source Management: Add documentation sources via CLI - stored in SQLite
  2. Ingestion: Fetches documentation from sources (llms.txt or Firecrawl)
  3. Chunking: Splits documents into ~512 token chunks with overlap
  4. Embedding: Generates vector embeddings for each chunk
  5. Indexing: Stores in LibSQL with vector index and FTS5 for hybrid search
  6. Tool Registration: Each source becomes a search_<name>_docs MCP tool
  7. Search: Combines vector similarity and keyword matching via Reciprocal Rank Fusion

Database

The database is stored at ~/.local/share/mcp-docs/docs.db by default (following XDG conventions). Override with DATABASE_URL in .env.

Schema:

  • sources: Documentation sources (name, type, URL, options)
  • documents: Full documents with content hash for deduplication
  • chunks: Document chunks with vector embeddings (1536 dimensions)
  • chunks_fts: FTS5 index for keyword search

Development

# Type check
bun run build

# Run tests
bun test

# Run server directly
bun run src/index.ts

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured