Wso2 Docs Mcp Server

io.github.iamvirul由 GitHub 帳號 iamvirul 發布v1.3.14更新於 Oct 31, 2026

Semantic search over WSO2 docs (APIM, IS, MI, Choreo, Ballerina) via RAG and pgvector.

已驗證STDIO僅桌面資料庫知識與記憶

概覽

AI 產生的概覽

本機 MCP 伺服器,透過 pgvector 的 RAG 讓助理對 WSO2 文件(APIM、MI、BI、Choreo、IS、Ballerina)進行語意搜尋。

可以做什麼
  • 在所有已建立索引的產品中做語意搜尋,可依產品與結果數量篩選
  • 在單一產品的指南內搜尋,支援 APIM、MI、BI、Choreo、IS、Ballerina 與 WSO2 Library
  • 跨產品做概念性查詢,回傳最相關的前幾筆內容
  • 列出支援的產品及其 ID 與文件基礎網址
  • 回傳結果包含標題、摘要片段、來源連結、產品、章節與相關性分數
適用情境
適合使用 WSO2 中介軟體、希望助理依據官方文件而非憑空猜測來回答問題或撰寫說明的情境。適用於 Claude Desktop、Claude Code、Cursor、VS Code 等本機桌面用戶端。
執行需求
以 npm 套件形式透過 stdio 在本機執行,需要 Node.js 20 以上版本。需要具備 pgvector 的 PostgreSQL 資料庫(通常以隨附的 Docker Compose 啟動),並提供 DATABASE_URL 連線字串。使用前須先以內附的遷移與抓取指令建立索引。嵌入預設使用本機 Ollama,無法使用時改以行程內 HuggingFace ONNX 模型處理;改用雲端嵌入需設定 GEMINI_API_KEY、OPENAI_API_KEY 或 VOYAGE_API_KEY。
安裝前請注意
此專案為非官方社群專案,與 WSO2 無隸屬關係,也未獲其背書。DATABASE_URL 是可能含有資料庫帳密的連線字串,請勿放入共用設定。選擇雲端嵌入服務會把文件文字傳送給該服務,並需要對應的 API 金鑰。抓取與遷移指令會寫入資料庫並可能重建索引,首次執行還會下載嵌入模型。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Wso2 Docs Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

WSO2 Docs MCP Server

[npm version] [License]

"This is an unofficial community project. Not affiliated with or endorsed by WSO2."

A production-ready Model Context Protocol (MCP) server that provides AI assistants (Claude Desktop, Claude Code, Cursor, VS Code) with semantic search over WSO2 documentation via Retrieval-Augmented Generation (RAG).

Under the hood, it uses a blazing-fast dual-ingestion engine:

  • GitHub Native: Fetches raw Markdown directly from WSO2's public GitHub repositories via the Git Trees API (avoids web-scraping noise and rate limits)
  • Web Crawl Fallback: For products without dedicated GitHub docs repos (like the WSO2 Library)

Architecture

[System Architecture]

Documentation Sources

ProductIDURL
API Managerapimhttps://apim.docs.wso2.com
Micro Integratormihttps://mi.docs.wso2.com/en/4.4.0
Ballerina Integratorbihttps://bi.docs.wso2.com
Choreochoreohttps://wso2.com/choreo/docs
Identity Serverishttps://is.docs.wso2.com/en/latest
Ballerinaballerinahttps://ballerina.io/learn
WSO2 Librarylibraryhttps://wso2.com/library

Prerequisites

  • Node.js ≥ 20
  • Docker (for pgvector)
  • Embeddings - no API key required by default:
    • Ollama (recommended) - runs locally, model auto-downloaded on first run
    • If Ollama is not running, the server automatically falls back to HuggingFace ONNX (in-process, also downloads automatically)
    • Cloud providers are also supported: OpenAI, Google Gemini, Voyage AI

Quick Start

Choose the setup path that fits your use case:


Install from npm

Install the package globally to get the wso2-docs-mcp-server, wso2-docs-crawl, and wso2-docs-migrate commands available system-wide:

bash
npm install -g wso2-docs-mcp-server

Prefer no global install? You can use npx wso2-docs-mcp-server, npx wso2-docs-crawl, and npx wso2-docs-migrate in every step below - just replace the bare command with its npx equivalent.

1. Start pgvector

Download the docker-compose.yml and start the database:

bash
curl -O https://raw.githubusercontent.com/iamvirul/wso2-docs-mcp-server/main/docker-compose.ymldocker compose up -d
2. Start Ollama (optional but recommended)

Install Ollama and pull the default embedding model:

bash
ollama pull nomic-embed-textollama serve

No Ollama? Skip this step. The server automatically falls back to HuggingFace ONNX - model downloads on first use with no extra setup.

3. Run database migration
bash
DATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  wso2-docs-migrate

Run migration again whenever you change EMBEDDING_DIMENSIONS (i.e. switch embedding provider). The script detects and handles dimension changes automatically.

4. Index WSO2 documentation
bash
# Index all products (first run downloads the embedding model automatically)DATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  wso2-docs-crawl
# Index a single product (faster, great for testing)DATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  wso2-docs-crawl --product ballerina --limit 20
# Force re-index even unchanged pagesDATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  wso2-docs-crawl --force

