
docmcp
docmcp
README
DocMCP: Index the latest doc for LLMs on PostgreSQL using pgvector and expose to AI IDEs
A system for crawling, processing, and querying documentation with AI-powered embedding generation and semantic search capabilities.
Features
- Documentation Crawling: Automatically crawl documentation sites with customizable depth and rate limiting
- Content Processing: Convert HTML to clean Markdown with metadata extraction
- Vector Embeddings: Generate embeddings using AWS Bedrock for semantic searching
- Job Management: Track and manage document processing jobs with detailed progress reporting
- MCP Integration: Built-in MCP tools for AI agent integration
Roadmap
- SPA support: currently the crawler doesn't support SPAs
- Caching: crawled urls are directly added to the DB
Getting Started (Development Setup)
Prerequisites
- Docker (Install Guide)
- Docker Compose (Install Guide)
- Node.js 16+
- Git
- AWS Account with Bedrock access
- AWS CLI configured with appropriate credentials
Quick Start Steps
-
Clone the Repository:
git clone https://github.com/visheshd/docmcp.git cd docmcp
-
Configure Environment:
- Copy the example environment file:
cp .env.example .env
- Edit the
.env
file:- Set
DATABASE_URL
topostgresql://postgres:postgres@localhost:5433/docmcp
- Configure AWS Bedrock:
- Set
AWS_REGION
to your AWS region (e.g.,us-east-1
) - Set
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
with your AWS credentials - Or ensure your AWS CLI is configured with appropriate credentials
- Set
- Adjust other settings like
LOG_LEVEL
if needed
- Set
- Copy the example environment file:
-
Start the Development Environment:
# Make the script executable chmod +x dev-start.sh # Start the development environment ./dev-start.sh
This script will:
- Start PostgreSQL with pgvector in a Docker container
- Install project dependencies
- Run database migrations
- Import seed data automatically
- The database will be accessible on port 5433
-
Add Documentation: Use the
add-docs
script to crawl and process documentation:# Basic usage npm run add-docs -- --url https://example.com/docs --max-depth 3 # With additional options npm run add-docs -- \ --url https://example.com/docs \ --max-depth 3 \ --tags react,frontend \ --package react \ --version 18.0.0 \ --wait
Available options:
--url
: Documentation URL to crawl (required)--max-depth
: Maximum crawl depth (default: 3)--tags
: Comma-separated tags for categorization--package
: Package name this documentation is for--version
: Package version (defaults to "latest")--wait
: Wait for processing to complete--verbose
: Enable detailed logging- See
npm run add-docs -- --help
for all options
-
Query Documentation: Once documentation is added, you can query it using the MCP tools. See the "Querying Documentation" section below.
-
Stop the Development Environment:
docker-compose -f docker-compose.dev.yml down
This setup provides a lightweight development environment with just the required PostgreSQL database and pre-loaded seed data. For production deployments or if you prefer a fully containerized setup, see the "Production Docker Setup" section below.
Cursor Setup
To use DocMCP with Cursor IDE, you'll need to configure the MCP transport. Add the following configuration to your Cursor settings:
{
"docmcp-local-stdio": {
"transport": "stdio",
"command": "node",
"args": [
"<DOCMCP_DIR>/dist/stdio-server.js"
],
"clientInfo": {
"name": "cursor-client",
"version": "1.0.0"
}
}
}
Replace <DOCMCP_DIR>
with the absolute path to your DocMCP installation directory.
For example, if DocMCP is installed in /home/user/projects/docmcp
, your configuration would be:
"args": ["/home/user/projects/docmcp/dist/stdio-server.js"]
After adding this configuration, restart Cursor for the changes to take effect.
Architecture
The system consists of several core services:
- CrawlerService: Handles documentation site crawling with robots.txt support
- DocumentProcessorService: Processes documents (HTML→Markdown, chunking, embedding)
- JobService: Manages asynchronous processing jobs with detailed status tracking
- ChunkService: Stores and retrieves document chunks with vector search capabilities
- MCP Tools: Agent-friendly interface for adding and querying documentation
Document Processing Pipeline
The DocMCP system processes documentation through the following pipeline:
-
Documentation Input
- User provides a URL through the
add_documentation
MCP tool - System creates a Job record with "pending" status
- Job is assigned tags for categorization and future filtering
- User provides a URL through the
-
Web Crawling (CrawlerService)
- Crawler respects robots.txt restrictions
- Follows links up to specified maximum depth
- Captures HTML content and metadata
- Creates Document records linked to the parent Job
-
Document Processing (DocumentProcessorService)
- Cleans HTML and converts to structured Markdown
- Extracts metadata (package info, version, document type)
- Establishes parent-child relationships between documents
- Updates Job progress as processing continues
-
Chunking & Embedding (ChunkService)
- Splits documents into semantic chunks for better retrieval
- Generates vector embeddings using AWS Bedrock
- Stores embeddings in PostgreSQL with pgvector extension
- Preserves chunk metadata and document references
-
Job Finalization (JobService)
- Updates Job status to "completed"
- Calculates and stores document statistics
- Makes documents available for querying
-
Querying & Retrieval
- User sends query through
query_documentation
MCP tool - System converts query to vector embedding
- Performs similarity search to find relevant chunks
- Returns formatted results with source information
- Supports filtering by tags, status, and metadata
- User sends query through
This pipeline enables efficient storage, processing, and retrieval of documentation with semantic understanding capabilities. All steps are tracked through the job system, allowing detailed progress monitoring and error handling.
Project Structure
docmcp/
├── prisma/ # Database schema and migrations
│ └── schema.prisma # Prisma model definitions and database configuration
├── src/
│ ├── config/ # Application configuration
│ │ └── database.ts # Database connection setup
│ ├── generated/ # Generated code (Prisma client)
│ ├── services/ # Core service modules
│ │ ├── crawler.service.ts # Website crawling functionality
│ │ ├── document.service.ts # Document management
│ │ ├── document-processor.service.ts # Document processing and transformation
│ │ ├── job.service.ts # Async job management
│ │ ├── chunk.service.ts # Document chunking and vector operations
│ │ └── mcp-tools/ # MCP integration tools
│ │ ├── add-documentation.tool.ts # Tool for adding new documentation
│ │ ├── get-job-status.tool.ts # Tool for checking job status
│ │ ├── list-documentation.tool.ts # Tool for listing available documentation
│ │ ├── query-documentation.tool.ts # Tool for querying documentation
│ │ ├── sample.tool.ts # Example tool implementation
│ │ └── index.ts # Tool registry and exports
│ ├── types/ # TypeScript type definitions
│ │ └── mcp.ts # MCP tool interface definitions
│ ├── utils/ # Utility functions
│ │ ├── logger.ts # Logging utilities
│ │ └── prisma-filters.ts # Reusable Prisma filtering patterns
│ └── __tests__/ # Test files
│ └── utils/ # Test utilities
│ └── testDb.ts # Test database setup and teardown
├── .env # Environment variables
└── package.json # Project dependencies and scripts
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。