Cloudflare Searchのロゴ

Cloudflare Search

コミュニティ
Yrobot

A Powerful Search Server based on Cloudflare Worker, Enhance Your AI Tool with MCP

公開者Yrobot
リポジトリcloudflare-search
言語JavaScript
フォーク
36
スター
45
利用可能なツール
0
通信方式stdio, streamable-http
カテゴリ
ライセンスGPL-3.0
リンク
  • ツールをAIワークフローに接続

    Cloudflare Searchは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには45件のスターと36件のフォークがあります。

Cloudflare Search

English | 中文

An aggregated search API service based on Cloudflare Workers

Supports MCP (Model Context Protocol), giving AI assistants (OpenClaw, Claude Code, Codex, OpenCode) real-time web search capabilities

Deploy to Cloudflare Workers

Features

  • 🔍 Multi-engine Aggregation - Use multiple search engines at the same time (Google, Brave, DuckDuckGo, Bing)
  • 🤖 AI Enhanced (MCP) - Native support for Model Context Protocol, one-click search tool integration for OpenClaw / Claude Code / Codex
  • ⚡ Parallel Search - All search engines are requested concurrently for faster results
  • 🛡️ Fault Tolerance - Failure of a single engine does not affect others; unresponsive engines are automatically marked
  • ⏱️ Timeout Control - Configurable request timeout to avoid long waits
  • 🔒 Token Authentication - Supports token auth to protect the service from abuse
  • 🌍 CORS Support - Full cross-origin resource sharing support
  • 🎨 Web Interface - Provides a clean search UI for easy testing
  • ⚡ Zero-cost Operation - Cloudflare Workers free tier supports 100,000 requests per day

Page Preview

screenshot

MCP Integration: Use in OpenClaw / Claude Code / AI Agents

With MCP (Model Context Protocol), AI assistants can directly call your search service and get real-time search results.

Installation and Configuration

1. Deploy the Service

First, follow the guide to Deploy Cloudflare Search

2. Add MCP Server Configuration

Edit your config file (configuration guide):

  • OpenClaw: ~/.openclaw/openclaw.json
  • Claude Code: ~/.claude/config.json / ~/.claude.json
  • Claude Desktop macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Claude Desktop Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
	"mcpServers": {
		"cloudflare-search": {
			"command": "npx",
			"args": ["-y", "@yrobot/cf-search-mcp"],
			"env": {
				"CF_SEARCH_URL": "https://your-worker.workers.dev",
				"CF_SEARCH_TOKEN": "your-token-here"
			}
		}
	}
}

Environment Variables:

  • CF_SEARCH_URL: Worker deployment URL (required)
  • CF_SEARCH_TOKEN: Auth token (required if your Worker has TOKEN configured)

3. Verify Installation

  • OpenClaw: Run openclaw gateway restart + openclaw mcp list and check that cloudflare-search appears
  • Claude Code:
    • Run /mcp in Claude Code, and you should see the cloudflare-search tool.
    • Or run claude mcp list; seeing cloudflare-search: npx -y @yrobot/cf-search-mcp@latest - ✓ Connected means setup is successful

Installation Methods

Method 1: One-click Deployment (Recommended)

Click the "Deploy to Cloudflare Workers" button above and follow the prompts.

Method 2: Use Wrangler CLI

bash
# 1. Install Wrangler
npm install -g wrangler

# 2. Login to Cloudflare
wrangler login

# 3. Clone the repository
git clone https://github.com/Yrobot/cloudflare-search.git
cd cloudflare-search

# 4. Deploy
wrangler deploy

Method 3: Use Cloudflare Dashboard

  1. Sign in to Cloudflare Dashboard
  2. Go to Workers & Pages
  3. Click Create Application > Create Worker
  4. Click Upload to upload your local code folder
    • Select the cloned cloudflare-search folder
    • Or manually copy worker.js, envs.js, utils/, and other files
  5. Click Save and Deploy

Get Access URL

After deployment, you will get a Worker URL:

https://your-worker-name.your-subdomain.workers.dev

Note: The default domain may not be directly accessible in some regions. It is recommended to bind your own custom domain.

Usage

Method 1: Web Interface

Open your Worker URL directly and enter search keywords in the web UI:

