使用说明
DDG Search
Web search and AI-powered answers from the command line or MCP.
DuckDuckGo, IAsk AI, and Monica AI. No API keys required.
快速开始
# Search from the command line
npx -y @oevortex/ddg_search@latest "your search query"
# Or install globally
npm install -g @oevortex/ddg_search
ddg "your search query"
用法
命令行界面
# Basic web search (DuckDuckGo)
ddg "quantum computing"
# Get more results
ddg "latest news" -n 10
# AI-generated answer (IAsk)
ddg "explain recursion" -m ai
# AI-generated answer (Monica)
ddg "hello world" -m ai -b monica
# IAsk with options
ddg "gravity" -m ai --iask-mode academic --detail-level comprehensive
旗帜
| 标志 | 描述 | 默认值 |
|---|---|---|
-m, --mode |
web 或 ai |
web |
-b, --backend |
iask 或 monica (仅限AI模式) |
iask |
-n, --num-results |
结果数量(1-20,网络模式) | 3 |
--iask-mode |
question, academic, forums, wiki, thinking |
thinking |
--detail-level |
concise, detailed, comprehensive |
— |
-h, --help |
显示帮助 | |
-v, --version |
显示版本 |
MCP服务器
启动MCP服务器,以便与Claude Desktop、OpenCode或其他MCP客户端一起使用:
ddg --server
Claude桌面配置:
{
"mcpServers": {
"ddg-search": {
"command": "npx",
"args": ["-y", "@oevortex/ddg_search@latest"]
}
}
}
全局安装配置:
{
"mcpServers": {
"ddg-search": {
"command": "ddg"
}
}
}
程序化API
import { searchDuckDuckGo } from '@oevortex/ddg_search/src/utils/search.js';
import { searchIAsk } from '@oevortex/ddg_search/src/utils/search_iask.js';
import { searchMonica } from '@oevortex/ddg_search/src/utils/search_monica.js';
// DuckDuckGo
const results = await searchDuckDuckGo("query", 5);
// IAsk AI
const answer = await searchIAsk("query", "thinking", null);
// Monica AI
const answer = await searchMonica("query");
MCP工具架构
单一统一工具 web-search:
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
query |
string | 必填 | 搜索查询 |
mode |
"web" |
"ai" |
"web" |
backend |
"iask" |
"monica" |
"iask" |
numResults |
整数 | 3 |
结果计数(网络模式,1-20) |
iaskMode |
字符串 | "thinking" |
IAsk模式(仅后端=IAsk) |
detailLevel |
string | -- | IAsk详细级别(仅后端=IAsk) |
代理提示
将此添加到代理的系统提示中以启用网络搜索:
When you need to search the web or find current information, use the DDG Search CLI:
npx -y @oevortex/ddg_search@latest "<query>" -m ai
This runs an AI-powered web search via IAsk. For standard DuckDuckGo results (titles + URLs + snippets), use mode "web" instead:
npx -y @oevortex/ddg_search@latest "<query>" -m web -n 5
For a different AI backend (Monica), add -b monica. Use this for any research, fact-checking, or current events task.
代理支持
尊重 HTTP_PROXY, HTTPS_PROXY,以及 NO_PROXY 环境变量自动。
HTTPS_PROXY=http://proxy:8080 ddg "search query"
安装
npm install -g @oevortex/ddg_search
或使用 npx 无需安装。
项目结构
bin/cli.js CLI entry point
src/
index.ts MCP server
tools/
searchTool.js Unified search tool
utils/
search.js DuckDuckGo scraper
search_iask.js IAsk AI client
search_monica.js Monica AI client
user_agents.js User agent rotation
skills/
ddg-search/ Agent skill for marketplace
贡献
欢迎拉取请求。打开一个bug或功能请求的问题。
许可证
Apache 2.0
Made by @OEvortex