Content
align="center">
# 🔍 bing-search-cli
**A dual-engine (Bing + DuckDuckGo) web search and page-fetch tool**
It scrapes the public HTML search pages of Bing and DuckDuckGo, decodes their redirect URLs, deduplicates across engines, and returns clean structured results. Three ways to use it:
- 🧩 **As a Claude Code plugin** — install with one command, auto-registers the MCP tools, replaces the rate-limited built-in WebSearch;
- 🔌 **As a generic MCP server** — plug it into Cline or any [MCP](https://modelcontextprotocol.io)-compatible client to give your agent unrestricted web search;
- 💻 **As a standalone CLI** — run searches and extract page text right from your terminal.
No API keys required.
## 🎯 Features
| Feature | Description |
| --- | --- |
| 🔀 **Two engines, one call** | Query Bing, DuckDuckGo, or both.` merges and deduplicates by domain + title |
| 🚀 **No rate-limit gates** | Hits the public HTML endpoints directly instead of a paid API |
| 📄 **Page extraction** | `fetch_page` pulls the main readable text out of any URL (strips scripts, nav, footers) |
| 🀄 **CJK-aware** | Chinese queries automatically switch Bing to the `zh-CN` market |
| 🌐 **Optional proxy** | Set `HTTPS_PROXY` / `HTTP_PROXY` to use a proxy; unset for direct connections. **No proxy is hardcoded** |
| 🔑 **Zero keys** | Works out of the box, no signup |
## 📦 Requirements
- Node.js >= 18 (uses the global `fetch` and `undici`).
## 🧩 Install as a Claude Code plugin (recommended)
The easiest path — no clone, no manual config. Add this repo as a plugin marketplace, then install the plugin:
```text
/plugin marketplace add AusertDream/bing-search-cli
/plugin install bing-search@bing-search
```
The plugin auto-registers an MCP server launched via `npx`. On first call, `npx` downloads and caches the dependencies, then it just works. The plugin exposes two tools, `bing_search` and `fetch_page`, which Claude invokes automatically.
> **Proxy note:** The `npx`-launched child process inherits Claude Code's environment variables. Set `HTTPS_PROXY` / `HTTP_PROXY` **before** launching Claude Code to route the plugin through a proxy (see [Proxy](#-proxy-1)).
### Make the plugin replace the built-in WebSearch
After installing, Claude sees both the built-in `WebSearch` and this plugin's `bing_search`; it does not disable the former automatically. To force everything through this tool, add the built-in to `permissions.deny` in your Claude Code settings:
```json
{
"permissions": {
"deny": ["WebSearch"]
}
}
```
## 🔌 Register manually as an MCP server
If you'd rather skip the plugin, or in another MCP client, register it by hand. The cleanest way is the same `npx` remote pull, no clone:
```bash
claude mcp add bing-search -- npx -y -p github:AusertDream/bing-search-cli bing-search-mcp
```
With a proxy:
```bash
claude mcp add bing-search -e HTTPS_PROXY=http://127.0.0.1:7890 -- npx -y -p github:AusertDream/bing-search-cli bing-search-mcp
```
Or hand-write it in a client's `m`:
```json
"mcpServers": "bing-search": {
"command": "npx",
"args": ["-y", "-p", "AusertDream/bing", "bing-search-mcp "env": {
_PROXY": "http://0.0.7890",
_PROXY": "http://127.0.0.10"
}
}
}
```
## as a CLI
Install use the `bing-search (no clone):
```bash
npm install -:AusertDream/b-cli
```
Or run once without installing:
```bash
y -pAusertDream/bing bing-search search "your```
### CLI usage
```bash
# Search (defaults: 10 results, lang=en, engine=both)
search "rust async runtime comparison"
# More results, Chinese
bing-search search "" 15 zh-CN b# Fetch and extract a main text (default max0 chars)
bing-search fetch "https://example.com/article5000
```
order:**
| Command | args |
| --- | --- `search` | [num_results] [lang] [engine]` `fetch` | `<url> [max_length]` |
> `engine` is one of `bing` / `duck` / `both` `both`).
## Install from source (for development/contribution)
```git clone https://githubusertDream/bing.git
cd b-cli
npm install
# Optional: link the `bing-search` command globallyRun the script directly without linking:
```bash
node cli.mjs search "your query"
🧰 tools
**`bing_search`** — Web search
| Type | Default | Description |
| --- | --- | --- | --- |
| `query` | string | — | The (in any language). **Required** |
| `engine` | string | `both` | `bing` / `duckduckgo` / `both` |
| `num_results` | number | `10` | Maximum number of results to return (1–20) |
| `lang` | string | `en` | Search language,. `en`, `zh-CN` |
**`fetch_page`** — Fetch and extract a page's main text
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| `url` | string | — | The URL to fetch. **Required** |
| `max_length number | `800 | Maximum length of the returned text |
## ⚙️ How it works
- **Bing**: Scrapes the `li.b_algo` section from `bing.com/search`, decodes base64-encoded `ck/a?u=` redirect links into real URLs.
- **DuckDuckGo**: Scrapes `.result` blocks from `html.duckduckgo.com/html/`, decodes `uddg=` redirect params, and skips ads.
- **both**: Merges results from both engines, deduplicates by domain + title.
> ⚠️ Since it relies on the public HTML structure of search engines, the parsing logic might need updates if they change their layouts.
## 🌐 About proxy
Proxy usage is controlled by environment variables: set `HTTPS_PROXY` or `HTTP_PROXY` to use a proxy, unset for direct connections. **No proxy is hardcoded**.
> **For users in mainland China:** You must configure a proxy. Bing and DuckDuckGo are or unstable from mainland China. Set your proxy before using ```bash
> export HTTPS_PROXY=http://127.0.0.1:7890 # Replace with your proxy address and port
> export HTTP_PROXY=http://127.0.0.1:7890
> ```
>
> For plugins or MCP servers, set these environment variables before launching Claude Code, or add them to `mcp.json` under `env` (see MCP config example above).
## 🤝 Contributing
Feel free to open issues or submit PRs. Contributions to fix parsing issues due to engine changes are especially welcome.
## 📄 License
[MIT](./LICENSE) © AusertDream
<br>
---
<div align="center">
# 🔍 bing-search-cli (English)
</div>
## 🌟 Introduction
A dual-engine (**Bing + DuckDuckGo**) web search and page-fetch tool. It scrapes the public HTML search pages of Bing and DuckDuck decodes their redirect URLs, deduplicates across engines, and returns clean structured results. Three ways to use it:
- 🧩 **As a Claude Code plugin** — install with one command, auto-registers the MCP tools, replaces the rate-limited built-in WebSearch;
- 🔌 **As a generic MCP server** — plug it into Cline or any [MCP](https://modelcontextprotocol.io)-compatible client to give your agent unrestricted web search;
- 💻 **As a standalone CLI** — run searches and extract page text right from your terminal.
No API keys required.
## 🎯 Features
| Feature | Description |
| --- | --- |
| 🔀 **Two engines, one call** | Query Bing, DuckDuckGo, or both. `both` merges and deduplicates by domain + title |
| 🚀 **No rate-limit gates** the public HTML endpoints directly instead of a paid API |
| 📄 **Page extraction** | `fetch_page` pulls the main readable text out of any URL (strips scripts, nav, footers) |
| 🀄 **CJK-aware** | Chinese queries automatically switch Bing to the `zh-CN` market |
| 🌐 **Optional proxy** | Set `HTTPS_PROXY` / `HTTP_PROXY` to use a proxy; unset for direct connections. **No proxy is hardcoded** |
| 🔑 **Zero keys** | Works out of the box, no signup |
## 📦 Requirements
- Node.js >= 18 (uses the global `fetch` and `undici`).
## 🧩 Install as a Claude Code plugin (recommended)
The easiest path — no clone, no manual config. Add this repo as a plugin marketplace, then install the plugin:
```text
/plugin marketplace add AusertDream/bing-search-cli
/plugin install bing-search@bing-search
```
The plugin auto-registers an MCP server launched via `npx`. On first call, `npx` downloads and caches the dependencies, then it just works. The plugin exposes two tools, `bing_search` and `fetch_page`, which Claude invokes automatically.
> **Proxy note:** The `npx`-launched child process inherits Claude Code's environment variables. Set `HTTPS_PROXY` / `HTTP_PROXY` **before** launching Claude Code to route the plugin through a proxy (see [Proxy](#-proxy-1)).
### Make the plugin replace the built-in WebSearch
After installing, Claude sees both the built-in `WebSearch` and this plugin's `bing_search`; it does not disable the former automatically. To force everything through this tool, add the built-in to `permissions.deny` in your Claude Code settings:
```json
{
"permissions": {
"deny": ["WebSearch"]
}
}
```
## 🔌 Register manually as an MCP server
If you'd rather skip the plugin, or use it in another MCP client, register it by hand. The cleanest way is the same `npx` remote pull, no clone:
```bash
claude mcp add bing-search -- npx -y -p github:AusertDream/bing-search-cli bing-search-mcp
```
With a proxy:
```bash
claude mcp add bing-search -e HTTPS_PROXY=http://127.0.0.1:7890 -- npx -y -p github:AusertDream/bing-search-cli bing-search-mcp
```
Or hand-write it in a client's `mcp.json`:
```json
{
"mcpServers": {
-search": {
"command": "npx",
"args": ["-y", "-p", "github:AusertDream/bing-search-cli", "bing-search-mcp"],
"env": {
"HTTPS_PROXY": "http://127.0.0.1:7890",
"HTTP_PROXY": "http://127.0.0.1:7890"
}
}
}
}
```
## Install as a CLI
Install globally to use the` command anywhere (no clone):
```bash
npm install -g github:Dream/bing-search-cli
```
Or run once without installing:
```bash
npx -y -p github:AusertDream/bing-search-cli bing-search search "your query"
```
### CLI usage
```bash
# Search (defaults: , lang=en, engine=both)
bing-search search "rust async runtime comparison"
# More results, Chinese,
bing-search search "" 15 zh-CN bing
# Fetch and extract a page's main text (default max 8000 chars)
bing-search fetch "https://example.com/article" 5000
```
**Argument order:**
| Command | Positional args |
| --- | --- |
| `search` | `<query> [num_results] [lang] [engine]` |
| `fetch` | `<url> [max_length]` |
> `engine` `bing` / `duckduckgo` /` (default `both`).
## 🛠️ Install from source (development)
```bash
git clone https://github.com/AusertDream/bing-search-cli.git
cd bing-search-cli
npm install
npm link # optional: link the bing-search command globally
```
Call the script directly without linking:
```bash
node cli.mjs search "your query"
```
## 🧰 Exposed tools
**`bing_search`** — search the web.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| `query` | string | — | Search query. **Required** |
| `engine` | string | `both` | `bing` / `duckduckgo` / `both` |
| `num_results` | number | `10` | Max results to return (1–20) |
| `lang` | string | `en` | Search language, e.g. `en` |
**`fetch_page`** — fetch and extract readable text from a URL.
| Param | Type | Default | Description |
| --- | --- | --- | --- |
| `url` | string | — | URL to fetch. **Required** |
| `max_length` | number | `8000` | Max characters of returned content |
## ⚙️ How it works
- **Bing**: parses `li.b_algo` blocks from `bing.com/search` and decodes the base64 `ck/a?u=` redirect wrappers back to real URLs.
- **DuckDuckGo**: parses `.result` blocks from `html.duckduckgo.com/html/` and unwraps the `uddg=` redirect params, skipping ad results.
- **both**: concatenates results from both engines, then deduplicates by `domain + title`.
> ⚠️ Because this relies on the engines' public HTML markup, result parsing may need updating if they change their page structure.
## 🌐 Proxy
Proxy is controlled entirely by environment variables. Set `HTTPS_PROXY` or `HTTP_PROXY` to enable it; leave them unset for direct connections. No proxy address is hardcoded.
> **Users in certain regions: a proxy is required.** Some services are generally not reachable from within certain regions, so without a proxy you'll hit connection timeouts and get no results. Set a proxy first:
>
> ```bash
> export HTTPS_PROXY=http://127.0.0.1:7890 # replace with your own proxy host:port
> export HTTP_PROXY=http://127.0.0.1:7890
> ```
>
> When running as a plugin or MCP server, set these before launching Claude Code, or put the proxy in the `env` block of `mcp.json` (see the MCP config example above).
## 🤝 Contributing
Issues and PRs welcome — especially parser fixes when an engine changes its markup.
## 📄 License
[MIT](./LICENSE) © AusertDream
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available