https://$YOUR-DOMAIN/

Method 2: API Request (GET)

Search using query parameters:

bash
# Basic search
curl "https://$YOUR-DOMAIN/search?q=cloudflare"

# Specify search engines
curl "https://$YOUR-DOMAIN/search?q=cloudflare&engines=google,brave"

# Use token authentication (if TOKEN env var is configured)
curl "https://$YOUR-DOMAIN/search?q=cloudflare&token=$YOUR-TOKEN"

Method 3: API Request (POST)

Submit search by POST form:

bash
curl -X POST "https://$YOUR-DOMAIN/search" \
	-d "q=cloudflare" \
	-d "engines=google,brave"
	-d "token=$YOUR-TOKEN" # if TOKEN env var is configured

API Reference

/search Endpoint

Used to execute search queries and return aggregated results.

Request Parameters

ParameterTypeRequiredDescriptionExample
q / querystringyesSearch keywordcloudflare
enginesstringnoSpecify search engines, separated by commasgoogle,brave
tokenstringno/yesAccess token (required when TOKEN env var is configured)$YOUR-TOKEN

Supported Search Engines:

  • google - Google Search (requires API Key configuration)
  • brave - Brave Search
  • duckduckgo - DuckDuckGo Search
  • bing - Bing Search

Response Value

typescript
{
	query: string;                    // Search keyword
	number_of_results: number;        // Total number of results
	enabled_engines: string[];        // Enabled search engine list
	unresponsive_engines: string[];   // Unresponsive search engine list
	results: Array<{
		title: string;                  // Result title
		description: string;            // Result description
		url: string;                    // Result link
		engine: string;                 // Source engine
	}>;
}

Request Examples

bash
# GET request
curl "https://$YOUR-DOMAIN/search?q=cloudflare&engines=google,brave"

# POST request
curl -X POST "https://$YOUR-DOMAIN/search" \
	-H "Content-Type: application/x-www-form-urlencoded" \
	-d "q=cloudflare&engines=google,brave"

Response Example

json
{
	"query": "cloudflare",
	"number_of_results": 15,
	"enabled_engines": ["google", "brave", "duckduckgo"],
	"unresponsive_engines": [],
	"results": [
		{
			"title": "Cloudflare - The Web Performance & Security Company",
			"description": "Cloudflare is on a mission to help build a better Internet...",
			"url": "https://www.cloudflare.com/",
			"engine": "google"
		},
		{
			"title": "Cloudflare Workers",
			"description": "Deploy serverless code instantly across the globe...",
			"url": "https://workers.cloudflare.com/",
			"engine": "brave"
		}
	]
}

Search Engine Notes

Supported Search Engines

EngineDescriptionConfiguration RequiredEnabled by Default
GoogleGoogle Custom Search APIRequires GOOGLE_API_KEY and GOOGLE_CXyes
BraveBrave Search API-yes
DuckDuckGoDuckDuckGo Instant Answer API-yes
BingBing Search-no (unstable results)

Basic Working Approach

  1. Parallel Requests: All enabled search engines are requested concurrently to improve response speed
  2. Timeout Control: Timeout of a single engine does not affect others; default timeout is 3 seconds
  3. Result Aggregation: Merge all successfully returned results and mark their source engine
  4. Fault Tolerance: Record unresponsive engines and return partial results instead of failing completely

Environment Variable Configuration

Environment Variables

Variable NameTypeDefaultDescription
DEFAULT_TIMEOUTstring"3000"Timeout per search engine request (milliseconds)
GOOGLE_API_KEYstringnullhttps://console.cloud.google.com/apis/credentials
GOOGLE_CXstringnullhttps://programmablesearchengine.google.com/
TOKENstringnullAccess token. Enables auth when configured to prevent abuse

Notes:

  • Google Custom Search API free tier is limited to 100 requests per day
  • After TOKEN is configured, all requests must provide a valid token

Configuration Methods

Method 1: wrangler.toml File

Edit the [vars] section in wrangler.toml:

toml
[vars]
GOOGLE_API_KEY = "your-google-api-key"
GOOGLE_CX = "your-google-custom-search-cx"
DEFAULT_TIMEOUT = "3000"
TOKEN = "your-secret-token-here"