Available product IDs: apim, mi, bi, choreo, is, ballerina, library

5. Configure your AI client

The MCP server is launched on demand by your AI client - no background process needed.

Claude Desktop - edit ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "wso2-docs": {      "command": "wso2-docs-mcp-server",      "env": {        "DATABASE_URL": "postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs",        "EMBEDDING_PROVIDER": "ollama"      }    }  }}

Claude Code - run once in your terminal:

bash
claude mcp add wso2-docs \  --transport stdio \  -e DATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  -e EMBEDDING_PROVIDER="ollama" \  -- wso2-docs-mcp-server
# Verifyclaude mcp list

Cursor - create .cursor/mcp.json in your project root:

json
{  "mcpServers": {    "wso2-docs": {      "command": "wso2-docs-mcp-server",      "env": {        "DATABASE_URL": "postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs",        "EMBEDDING_PROVIDER": "ollama"      }    }  }}

VS Code - create .vscode/mcp.json:

json
{  "servers": {    "wso2-docs": {      "type": "stdio",      "command": "wso2-docs-mcp-server",      "env": {        "DATABASE_URL": "postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs",        "EMBEDDING_PROVIDER": "ollama"      }    }  }}

Using npx instead of global install? Replace "command": "wso2-docs-mcp-server" with "command": "npx" and add "args": ["-y", "wso2-docs-mcp-server"].

Cloud embedding provider? Add the key to env, e.g. "EMBEDDING_PROVIDER": "openai", "OPENAI_API_KEY": "sk-...".


Clone and build

1. Clone and install
bash
git clone https://github.com/iamvirul/wso2-docs-mcp-server.gitcd wso2-docs-mcp-servernpm install
2. Start Ollama (optional but recommended)

Install Ollama and start it:

bash
ollama serve

No Ollama? Skip this step. The server detects Ollama is not running and automatically falls back to HuggingFace ONNX inference - the model downloads on first use with no extra setup.

3. Configure environment
bash
cp .env.example .env# Defaults work out of the box with Ollama.# Only edit if using a cloud provider (OpenAI / Gemini / Voyage).
4. Start pgvector
bash
docker compose up -d# pgAdmin available at http://localhost:5050 ([email protected] / admin)
5. Run database migration
bash
npm run db:migrate

Note: Run migration again whenever you change EMBEDDING_DIMENSIONS (i.e. switch embedding provider). The script detects and handles dimension changes automatically.

6. Index documentation
bash
# Index all products# On first run the embedding model is downloaded automatically (Ollama or HuggingFace)npm run crawl
# Index a single product (faster, great for testing)npm run crawl -- --product ballerina --limit 20
# Force re-index even unchanged pagesnpm run crawl -- --force
7. Build and start the MCP server
bash
npm run buildnpm start

For development (no build step):

bash
npm run dev
8. Configure your AI client

Replace /ABSOLUTE/PATH/TO/wso2-docs-mcp-server with your actual clone path.

Claude Desktop - edit ~/Library/Application Support/Claude/claude_desktop_config.json:

json
{  "mcpServers": {    "wso2-docs": {      "command": "node",      "args": ["/ABSOLUTE/PATH/TO/wso2-docs-mcp-server/dist/src/index.js"],      "env": {        "DATABASE_URL": "postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs",        "EMBEDDING_PROVIDER": "ollama"      }    }  }}

Claude Code:

bash
claude mcp add wso2-docs \  --transport stdio \  -e DATABASE_URL="postgresql://wso2mcp:wso2mcp@localhost:5432/wso2docs" \  -e EMBEDDING_PROVIDER="ollama" \  -- node "/ABSOLUTE/PATH/TO/wso2-docs-mcp-server/dist/src/index.js"
# Verifyclaude mcp list

See config-examples/claude_code.sh for a convenience script.

Cursor - create .cursor/mcp.json - see config-examples/cursor_mcp.json.

VS Code - create .vscode/mcp.json - see config-examples/vscode_mcp.json.


MCP Tools

ToolDescription
search_wso2_docsSemantic search across all products. Optional product and limit filters.
get_wso2_guideSearch within a specific product (apim, mi, bi, choreo, is, ballerina, library).
explain_wso2_conceptBroad concept search across all products, returns 8 top results.
list_wso2_productsReturns all supported products with IDs and base URLs.

Example response

json
[  {    "title": "Deploying WSO2 API Manager",    "snippet": "WSO2 API Manager can be deployed in various topologies…",    "source_url": "https://apim.docs.wso2.com/en/latest/install-and-setup/...",    "product": "apim",    "section": "Deployment Patterns",    "score": 0.8712  }]

Local Embeddings

The default EMBEDDING_PROVIDER=ollama runs entirely on your machine with no API key. The startup sequence is:

Is Ollama running?├── Yes → Is model present?│         ├── Yes → Ready (instant)│         └── No  → Pull via Ollama (streamed, runs once)└── No  → Download ONNX model from HuggingFace Hub (~250 MB, cached after first run)           and run inference in-process via @huggingface/transformers

