Files
hunjing/config/mcp/web-search.example.yaml
T
2026-08-21 16:00:13 +08:00

86 lines
2.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 博闻(Bowen)MCP Web Search 配置
# =============================================================================
# 存放路径:config/mcp/web-search.yaml(从 config/mcp/web-search.example.yaml 复制)
#
# 配置优先级:环境变量 > 本文件 > 内置默认值
# - API Key 由环境变量注入(TAVILY_API_KEYS / BRAVE_API_KEYS)
# - Redis 连接由环境变量注入(MCP_WEB_SEARCH_REDIS_*)
# - 本文件只存放非敏感的结构化配置
# =============================================================================
server:
# HTTP SSE 模式监听端口。
# 也可以通过 CLI 参数 --port 覆盖(优先级更高)。
port: 8080
# HTTP 读取超时。超过此时间未收到完整请求头则断开连接。
read_timeout: 300s
# HTTP 写入超时。超过此时间未写完响应体则断开连接。
write_timeout: 300s
providers:
# --- Tavily 搜索 ---
# 官网:https://tavily.com
# API Key 通过环境变量 TAVILY_API_KEYS 设置,多 key 用逗号分隔。
tavily:
enabled: true # 是否启用此 provider
timeout: 10s # 单次搜索 HTTP 超时
max_results: 10 # 单次搜索最大返回结果数
health_check:
interval: 60s # 健康检查间隔
timeout: 5s # 健康检查 HTTP 超时
failure_threshold: 3 # 连续失败多少次后标记为不可用
# --- Brave Search ---
# 官网:https://brave.com/search/api/
# API Key 通过环境变量 BRAVE_API_KEYS 设置。
brave:
enabled: true
timeout: 10s
max_results: 10
health_check:
interval: 60s
timeout: 5s
failure_threshold: 3
balancer:
# 负载均衡策略:weighted_round_robin(EWMA 动态权重)| random
strategy: weighted_round_robin
# 搜索失败后的重试次数(在 provider 内切换密钥或跨 provider 故障转移)。
retry_count: 2
circuit_breaker:
enabled: true # 是否启用熔断器
failure_threshold: 5 # 连续失败次数达到此值后熔断
cooldown: 30s # 熔断后冷却时间,之后进入半开探测
cache:
# 内存 LRU 缓存总开关。
enabled: true
# 缓存过期时间。搜索结果在此时间后自动失效。
ttl: 5m
# LRU 最大条目数。超过此数量时淘汰最久未使用的条目。
max_items: 1000
# 二级 Redis 缓存(可开关)。启用后作为 L1(LRU) 的后备层,
# 多实例部署时共享缓存状态,L2 命中自动升温到 L1。
redis:
enabled: false # 开关(需自行部署 Redis)
addr: 127.0.0.1:6379
password: ""
db: 0
metrics:
# Prometheus 指标总开关。
enabled: true
# Prometheus HTTP 端口(独立于主服务端口)。
port: 9090
# Prometheus 指标 HTTP 路径。
path: /metrics