# cf-autorag-mcp
## 基本信息
- Slug: `noops888-cf-autorag-mcp`
- Source: modelscope
- Publisher: @noops888/cf-autorag-mcp
- Categories: rag-systems / vector-databases
- Hosted: No
- License: MIT License
- Source URL: https://www.modelscope.cn/mcp/servers/@noops888/cf-autorag-mcp
## 简介
暂无描述。
## 安装提示

```bash
git clone <repository-url> cd cf-autorag-mcp
```

## MCP Server 详情

# Cloudflare AutoRAG MCP Server

A Model Context Protocol (MCP) server that provides search capabilities for Cloudflare AutoRAG instances. This server enables AI assistants like Claude to directly search and query your AutoRAG knowledge base using three distinct search methods.

## Features

-  **Basic Search** - Vector similarity search without query rewriting or answer generation
-  **Rewrite Search** - Vector search with AI query rewriting but no answer generation (returns document chunks only)
-  **AI Search** - Full AI-powered search with optional AI response and configurable query rewriting
-  **Configurable Parameters** - Support for `score_threshold` (default: 0.5) and `max_num_results` (1-50, default: 10)
-  **Pagination Support** - AI search supports cursor-based pagination for large result sets (v1.2.0+)
-  **Multi-AutoRAG Support** - Manage and search across multiple AutoRAG instances (v2.0.0+)
-  **Remote Deployment** - Runs on Cloudflare Workers for scalability
-  **MCP Compatible** - Works with Claude Desktop and other MCP clients

## Tools

### `autorag_basic_search`
Performs a basic vector similarity search in your Cloudflare AutoRAG index without AI query rewriting or answer generation. Returns raw document chunks only.

**Parameters:**
- `query` (string, required) - The search query text (max 10,000 characters)
- `score_threshold` (number, optional) - Minimum similarity score threshold (0.0-1.0, default: 0.5)
- `max_num_results` (number, optional) - Maximum number of results to return (1-50, default: 10)
- `autorag_name` (string, optional) - Name of the AutoRAG instance to use (defaults to configured default)

### `autorag_rewrite_search`
Performs a vector search with AI query rewriting but **no answer generation**. Uses Cloudflare's `search()` method with configurable `rewrite_query` for better semantic matching and returns only document chunks.

**Parameters:**
- `query` (string, required) - The search query text (max 10,000 characters)
- `score_threshold` (number, optional) - Minimum similarity score threshold (0.0-1.0, default: 0.5)
- `max_num_results` (number, optional) - Maximum number of results to return (1-50, default: 10)
- `rewrite_query` (boolean, optional) - Whether to rewrite query for better matching (default: true)
- `autorag_name` (string, optional) - Name of the AutoRAG instance to use (defaults to configured default)

### `autorag_ai_search`
Performs AI-powered search using Cloudflare's `aiSearch()` method with optional AI-generated response. Returns document chunks and optionally an AI answer based on the `include_ai_response` parameter. Supports pagination for large result sets.

**Parameters:**
- `query` (string, required) - The search query text (max 10,000 characters)
- `score_threshold` (number, optional) - Minimum similarity score threshold (0.0-1.0, default: 0.5)
- `max_num_results` (number, optional) - Maximum number of results to return (1-50, default: 10)
- `rewrite_query` (boolean, optional) - Whether to rewrite the query for better semantic matching (default: true)
- `include_ai_response` (boolean, optional) - Whether to include the AI-generated response in the output (default: false)
- `cursor` (string, optional) - Pagination cursor from previous response to fetch next page of results (v1.2.0+)
- `autorag_name` (string, optional) - Name of the AutoRAG instance to use (defaults to configured default)

**Response includes:**
- `data` - Array of source document chunks with scores and metadata (always included)
- `response` - AI-generated answer based on retrieved documents (only when `include_ai_response: true`)
- `has_more` - Boolean indicating if more results are available
- `next_page` - Cursor token for fetching the next page (when `has_more` is true)
- `nextCursor` - MCP-compliant cursor field (mirrors `next_page` value)

### `list_autorags` (v2.0.0+)
Lists all available AutoRAG instances configured in the server.

**Parameters:** None

**Response includes:**
- `autorags` - Array of AutoRAG instances with name, description, and is_default flag
- `total` - Total number of configured AutoRAG instances
- `default` - Name of the default AutoRAG instance

### `get_current_autorag` (v2.0.0+)
Gets information about the currently configured default AutoRAG instance.

**Parameters:** None

**Response includes:**
- `current_autorag` - Name of the current default AutoRAG instance
- `description` - Description of the instance
- `is_default` - Always true for this endpoint

## Prerequisites

1. **Cloudflare Account** with AutoRAG access
2. **AutoRAG Instance** - Created and indexed in your Cloudflare account
3. **Wrangler CLI** - For deployment (`npm install --save-dev wrangler`)

## Deployment

1. **Clone the repository:**
   ```bash
   git clone <repository-url>
   cd cf-autorag-mcp
   ```

2. **Install dependencies:**
   ```bash
   npm install
   ```

3. **Configure your AutoRAG instance:**
   Edit `wrangler.toml` and update the configuration:
   
   For a single AutoRAG instance:
   ```toml
   [vars]
   AUTORAG_NAME = "your-autorag-instance-name"
   ```
   
   For multiple AutoRAG instances:
   ```toml
   [vars]
   AUTORAG_INSTANCES = "instance1,instance2,instance3"
   AUTORAG_DESCRIPTIONS = "Description 1,Description 2,Description 3"
   ```

4. **Deploy to Cloudflare Workers:**
   ```bash
   npx wrangler deploy
   ```

   This will output your Worker URL, which you'll need for the MCP client configuration.

## Claude Desktop Configuration

To use this MCP server with Claude Desktop, add the following configuration to your Claude Desktop config file:

### macOS
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:

### Windows
Edit `%APPDATA%/Claude/claude_desktop_config.json`:

### Configuration
```json
{
  "mcpServers": {
    "cf-autorag-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://your-worker-url.workers.dev/"
      ]
    }
  }
}
```

**Replace `https://your-worker-url.workers.dev…