Both paths use nomic-embed-text / Xenova/nomic-embed-text-v1 by default and produce identical 768-dim vectors, so you can switch between them without re-indexing.

Hardware acceleration (HuggingFace ONNX fallback)

When Ollama is not available, the server auto-detects the best compute backend:

MachineDetectionONNX dtypeBatch sizeThroughput
Apple Silicon (M1/M2/M3/M4)process.arch === 'arm64'q8 INT832~9 ms/chunk
NVIDIA GPUnvidia-smi probefp3264GPU-dependent
All othersfallbackq8 INT816~10 ms/chunk

Why q8 on Apple Silicon instead of CoreML/Metal? CoreML compiles Metal shaders on first use (~20 min cold-start). For the typical chunk sizes produced by this server (6–20 chunks per page), the CPU↔GPU transfer overhead eliminates any inference gain. INT8 quantized inference on ARM NEON SIMD is consistently ~100× faster than fp32 CPU with zero cold-start cost.

Benchmark (Apple M-chip, Xenova/nomic-embed-text-v1):

fp32 CPU (before): ~1,000 ms/chunk   (68 chunks ≈ 68 s of embedding)q8  ARM NEON:          ~9 ms/chunk   (68 chunks ≈  0.6 s of embedding)  ← ~100× speedup

Note: For small crawls (≤ 10 pages) total wall-clock time is dominated by network I/O (HTTPS fetches to docs sites), so the end-to-end improvement is modest. The embedding speedup becomes significant at scale - crawling 500+ pages where embedding previously accounted for hours of runtime. For best crawl performance, run Ollama (ollama serve) which parallelises inference natively and has no per-chunk overhead.


Environment Variables

Core

VariableDefaultDescription
DATABASE_URL-PostgreSQL connection string (required)
EMBEDDING_PROVIDERollamaollama | openai | gemini | voyage
EMBEDDING_DIMENSIONS768Must match model output dimensions
CRAWL_CONCURRENCY5Concurrent HTTP requests during crawl
CHUNK_SIZE800Approximate tokens per chunk
CHUNK_OVERLAP100Overlap tokens between chunks
CACHE_TTL_SECONDS3600In-memory query cache TTL
TOP_K_RESULTS10Default search result count

Ollama (default)

VariableDefaultDescription
OLLAMA_BASE_URLhttp://localhost:11434Ollama server URL
OLLAMA_EMBEDDING_MODELnomic-embed-textModel pulled and used via Ollama
HUGGINGFACE_EMBEDDING_MODELXenova/nomic-embed-text-v1ONNX fallback when Ollama is not running

Cloud providers

VariableDefaultDescription
OPENAI_API_KEY-Required if EMBEDDING_PROVIDER=openai
OPENAI_EMBEDDING_MODELtext-embedding-3-smallOpenAI model
GEMINI_API_KEY-Required if EMBEDDING_PROVIDER=gemini
GEMINI_EMBEDDING_MODELtext-embedding-004Gemini model
VOYAGE_API_KEY-Required if EMBEDDING_PROVIDER=voyage
VOYAGE_EMBEDDING_MODELvoyage-3Voyage model

Embedding dimension reference

ProviderModelDimensions
Ollama / HuggingFacenomic-embed-text / Xenova/nomic-embed-text-v1768 (default)
Ollama / HuggingFacemxbai-embed-large / Xenova/mxbai-embed-large-v11024
Ollama / HuggingFaceall-minilm / Xenova/all-MiniLM-L6-v2384
OpenAItext-embedding-3-small1536
OpenAItext-embedding-3-large3072
Geminitext-embedding-004768
Voyagevoyage-31024
Voyagevoyage-3-lite512

Scheduled Re-indexing

bash
# Run a one-off re-index (checks hashes, skips unchanged pages)npm run reindex
# Or from the project directory using node-cron (runs daily at 2 AM)DATABASE_URL=... node -e "  const { ReindexJob } = require('./dist/jobs/reindexDocs');  const job = new ReindexJob();  job.initialize().then(() => job.scheduleDaily());"

Project Structure

src/  config/          env.ts · constants.ts  vectorstore/     pgvector.ts · schema.sql  ingestion/       crawler.ts · parser.ts · githubFetcher.ts · markdownParser.ts · chunker.ts · embedder.ts  server/          mcpServer.ts · toolRegistry.ts  jobs/            reindexDocs.ts  index.tsscripts/  crawl.ts         CLI ingestion pipeline  migrate.ts       Dynamic schema migrationconfig-examples/   claude_desktop.json · claude_code.sh · cursor_mcp.json · vscode_mcp.jsondocker-compose.yml.env.example

Development

bash
# Type-checknpx tsc --noEmit
# Run crawl with tsx (no build needed)npm run crawl -- --product ballerina --limit 5
# Run server in dev modenpm run dev

來源:README.md,提交 92337d2

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未能啟動。

版本歷史

3
  1. v1.3.14最新Oct 31, 2026
  2. v1.3.13Oct 16, 2026
  3. v1.2.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分