web-docs-mcp

web-docs-mcp

A local-first MCP server for web search and documentation fetching, providing free DuckDuckGo search, URL-to-markdown conversion, and library docs from npm, PyPI, crates.io, Go, and GitHub with caching.

Category
访问服务器

README

web-docs-mcp

Local MCP server for Kilo Code / Cline / Claude Desktop — free web search + library docs fetcher with local-first caching.

Features

  • 🔍 web_search — Free DuckDuckGo HTML search (no API key required)
  • 🌐 fetch_url — Fetch any URL and convert to clean markdown (cached locally)
  • 📚 lib_docs — Auto-fetch README/docs from npm, PyPI, crates.io, Go, or GitHub
  • 📖 search_docs — Language & API documentation search biased to official docs (MDN, docs.python.org, etc.)
  • 📂 list_docs — Browse and search your local docs/ folder first (local-first approach)

Installation

npm install
npm run build

Usage

As MCP Server

Add to your MCP client configuration (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "web-docs-mcp": {
      "command": "node",
      "args": ["/path/to/web-docs-mcp/build/index.js"],
      "env": {
        "DOCS_DIR": "/path/to/your/docs",
        "CACHE_TTL_HOURS": "168",
        "DEFAULT_SAVE_TO_DOCS": "true"
      }
    }
  }
}

Direct Execution

# Development mode
npm run dev

# Production mode
npm run start

# Build
npm run build

# Clean build artifacts
npm run clean

Configuration

All settings are configurable via environment variables:

Variable Default Description
DOCS_DIR ./docs Directory where fetched markdown docs are saved
CACHE_DIR ./.cache/web-docs Directory for TTL cache (raw HTML + fetched markdown)
CACHE_TTL_HOURS 168 (7 days) Cache time-to-live in hours
HTTP_TIMEOUT_MS 20000 HTTP timeout per request in milliseconds
USER_AGENT Chrome-like UA User-Agent sent to upstream servers
DEFAULT_SAVE_TO_DOCS true Default behavior for saving docs to docs/ folder
DISABLE_CACHE false Disable caching (useful for debugging)
GITHUB_TOKEN none Optional GitHub token to lift rate limits

Tools

web_search

Free web search via DuckDuckGo HTML. Returns a list of {title, url, snippet}.

{
  query: string,      // Search query
  limit?: number      // Number of results (default: 8, max: 20)
}

fetch_url

Fetch a single URL and return clean markdown. Handles HTML (via turndown+GFM), JSON (pretty-printed), and plain text.

{
  url: string,                    // URL to fetch
  save?: boolean,                 // Save to docs/ folder (default: true)
  subdir?: string                 // Subdirectory under docs/ (optional)
}

lib_docs

Fetch README/docs for a library by name. Tries npm → PyPI → crates.io → Go → GitHub automatically.

{
  name: string,                   // Library name (e.g., "react", "numpy", "serde", "owner/repo")
  save?: boolean,                 // Save to docs/libraries/ (default: true)
  subdir?: string                 // Custom subdirectory (optional)
}

search_docs

Language & API documentation search. Biases results to official docs sites. LOCAL-FIRST: searches your docs/ folder first.

{
  query: string,                  // Search query
  language?: string,              // Programming language (e.g., "python", "rust", "go")
  fetch_top?: boolean,            // Fetch full markdown of top result (default: false)
  save?: boolean,                 // Save fetched content (default: true)
  subdir?: string                 // Subdirectory under docs/api/ (optional)
}

list_docs

Browse and search the local docs/ folder. Three modes:

  1. No args = list all saved docs
  2. { query } = keyword search across docs/
  3. { path } = read full body of a specific doc by relative path or slug
{
  query?: string,                 // Keyword search (optional)
  path?: string                   // Relative path to specific doc (optional)
}

Directory Structure

web-docs-mcp/
├── src/
│   ├── index.ts          # Main entry point
│   ├── config.ts         # Configuration & env vars
│   ├── lib/              # Core utilities
│   │   ├── anubis.ts     # Anubis PoW solver (anti-bot bypass)
│   │   ├── cache.ts      # Local caching logic
│   │   ├── ddg.ts        # DuckDuckGo search
│   │   ├── fetcher.ts    # HTTP fetching
│   │   ├── html-to-md.ts # HTML to markdown conversion
│   │   └── ...
│   └── tools/            # MCP tool implementations
│       ├── web_search.ts
│       ├── fetch_url.ts
│       ├── lib_docs.ts
│       ├── search_docs.ts
│       └── list_docs.ts
├── docs/                 # Saved documentation (created on demand)
│   ├── libraries/        # Library READMEs
│   ├── api/              # API documentation
│   ├── guides/           # Tutorials & how-tos
│   └── ...
├── .cache/               # TTL cache (auto-managed)
├── build/                # Compiled JavaScript
└── package.json

Supported Ecosystems

  • npm — JavaScript/TypeScript packages
  • PyPI — Python packages
  • crates.io — Rust crates
  • pkg.go.dev — Go modules
  • GitHub — Any repository (owner/repo format)

Local-First Approach

This server implements a local-first strategy:

  1. All fetched content is cached with configurable TTL
  2. search_docs checks your local docs/ folder before going to the web
  3. Subsequent calls return cached results in <5ms instead of re-fetching
  4. Perfect for offline work or rate-limited environments

Requirements

  • Node.js >= 18.17
  • npm or yarn

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Troubleshooting

Empty search results from DuckDuckGo

The User-Agent might be blocked. Try setting a custom one:

export USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"

Rate limiting on GitHub

Add a GitHub token to lift the 60 req/hour anonymous limit:

export GITHUB_TOKEN=your_token_here

Cache issues

To disable cache temporarily:

export DISABLE_CACHE=true

Or clean the cache:

npm run clean

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

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

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选