Method 2: Cloudflare Dashboard

  1. Go to the Worker settings page
  2. Find the Environment Variables section
  3. Add variables and save

Use Cases

1. Aggregated Search Service

Build your own aggregated search API and combine results from multiple search engines:

javascript
const response = await fetch(
	"https://$YOUR-DOMAIN/search?q=javascript&engines=google,brave",
);
const data = await response.json();
console.log(`Found ${data.number_of_results} results`);

2. Frontend Search Feature

Add search functionality to your website or app:

javascript
async function search(query) {
	const response = await fetch(
		`https://$YOUR-DOMAIN/search?q=${encodeURIComponent(query)}`,
	);
	const data = await response.json();
	return data.results;
}

3. Data Collection and Analysis

Collect results from multiple search engines for comparative analysis:

javascript
const engines = ["google", "brave", "duckduckgo"];
const results = await fetch(
	`https://$YOUR-DOMAIN/search?q=AI&engines=${engines.join(",")}`,
);
const data = await results.json();

// Group by engine
const byEngine = data.results.reduce((acc, result) => {
	acc[result.engine] = acc[result.engine] || [];
	acc[result.engine].push(result);
	return acc;
}, {});

MCP Integration

With MCP (Model Context Protocol), AI assistants can directly call your search service and get real-time search results.

Notes and Reminders

🚨 Important Notes

  1. Use a Custom Domain

    • The default Cloudflare *.workers.dev domain may be inaccessible in some regions
    • It is strongly recommended to bind your own domain for a better access experience
    • In Worker settings, click Triggers > Add Custom Domain to add a custom domain
  2. Search Engine Limits

    • Google API free tier is limited to 100 requests per day
    • Other search engines generally do not have strict limits, but please use responsibly
    • Frequent requests may cause temporary rate limiting
  3. Timeout Settings

    • Default timeout per engine is 3 seconds
    • Can be adjusted with DEFAULT_TIMEOUT
    • Do not set it too high to avoid long overall response times

🔒 Security Configuration

Enable Authentication

  1. Configure the TOKEN environment variable to protect your service from abuse:
  • Configure TOKEN in wrangler.toml
  • Configure TOKEN in Cloudflare Worker Dashboard
  1. Pass token in requests:
bash
# Access homepage
https://$YOUR-DOMAIN?token=$YOUR-TOKEN

# Request API with token parameter in query/body
curl "https://$YOUR-DOMAIN/search?q=cloudflare&token=$YOUR-TOKEN"

curl -X POST "https://$YOUR-DOMAIN/search" \
	-d "q=cloudflare" \
	-d "token=$YOUR-TOKEN"

FAQ

Q: Why do some search engines return empty results?

A: Possible reasons:

  • Search engine API is temporarily unavailable or timed out
  • No relevant results for the search keyword
  • Search engine has rate-limited access
  • Google requires API Key configuration before use

You can check the unresponsive_engines field in the response to see which engines did not respond.

Q: How can I improve search speed?

A: Recommendations:

  • Reduce the number of enabled search engines and only use the engines you need
  • Adjust timeout (DEFAULT_TIMEOUT) appropriately

Q: Why is Bing search disabled by default?

A: Bing search results are currently not stable enough, and may return content with low relevance to the query. If needed, you can manually specify engines=bing in requests or modify DEFAULT_ENGINES in envs.js.

Q: How can I protect the service from abuse?

A: It is recommended to configure the TOKEN environment variable to enable authentication:

  1. Set TOKEN = "your-random-token" in wrangler.toml
  2. Or add it in Environment Variables in Cloudflare Dashboard
  3. After configuration, all requests must provide a valid token

Authentication failure returns a 401 error.

Disclaimer

This project is for learning and research purposes only. Users must comply with the following:

  1. Lawful Use - Only use for legal search purposes. Do not use for illegal or infringing activities
  2. Terms of Service - Comply with the terms of Cloudflare Workers and each search engine
  3. API Limits - Follow usage limits and quotas of each search engine API
  4. Use at Your Own Risk - Any consequences from using this service are the user's responsibility
  5. Commercial Use - For commercial use, ensure compliance with relevant laws, regulations, and service terms

Contributing

Issues and Pull Requests are welcome!

