Universal MCP (Model Context Protocol) server for accessing and searching library documentation. Enables LLM agents to retrieve and analyze documentation for any configured library using advanced text ranking algorithms.
- Multi-Library Support: Access documentation for multiple configured libraries simultaneously
- Advanced Search: Keyword-based document retrieval with BM25 ranking algorithm for precise results
- Intelligent Document Processing: Parse and process markdown documentation with token estimation
- Semantic Chunking: Split documents into semantically meaningful chunks for better context management
- Token Management: Efficient token counting and management for LLM context windows
- Metadata Extraction: Automatic extraction of document structure and metadata (headings, code blocks, tables)
- Category-Based Weighting: Intelligent ranking based on document categories and sections
- Flexible Configuration: Support for multiple search modes and customizable keyword weighting
- Built with TypeScript: Full type safety and comprehensive test coverage
npm install -g package7-mcpTo install Documentation Index MCP Server for any client automatically via Smithery:
npx -y @smithery/cli@latest install package7-mcp --client <CLIENT_NAME>Available clients: cursor, claude, vscode, windsurf, cline, zed, etc.
Example for Cursor:
npx -y @smithery/cli@latest install package7-mcp --client cursor# Install dependencies
pnpm install
# Build the project
pnpm build
# Run the server
pnpm startDocumentation Index MCP can be integrated with various AI coding assistants and IDEs that support the Model Context Protocol (MCP).
- Node.js >= v18.0.0
- pnpm >= v8.0.0
- An MCP-compatible client (Cursor, Claude Code, VS Code, Windsurf, etc.)
Install in Cursor
Go to: Settings -> Cursor Settings -> MCP -> Add new global MCP server
Add the following configuration to your ~/.cursor/mcp.json file:
{
"mcpServers": {
"docs-index": {
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Claude Code
Run this command:
claude mcp add docs-index -- npx -y package7-mcpInstall in VS Code
Add this to your VS Code MCP config file. See VS Code MCP docs for more info.
"mcp": {
"servers": {
"docs-index": {
"type": "stdio",
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Windsurf
Add this to your Windsurf MCP config file:
{
"mcpServers": {
"docs-index": {
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Cline
- Open Cline
- Click the hamburger menu icon (☰) to enter the MCP Servers section
- Choose Remote Servers tab
- Click the Edit Configuration button
- Add docs-index to
mcpServers:
{
"mcpServers": {
"docs-index": {
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Claude Desktop
Open Claude Desktop developer settings and edit your claude_desktop_config.json file:
{
"mcpServers": {
"docs-index": {
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Zed
Add this to your Zed settings.json:
{
"context_servers": {
"docs-index": {
"source": "custom",
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Install in Roo Code
Add this to your Roo Code MCP configuration file:
{
"mcpServers": {
"docs-index": {
"command": "npx",
"args": ["-y", "package7-mcp"]
}
}
}Using with Bun
{
"mcpServers": {
"docs-index": {
"command": "bunx",
"args": ["-y", "package7-mcp"]
}
}
}The MCP server provides the following tools:
Retrieve the list of available libraries and their metadata.
Parameters: None
Returns:
{
"libraries": [
{
"id": "react",
"name": "React",
"version": "18.0.0",
"description": "A JavaScript library for building user interfaces"
}
]
}Search library documentation with keyword-based retrieval using BM25 ranking algorithm.
Parameters:
{
"libraryId": "react",
"query": "hooks state management",
"limit": 10
}Returns: Array of documents with scores and metadata:
{
"documents": [
{
"id": "doc-123",
"title": "Using the State Hook",
"content": "...",
"score": 0.95,
"metadata": {
"section": "Hooks",
"category": "Advanced"
}
}
]
}Get full document content by ID.
Parameters:
{
"documentId": "doc-123"
}Returns:
{
"id": "doc-123",
"title": "Using the State Hook",
"content": "Complete document content...",
"metadata": {
"tokens": 1250,
"section": "Hooks"
}
}In Cursor/Claude Code:
Search for React documentation about hooks and find examples of useState usage
In any MCP client:
What libraries are available and show me the latest React documentation
In Cursor/Claude Code:
I need to understand how to manage state in React.
Search the React documentation for state management patterns.
The project follows a modular architecture:
- constants/: Configuration constants and base prompts
- document/: Document processing logic
- splitter/: Markdown parsing and document chunking utilities
- parser/: Specialized parsers for different node types
- repository/: Data access layer and document repositories
- schema/: Zod schemas for runtime type validation
- tool/: MCP tool implementations
- server.ts: Main server entry point
- MarkdownSplitter: Intelligent markdown document splitting with semantic awareness
- BM25Calculator: Advanced ranking algorithm for search relevance
- TokenEstimator: Efficient token counting for context management
- DocumentLoader: Flexible document loading and caching
- ChunkConverter: Conversion between different document formats
# Install dependencies
pnpm install
# Run in development mode (watch mode)
pnpm dev
# Type check
pnpm typecheckpnpm build# Lint code
pnpm lint
# Fix linting issues
pnpm lint:fix
# Format code with Prettier
pnpm format# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Generate coverage report
pnpm test:coverageThe project includes comprehensive test coverage for:
- Document processing and parsing
- BM25 ranking algorithm
- Token estimation
- Search functionality
- Repository operations
src/
├── constants/ # Configuration constants and prompts
│ ├── base-prompt.ts # Base system prompts
│ ├── category.ts # Category definitions
│ ├── keyword-weight-config.ts # Search weight configuration
│ └── search-mode.ts # Search mode definitions
├── document/ # Document processing logic
│ ├── splitter/ # Markdown splitting utilities
│ │ ├── markdown-splitter.ts # Main splitter
│ │ ├── parser/ # Node-type specific parsers
│ │ └── extractMetadata.ts # Metadata extraction
│ ├── token-estimator.ts # Token counting
│ ├── document-loader.ts # Document loading
│ ├── chunk-converter.ts # Format conversion
│ └── __test__/ # Document tests
├── repository/ # Data access layer
│ ├── docs.repository.ts # Document repository
│ └── createDocsRepository.ts # Factory function
├── schema/ # Zod schemas
│ └── get-document-schema.ts # Request schemas
├── tool/ # MCP tool implementations
│ └── tools.ts # Tool definitions
└── server.ts # Main server entry point
The server supports multiple search modes configured via constants:
- BM25: Advanced relevance ranking (default)
- Keyword: Simple keyword matching
- Semantic: Context-aware search
Documents can be weighted by category for better ranking:
const categoryWeights = {
'Getting Started': 1.2,
'API': 1.0,
'Examples': 0.9
};pnpm build- Build the project with TypeScriptpnpm dev- Development mode with watchpnpm start- Start the MCP serverpnpm test- Run all testspnpm test:watch- Run tests in watch modepnpm test:coverage- Generate coverage reportpnpm lint- Lint code with ESLintpnpm lint:fix- Fix linting issuespnpm format- Format code with Prettierpnpm typecheck- Type check without building
docker build -t package7-mcp .docker run -d -p 3000:3000 \
--name docs-index \
package7-mcpCreate a docker-compose.yml:
version: '3.8'
services:
docs-index:
build: .
ports:
- "3000:3000"
environment:
- NODE_ENV=production
restart: unless-stopped
healthcheck:
test: ["CMD", "node", "-e", "require('http').get('http://localhost:3000/mcp', (r) => {process.exit(r.statusCode === 200 ? 0 : 1)})"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5sRun with Docker Compose:
docker-compose up -dContributions are welcome! Please feel free to submit a Pull Request.
MIT
choesumin