# openclaw-docs-mcp

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A Model Context Protocol (MCP) server for searching and retrieving documentation from [OpenClaw](https://docs.openclaw.ai/).

## Features

- 🔍 **Search documentation** - Full-text search across all OpenClaw docs
- 📄 **Retrieve pages** - Get complete content of any documentation page
- 📋 **List all pages** - Browse the full documentation structure
- ⚡ **Fast caching** - Built-in caching for improved performance

## Installation

### From GitHub

```bash
npm install -g github:XXXiby/openclaw-docs-mcp
```

### Local Installation

```bash
git clone https://github.com/XXXiby/openclaw-docs-mcp.git
cd openclaw-docs-mcp
npm install
```

## Usage

### As MCP Server

Run directly:

```bash
openclaw-docs-mcp
```

Or with npx:

```bash
npx github:XXXiby/openclaw-docs-mcp
```

### VS Code Configuration

Add to your VS Code `mcp.json` (`~/.config/Code/User/mcp.json` or `%APPDATA%\Code\User\mcp.json`):

```json
{
  "servers": {
    "openclaw-docs": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "github:XXXiby/openclaw-docs-mcp"]
    }
  }
}
```

For WSL users on Windows:

```json
{
  "servers": {
    "openclaw-docs": {
      "type": "stdio",
      "command": "wsl",
      "args": ["-e", "npx", "-y", "github:XXXiby/openclaw-docs-mcp"]
    }
  }
}
```

### Claude Desktop Configuration

Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS):

```json
{
  "mcpServers": {
    "openclaw-docs": {
      "command": "npx",
      "args": ["-y", "github:XXXiby/openclaw-docs-mcp"]
    }
  }
}
```

## Available Tools

### search_openclaw_docs

Search OpenClaw documentation for information about a topic.

**Parameters:**
- `query` (string, required): Search query (e.g., "gateway configuration", "telegram channel")
- `maxResults` (number, optional): Maximum results to return (default: 5, max: 20)

**Example:**
```json
{
  "name": "search_openclaw_docs",
  "arguments": {
    "query": "telegram channel setup",
    "maxResults": 5
  }
}
```

### get_openclaw_doc_page

Get the full content of a specific documentation page.

**Parameters:**
- `path` (string, required): Page path (e.g., "/gateway/configuration", "/channels/telegram")

**Example:**
```json
{
  "name": "get_openclaw_doc_page",
  "arguments": {
    "path": "/gateway/configuration"
  }
}
```

### list_openclaw_doc_pages

List all available documentation pages from the sitemap.

**Parameters:** None

**Example:**
```json
{
  "name": "list_openclaw_doc_pages",
  "arguments": {}
}
```

## How It Works

1. Fetches the sitemap from `https://docs.openclaw.ai/sitemap.xml`
2. Parses HTML content using Cheerio to extract text
3. Performs keyword-based relevance scoring for search results
4. Caches results for 5 minutes to improve performance

## Development

```bash
# Clone the repository
git clone https://github.com/XXXiby/openclaw-docs-mcp.git
cd openclaw-docs-mcp

# Install dependencies
npm install

# Run locally
node index.js

# Test tools/list
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | node index.js
```

## License

MIT License - see [LICENSE](LICENSE) for details.

## Related

- [OpenClaw Documentation](https://docs.openclaw.ai/)
- [OpenClaw GitHub](https://github.com/openclaw/openclaw)
- [Model Context Protocol](https://modelcontextprotocol.io/)