License

GPL-3 License

Related Links

Support the Project

If this project helps you, you can buy the author a coffee ☕

インストール

TypingMind
{
  "mcpServers": {
    "cloudflare-search": {
      "command": "npx",
      "args": [
        "-y",
        "@yrobot/cf-search-mcp"
      ],
      "env": {
        "CF_SEARCH_URL": "<CF_SEARCH_URL>"
      }
    }
  }
}

Cloudflare SearchのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Cloudflare Searchに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 お使いのデバイス上でMCPをローカル実行することも、リモートMCPサーバーのURLに接続することもできます。

方法1:ローカルコネクタを使用

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Cloudflare Searchをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Cloudflare SearchのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "cloudflare-search": {
      "command": "npx",
      "args": [
        "-y",
        "@yrobot/cf-search-mcp"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてCloudflare SearchのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Cloudflare SearchのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Cloudflare Searchを使ってこのタスクを手伝ってもらえますか?
Cloudflare Search
はい、読みました。
Cloudflare Searchで調べた結果をお伝えします。

方法2:MCPサーバーのURLを追加

Cloudflare Searchがすでにリモートでホストされている場合や、チームの複数のユーザーで1つのコネクタを共有したい場合は、この方法を使います。

1

MCPコネクタを開く

TypingMindで「プラグイン」に移動し、「MCPコネクタ」を開いて「URLを追加」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 「プラグイン」に移動してください。
  3. 「MCPコネクタ」を開いてください。
  4. 「URLを追加」をクリックします。
TypingMindの「カスタムMCPサーバーURLを追加」フォーム
2

サーバーURLを貼り付け

「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを入力してください。サーバーで必要とされる場合は、接続名、説明、アイコン、カスタムHTTPヘッダー、OAuthクライアント設定を追加してください。

  1. 「サーバーURL」欄にプロバイダーから提供されたMCPサーバーのURLを貼り付けてください。
  2. Cloudflare Searchの接続名を入力してください。
  3. 接続を識別しやすくするには、説明とアイコンを追加してください。
  4. サーバーで認証が必要な場合は、カスタムHTTPヘッダーまたはOAuthクライアントの詳細情報を追加してください。
3

接続を作成

「接続を作成」をクリックし、プラグイン一覧に戻って、新しいMCP接続が有効になっていることを確認してください。

  1. 「接続を作成」をクリックします。
  2. MCPコネクタの一覧に戻ってください。
  3. Cloudflare Searchの接続が「有効」と表示されていることを確認してください。
  4. 接続がすぐに表示されない場合は、プラグイン一覧を更新してください。
4

再接続せずにモデルを切り替え

お好みのモデルでチャットを開始し、「プラグイン」でCloudflare Searchのツールを有効にしてください。必要に応じて別のモデルに切り替えられます。MCP接続は、TypingMindのワークスペースで引き続き利用できます。

  1. TypingMindで新しいチャットを開始してください。
  2. 使用するAIモデルを選択してください。
  3. 「プラグイン」でCloudflare Searchのツールを有効にしてください。
  4. 必要に応じて、ツールを使うようモデルに依頼してください。
  5. 別のAIモデルに切り替えて、同じMCP接続を再利用してください。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Cloudflare Searchを使ってこのタスクを手伝ってもらえますか?
Cloudflare Search
はい、読みました。
Cloudflare Searchで調べた結果をお伝えします。

よくある質問

Cloudflare Search MCPサーバーは何に使いますか?

Cloudflare Searchは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでCloudflare Search MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでCloudflare Searchを利用できます。

TypingMindでCloudflare Search MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Cloudflare Searchを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Cloudflare Search MCPをTypingMindに接続するにはどうすればよいですか?

Cloudflare Searchは、ローカルMCPコネクタを使うか、リモートMCPサーバーのURLを追加することでTypingMindに接続できます。サーバーがデバイス上のファイル、アプリ、プライベートリソースにアクセスする必要がある場合はローカルコネクタを、MCPサーバーがリモートでホストされている場合はサーバーURLを使用してください。

TypingMindでCloudflare Search MCPのどのようなツールを利用できますか?

Cloudflare SearchはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Cloudflare Search MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Cloudflare Searchで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