mcp-wiki

mcp-wiki

Exposes any project wiki to AI assistants with features like fuzzy search, content search, lazy loading, and auto-reload.

Category
访问服务器

README

Wiki Explorer MCP Server

A generic MCP (Model Context Protocol) server that exposes any project wiki to AI assistants, enabling contextual wiki lookups during development sessions.

Features

  • Lazy loading — indexes headings once, loads content on-demand via byte positions
  • Auto-reload — watches the wiki file or markdown directory for changes with debouncing
  • Fuzzy search — handles typos and partial matches via levenshtein distance
  • Content search — searches within section content, not just headings
  • Custom anchors — use {#anchor} syntax in headings for stable TOC links
  • Directory mode — index entire markdown directory trees with file-prefixed keys
  • Legacy key support — backward-compatible lookup of heading-only keys
  • Heading hierarchy — tracks full breadcrumb path for nested sections
  • Batch fetch — retrieve multiple sections in one call (max 20)
  • Smart suggestions — returns similar keys when a section isn't found
  • Path safety — validates markdown sources and safe path resolution
  • Graceful shutdown — handles SIGINT/SIGTERM, cleans up watchers
  • Structured logging — configurable log levels for debugging

Setup

# 1. Install dependencies
npm install

# 2. Configure wiki path
cp .env.example .env

# 3. Run tests
npm test

.env

WIKI_PATH=path/to/your/wiki-source  # file (.md/.markdown) or directory
LOG_LEVEL=info  # debug, info, warn, error

MCP Tools

Tool Description Parameters
list_wiki List all available wiki sections none
browse_wiki Browse sections by topic/parent topic (string, optional)
search_wiki Search sections by keyword query (string), fuzzy (boolean)
get_wiki_section Get a single section's content key (string), offset (number), limit (number)
get_wiki_sections Get multiple sections at once keys (string[], max 20)

Connecting to AI Assistants

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "wiki-explorer": {
      "command": "node",
      "args": ["/path/to/wiki-explorer/index.js"],
      "env": {
        "WIKI_PATH": "/path/to/your/docs/wiki"
      }
      }
  }
}

Cursor

Add to Cursor MCP settings:

{
  "mcpServers": {
    "wiki-explorer": {
      "command": "node",
      "args": ["/path/to/wiki-explorer/index.js"],
      "env": {
        "WIKI_PATH": "/path/to/your/docs/wiki"
      }
      }
  }
}

VS Code (GitHub Copilot)

Add to .vscode/mcp.json:

{
  "servers": {
    "wiki-explorer": {
      "command": "node",
      "args": ["/path/to/wiki-explorer/index.js"],
      "env": {
        "WIKI_PATH": "/path/to/your/docs/wiki"
      }
      }
  }
}

Running

# Start MCP server (stdio transport)
npm start

# Debug mode
LOG_LEVEL=debug npm start

Architecture

index.js          → MCP server + tool registration + signal handlers
utils.js          → WikiParser class (indexing, search, content extraction)
logger.js         → Structured logging with configurable levels
test.js           → 67 assertions covering all functionality
.env              → WIKI_PATH, LOG_LEVEL configuration

WikiParser Class

  • Constructor — validates file/directory source, loads markdown docs, builds heading index with byte positions
  • search(query, { fuzzy, limit }) — find sections by keyword
  • findSimilar(key) — get similar keys via levenshtein distance
  • getSection(key) — retrieve content for a single section
  • getSections(keys) — batch retrieve multiple sections
  • reload() — re-read file and rebuild index
  • close() — stop file watcher

Key Compatibility

  • Canonical keys in directory mode are prefixed by file slug (e.g. user-wiki-approval-workflow-deep-dive)
  • Legacy heading-only keys are still accepted in getMeta/getSection for backward compatibility
  • Ambiguous legacy keys require suffixed form (-1, -2) to resolve deterministically
  • Search accepts legacy key queries but returns canonical keys

Custom Anchors

Headings can include a custom anchor using {#anchor-name} syntax at the end of the heading text:

## Backend Architecture {#portage-backend-architecture}

This creates a stable anchor that can be used in table of contents or direct links. The anchor is stripped from the displayed title but registered as a legacy alias for lookup.

Content Search

Search matches both heading text and section content. Results are prioritized:

  1. Header matches — exact or fuzzy match in heading text
  2. Content matches — keyword found within section body

This ensures the most relevant sections appear first.

Security

  • Source validation (.md/.markdown file or directory)
  • Safe path resolution via path.resolve + fs stat checks
  • File size cap (50MB default)
  • Key format validation (lowercase alphanumeric + hyphens)
  • Batch request limits (max 20 keys)

Graceful Shutdown

Handles SIGINT, SIGTERM, uncaughtException, and unhandledRejection. Cleans up file watchers and exits cleanly.

Testing

npm test

Covers: initialization, path validation, directory mode, search (headers + content), fuzzy search, findSimilar, meta, sections, batch fetch, boundaries, reload, file watcher, key format validation, custom anchors, legacy key resolution, and cleanup.

CI/CD

GitHub Actions runs tests on Node 20 and 22 for every push/PR to main. See .github/workflows/ci.yml.

推荐服务器

Baidu Map

Baidu Map

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

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

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

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

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

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

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

官方
精选
本地
TypeScript
VeyraX

VeyraX

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

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

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

官方
精选