opencode-docs
Allows scraping and searching Express.js official documentation.
Allows scraping and searching n8n documentation for workflow automation.
Allows scraping and searching Next.js official documentation for use in AI coding assistants.
Allows scraping and searching Node.js API documentation.
Allows scraping and searching React official documentation (requires Playwright for JS-rendered content).
Allows importing and searching API documentation from OpenAPI/Swagger specifications.
Allows scraping and searching Tailwind CSS documentation.
Allows scraping and searching Vue.js official documentation.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@opencode-docssearch documentation for authentication"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
opencode-docs
A powerful MCP (Model Context Protocol) server for scraping, storing, and searching documentation locally. Built for use with OpenCode, Claude Desktop, and other MCP-compatible AI coding assistants.
Features
Smart Scraping: Extracts main content from documentation pages with intelligent noise filtering
Playwright Support: Optional browser-based scraping for JavaScript-rendered sites (React, Vue, Next.js, etc.)
Recursive Crawling: Automatically discovers and follows internal links to build complete documentation sets
Full-Text Search: Fast search across all stored documentation using FlexSearch
OpenAPI/Swagger Import: Import API documentation from OpenAPI specs or Swagger UI pages
Metadata Extraction: Captures descriptions, keywords, authors, and last-modified dates
Update Detection: Re-scrape existing docs and see what changed
Related MCP server: docs-mcp
Table of Contents
Installation
Prerequisites
Node.js 18+ (check with
node --version)npm or pnpm
Git (for cloning)
Step 1: Clone the Repository
git clone https://github.com/salmenkhelifi1/opencode-docs.git
cd opencode-docsStep 2: Install Dependencies
npm installStep 3: Build the Project
npm run buildStep 4 (Optional): Install Playwright for JS-rendered Sites
If you need to scrape JavaScript-heavy sites (React, Vue, Next.js docs, etc.):
# Install Playwright
npm install playwright
# Install Chromium browser
npx playwright install chromiumVerify Installation
# Test that the server starts
node dist/index.js
# You should see:
# [opencode-docs] Docs directory: /home/username/.config/opencode/docs
# [opencode-docs] MCP server started (v1.1.0)
# Press Ctrl+C to stopQuick Start
After installation, add some documentation:
# Start your AI assistant (OpenCode, Claude Desktop, etc.)
# Then use these commands:
# Add Next.js documentation (recursive crawl)
docs_add_url url="https://nextjs.org/docs" recursive=true maxPages=30
# Add Express.js documentation
docs_add_url url="https://expressjs.com/en/starter/installing.html" recursive=true maxPages=30
# Search your docs
docs_search query="middleware"
# List all sources
docs_listConfiguration
OpenCode Setup
Step 1: Find Your Config File
The OpenCode config file is located at:
Linux/macOS:
~/.config/opencode/opencode.jsonWindows:
%APPDATA%\opencode\opencode.json
Step 2: Add the MCP Server
Add the docs MCP server to your config:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"docs": {
"type": "local",
"command": ["node", "/full/path/to/opencode-docs/dist/index.js"],
"enabled": true
}
}
}Important: Replace /full/path/to/opencode-docs with the actual path where you cloned the repository.
Step 3: Restart OpenCode
Restart OpenCode to load the new MCP server. You should see the docs tools available.
Full OpenCode Config Example
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"docs": {
"type": "local",
"command": ["node", "/home/username/opencode-docs/dist/index.js"],
"enabled": true
}
}
}Claude Desktop Setup
Step 1: Find Your Config File
The Claude Desktop config file is located at:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Step 2: Add the MCP Server
{
"mcpServers": {
"docs": {
"command": "node",
"args": ["/full/path/to/opencode-docs/dist/index.js"]
}
}
}Step 3: Restart Claude Desktop
Quit and restart Claude Desktop. The docs tools should now be available.
VS Code with Continue Extension
Add to your Continue config (.continue/config.json):
{
"experimental": {
"modelContextProtocolServers": [
{
"transport": {
"type": "stdio",
"command": "node",
"args": ["/full/path/to/opencode-docs/dist/index.js"]
}
}
]
}
}Available Tools
docs_list
List all available documentation sources stored locally.
docs_listOutput: Shows all sources with their IDs, page counts, and descriptions.
docs_search
Search across all local documentation.
docs_search query="authentication"
docs_search query="routing" sourceId="expressjs"
docs_search query="hooks" limit=10Parameters:
Parameter | Type | Required | Description |
| string | Yes | Search query |
| string | No | Limit search to specific source |
| number | No | Max results (default: 10) |
docs_read
Read a specific documentation page or list all pages in a source.
# List all pages in a source
docs_read sourceId="nextjs"
# Read a specific page
docs_read sourceId="nextjs" pagePath="docs-app-getting-started.md"Parameters:
Parameter | Type | Required | Description |
| string | Yes | Source ID |
| string | No | Page path (omit to list all pages) |
docs_add_url
Add documentation from a URL with optional recursive crawling.
# Single page
docs_add_url url="https://nextjs.org/docs"
# Recursive crawl (follows links)
docs_add_url url="https://nextjs.org/docs" recursive=true maxPages=50 maxDepth=3
# For JavaScript-rendered sites
docs_add_url url="https://react.dev/learn" usePlaywright=true recursive=true
# With URL filter pattern
docs_add_url url="https://docs.example.com" recursive=true urlPattern="/api/"Parameters:
Parameter | Type | Default | Description |
| string | required | The URL to scrape |
| string | auto | Custom source ID |
| string | auto | Display name for the source |
| string | auto | Description for the source |
| boolean | false | Use Playwright for JS-rendered pages |
| boolean | false | Recursively crawl linked pages |
| number | 20 | Max pages to crawl (recursive mode) |
| number | 2 | Max link depth (recursive mode) |
| string | - | Regex pattern to filter URLs |
docs_add_sitemap
Crawl an entire documentation site from its sitemap.xml.
docs_add_sitemap sitemapUrl="https://docs.example.com/sitemap.xml"
docs_add_sitemap sitemapUrl="https://docs.example.com/sitemap.xml" maxPages=100 urlPattern="/docs/"Parameters:
Parameter | Type | Default | Description |
| string | required | Sitemap URL |
| string | auto | Custom source ID |
| string | auto | Display name |
| number | 50 | Max pages to crawl |
| string | - | Regex to filter URLs |
docs_add_openapi
Import an OpenAPI/Swagger specification from a direct JSON URL.
docs_add_openapi url="https://api.example.com/openapi.json" sourceId="my-api"docs_add_swagger
Import documentation from a Swagger UI page (auto-detects spec URL).
docs_add_swagger url="https://api.example.com/swagger"docs_update
Update/refresh existing documentation by re-scraping.
# Update entire source
docs_update sourceId="nextjs"
# Update single page
docs_update sourceId="nextjs" pagePath="docs.md"
# With Playwright
docs_update sourceId="react" usePlaywright=truedocs_preview
Preview scraped content without saving.
docs_preview url="https://example.com/docs"
docs_preview url="https://example.com/docs" showLinks=true usePlaywright=truedocs_auth
Manage authentication credentials for API documentation.
# Add bearer token
docs_auth action="add" host="api.example.com" type="bearer" token="your-token"
# Add basic auth
docs_auth action="add" host="api.example.com" type="basic" username="user" password="pass"
# List all credentials
docs_auth action="list"
# Remove credentials
docs_auth action="remove" host="api.example.com"docs_remove
Remove a documentation source and all its pages.
docs_remove sourceId="old-docs" confirm=trueUsage Examples
Add Popular Documentation Sites
# Next.js (React framework)
docs_add_url url="https://nextjs.org/docs" recursive=true maxPages=50 sourceId="nextjs" name="Next.js"
# Express.js (Node.js web framework)
docs_add_url url="https://expressjs.com/en/starter/installing.html" recursive=true maxPages=30 sourceId="expressjs" name="Express.js"
# Node.js API Documentation
docs_add_url url="https://nodejs.org/docs/latest/api/" recursive=true maxPages=40 sourceId="nodejs" name="Node.js"
# n8n (Workflow Automation)
docs_add_url url="https://docs.n8n.io/" recursive=true maxPages=30 sourceId="n8n" name="n8n"
# React (needs Playwright for JS rendering)
docs_add_url url="https://react.dev/learn" usePlaywright=true recursive=true maxPages=30 sourceId="react" name="React"
# Vue.js
docs_add_url url="https://vuejs.org/guide/introduction.html" recursive=true maxPages=30 sourceId="vuejs" name="Vue.js"
# Tailwind CSS
docs_add_url url="https://tailwindcss.com/docs/installation" recursive=true maxPages=50 sourceId="tailwind" name="Tailwind CSS"Search Examples
# Search all documentation
docs_search query="authentication"
# Search specific source
docs_search query="middleware" sourceId="expressjs"
# Search with limit
docs_search query="hooks" limit=5
# Search for error handling
docs_search query="error handling"Import API Documentation
# From OpenAPI JSON
docs_add_openapi url="https://petstore.swagger.io/v2/swagger.json" sourceId="petstore"
# From Swagger UI page
docs_add_swagger url="https://api.example.com/swagger-ui"
# With authentication
docs_auth action="add" host="api.mycompany.com" type="bearer" token="my-api-key"
docs_add_openapi url="https://api.mycompany.com/openapi.json" sourceId="internal-api"Migrating to Another Device
Option 1: Copy Documentation (Recommended)
Copy the entire docs directory to your new device:
# On old device - compress docs
cd ~/.config/opencode
tar -czvf docs-backup.tar.gz docs/
# Transfer docs-backup.tar.gz to new device
# On new device - extract docs
mkdir -p ~/.config/opencode
cd ~/.config/opencode
tar -xzvf docs-backup.tar.gzOption 2: Re-scrape Documentation
On the new device, after installation:
# Re-add all your documentation sources
docs_add_url url="https://nextjs.org/docs" recursive=true maxPages=50
docs_add_url url="https://expressjs.com/en/starter/installing.html" recursive=true maxPages=30
# ... etcFull Migration Checklist
Clone the repository on the new device:
git clone https://github.com/salmenkhelifi1/opencode-docs.git cd opencode-docs npm install npm run buildCopy configuration (optional, for credentials):
# Copy credentials file if you have API auth saved scp old-device:~/.config/opencode/docs/credentials.json ~/.config/opencode/docs/Copy documentation or re-scrape:
# Copy existing docs scp -r old-device:~/.config/opencode/docs ~/.config/opencode/ # OR re-scrape (see examples above)Configure your AI assistant (OpenCode, Claude Desktop, etc.)
Test:
docs_list docs_search query="test"
Storage Location
Documentation is stored in ~/.config/opencode/docs/:
~/.config/opencode/docs/
├── manifest.json # Index of all sources and pages
├── credentials.json # Saved API credentials (if any)
├── nextjs/ # Source directory
│ ├── docs.md
│ ├── docs-app-getting-started.md
│ └── ...
├── expressjs/
│ └── ...
└── nodejs/
└── ...Supported Documentation Sites
The scraper includes optimized selectors for:
Framework | Notes |
Docusaurus | React docs, many OSS projects |
Nextra | Next.js docs |
GitBook | Many startups use this |
ReadTheDocs | Python projects |
VuePress/VitePress | Vue.js ecosystem |
MkDocs | Material for MkDocs |
Generic HTML | Works with most sites |
For JavaScript-heavy sites, enable Playwright with usePlaywright=true.
Docker
Build the Image
docker build -t opencode-docs .Run with Volume Mount
docker run -v ~/.config/opencode/docs:/root/.config/opencode/docs opencode-docsDocker Compose
version: '3.8'
services:
opencode-docs:
build: .
volumes:
- ~/.config/opencode/docs:/root/.config/opencode/docs
stdin_open: true
tty: trueTroubleshooting
Common Issues
"Playwright is not installed"
npm install playwright
npx playwright install chromium"Failed to fetch URL: 403 Forbidden"
Some sites block scrapers. Try:
Using Playwright:
usePlaywright=trueAdding a delay between requests (automatic in recursive mode)
"No content extracted"
The site might use JavaScript rendering. Try:
docs_add_url url="..." usePlaywright=true"Command not found: docs_list"
The MCP server isn't configured. Check:
The path in your config is correct
The project is built (
npm run build)Restart your AI assistant
Docs directory not found
Create it manually:
mkdir -p ~/.config/opencode/docsDebug Mode
Run the server directly to see logs:
node /path/to/opencode-docs/dist/index.jsDevelopment
Run in Development Mode
npm run devWatch Mode
npm run watchClean Build
npm run clean && npm run buildProject Structure
opencode-docs/
├── src/
│ ├── index.ts # MCP server entry point
│ ├── types.ts # TypeScript types
│ ├── services/
│ │ ├── scraper.ts # HTML to Markdown conversion
│ │ ├── crawler.ts # Sitemap and recursive crawling
│ │ ├── storage.ts # File system management
│ │ ├── search.ts # FlexSearch integration
│ │ └── credentials.ts # Auth credential management
│ └── tools/
│ ├── docs-add-url.ts
│ ├── docs-add-sitemap.ts
│ ├── docs-search.ts
│ └── ... (other tools)
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.mdLicense
MIT
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Changelog
v1.1.0
Added Playwright support for JS-rendered pages
Added recursive crawling with link discovery
Added
docs_updatetool for refreshing documentationAdded
docs_previewtool for testing scrapesEnhanced content selectors for Docusaurus, Nextra, GitBook, etc.
Smart content detection with text density scoring
Improved noise filtering (removes nav, breadcrumbs, edit links)
Metadata extraction (description, keywords, author, lastModified)
Title deduplication
v1.0.0
Initial release
Basic scraping with cheerio
Sitemap crawling
OpenAPI/Swagger import
Full-text search
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/salmenkhelifi1/opencode-docs'
If you have feedback or need assistance with the MCP directory API, please join our Discord server