serpent
serpent
MCP / AIエージェントワークフロー向けに構築されたオープンソースのメタ検索バックエンド。
複数の検索エンジンから結果を集約し、統一されたスキーマを返し、LLMエージェントが直接呼び出せる標準HTTP APIとMCPサーバーの両方を提供します。
なぜこれが必要なのか
ほとんどの検索アグリゲーターは、HTMLページ、結果カード、ページネーションUIなど、人間が読むための出力用に設計されています。LLMエージェントがウェブ検索を行う際には、構造化されたJSON、安定したフィールド名、複数のソースからの同時結果取得、予測可能なエラー処理など、異なるものが必要となります。
serpentはそのようなユースケースのために設計されています。SearXNGのクローンではありません。
ポジショニング
エージェントフレンドリーなメタ検索バックエンド
LLMワークフローのためのMCPファーストな検索ゲートウェイ
AIパイプライン向けに設計された構造化検索API
サポートされているプロバイダー
Googleは直接スクレイピングされません。理由は実用的です。Googleのボット対策により、自己ホスト型のスクレイピングは脆弱になるためです。Googleの絶えず進化する検知機能に対して信頼性の高いスクレイパーを維持することは、絶え間ない故障と高いメンテナンスコストを意味します。本番環境でのユースケースでは、サードパーティプロバイダーの方が信頼性が高く、費用対効果に優れています。
現在サポートされているGoogleプロバイダー:
プロバイダー | 環境変数 | 備考 |
| 従量課金制。低ボリュームでは一般的に安価 | |
| 2,500クエリまで無料、以降は従量課金制 |
どちらも低コストなオプションです。カジュアルまたは低ボリュームでの使用には、serpbase.devの方がクエリあたりの単価が安くなる傾向があります。どちらでも動作します。好みのものを設定するか、フォールバック用に両方を設定してください。
ウェブ検索
プロバイダー | 名前 | メソッド | 認証 |
DuckDuckGo |
| HTMLスクレイピング (liteエンドポイント) | なし |
Bing |
| HTMLスクレイピング | なし |
Yahoo |
| HTMLスクレイピング | なし |
Brave |
| 公式検索API | オプション (無料枠: 月2000回) |
Ecosia |
| HTMLスクレイピング | なし |
Mojeek |
| HTMLスクレイピング | なし |
Startpage |
| HTMLスクレイピング (ベストエフォート) | なし |
Qwant |
| 内部JSON API (ベストエフォート) | なし |
Yandex |
| HTMLスクレイピング (ベストエフォート) | なし |
Baidu |
| HTMLスクレイピング (ベストエフォート) | なし |
ベストエフォートと記載されたプロバイダーは、非公開のエンドポイントや強力なボット対策が施されたスクレイピング対象を使用しています。予告なく動作しなくなる可能性があります。
知識 / リファレンス
プロバイダー | 名前 | メソッド | 認証 |
Wikipedia |
| MediaWiki Action API | なし |
Wikidata |
| Wikidata API (エンティティ検索) | なし |
Internet Archive |
| 高度な検索API | なし |
開発者
プロバイダー | 名前 | メソッド | 認証 |
GitHub |
| GitHub REST API | なし (トークンでレート制限緩和) |
Stack Overflow |
| Stack Exchange API | なし (キーで制限緩和) |
Hacker News |
| Algolia HN API | なし |
| 公開JSON API | なし | |
npm |
| npmレジストリAPI | なし |
PyPI |
| HTMLスクレイピング | なし |
crates.io |
| crates.io REST API | なし |
学術
プロバイダー | 名前 | メソッド | 認証 |
arXiv |
| Atom API | なし |
PubMed |
| NCBI E-utilities | なし (キーでレート制限緩和) |
Semantic Scholar |
| Graph API | なし (キーでレート制限緩和) |
CrossRef |
| REST API (1億4500万件以上のDOI) | なし |
インストール
# Clone the repository
git clone https://github.com/your-org/serpent
cd serpent
# Install with pip (editable)
pip install -e ".[dev]"
# Or with uv
uv pip install -e ".[dev]"設定
.env.example を .env にコピーし、キーを入力してください:
cp .env.example .env# Required for Google search (at least one)
SERPBASE_API_KEY=your_key_here
SERPER_API_KEY=your_key_here
# Optional — omit to use unauthenticated/public access
BRAVE_API_KEY= # free tier: 2000 req/month
GITHUB_TOKEN= # raises rate limit from 60 to 5000 req/hour
STACKEXCHANGE_API_KEY= # raises limit from 300 to 10,000 req/day
NCBI_API_KEY= # PubMed; raises from 3 to 10 req/sec
SEMANTIC_SCHOLAR_API_KEY= # raises from 1 to 10 req/sec
# Server
HOST=0.0.0.0
PORT=8000
# Restrict which providers are active (comma-separated, empty = all available)
ENABLED_PROVIDERS=
ALLOW_UNSTABLE_PROVIDERS=false
# Timeouts in seconds
DEFAULT_TIMEOUT=10
AGGREGATOR_TIMEOUT=15
MAX_RESULTS_PER_PROVIDER=10実行
HTTP APIサーバー
python -m serpent.main
# or
serpentサーバーは http://localhost:8000 で起動します。インタラクティブなドキュメントは /docs にあります。
MCPサーバー
python -m serpent.mcp_server
# or
serpent-mcpMCPサーバーはstdio経由で通信します。MCP互換クライアント(Claude Desktop、cline、continue.devなど)で使用してください。
Docker
イメージのビルド:
docker build -t serpent .HTTP APIの実行:
docker run --rm -p 8000:8000 --env-file .env serpentまたはDocker Composeを使用:
docker compose up --buildコンテナは http://localhost:8000 でHTTP APIを起動します。
HTTP API
POST /search
有効なすべてのプロバイダー全体で検索を集約します。
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{"query": "rust async runtime"}'明示的なプロバイダーとパラメータを指定する場合:
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "rust async runtime",
"providers": ["duckduckgo", "wikipedia"],
"params": {"num_results": 5, "language": "en"}
}'レスポンス:
{
"engine": "serpent",
"query": "rust async runtime",
"results": [
{
"title": "Tokio - An asynchronous Rust runtime",
"url": "https://tokio.rs",
"snippet": "Tokio is an event-driven, non-blocking I/O platform...",
"source": "tokio.rs",
"rank": 1,
"provider": "duckduckgo",
"published_date": null,
"extra": {}
}
],
"related_searches": ["tokio vs async-std", "rust futures"],
"suggestions": [],
"answer_box": null,
"timing_ms": 843.2,
"providers": [
{"name": "duckduckgo", "success": true, "result_count": 10, "latency_ms": 840.1, "error": null},
{"name": "wikipedia", "success": true, "result_count": 3, "latency_ms": 320.5, "error": null}
],
"errors": []
}POST /search/google
curl -X POST http://localhost:8000/search/google \
-H "Content-Type: application/json" \
-d '{"query": "site:github.com rust tokio"}'GET /health
curl http://localhost:8000/health
# {"status": "ok"}GET /providers
curl http://localhost:8000/providers{
"available": [
{"name": "google_serpbase", "tags": ["google", "web"]},
{"name": "duckduckgo", "tags": ["web", "privacy"]},
{"name": "wikipedia", "tags": ["web", "academic", "knowledge"]},
{"name": "github", "tags": ["code", "web"]},
{"name": "arxiv", "tags": ["academic", "web"]}
],
"count": 5
}MCPの使用方法
MCPクライアントを設定して serpent-mcp (または python -m serpent.mcp_server) を実行するようにします。
Claude Desktopの設定例 (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"serpent": {
"command": "serpent-mcp",
"env": {
"SERPBASE_API_KEY": "your_key",
"SERPER_API_KEY": "your_key"
}
}
}
}利用可能なMCPツール
search_web
有効なすべてのプロバイダー全体での一般的なウェブ検索。
{
"query": "fastapi vs flask performance 2024",
"num_results": 10
}search_google
設定されたサードパーティプロバイダー経由のGoogle検索。
{
"query": "site:docs.python.org asyncio",
"provider": "google_serpbase"
}search_academic
arXivおよびWikipediaの検索。
{
"query": "transformer architecture attention mechanism",
"num_results": 8
}search_github
GitHubリポジトリの検索。
{
"query": "python mcp server implementation",
"num_results": 5
}compare_engines
複数のプロバイダーで同じクエリを実行し、エンジンごとにグループ化された結果を返します。
{
"query": "vector database comparison",
"providers": ["duckduckgo", "brave"],
"num_results": 5
}結果スキーマのリファレンス
すべての結果オブジェクトには以下のフィールドが含まれます:
フィールド | 型 | 説明 | |
| string | 結果のタイトル | |
| string | 結果のURL | |
| string | テキストの抜粋 / 説明 | |
| string | ドメイン名 | |
| int | 最終的なマージリスト内での1から始まる順位 | |
| string | この結果を返したプロバイダー | |
| string | null | ISO日付 (YYYY-MM-DD)、利用可能な場合 |
| object | プロバイダー固有のデータ (例: GitHubのスター数、arXivの著者) |
開発
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run with auto-reload
uvicorn serpent.main:app --reloadロードマップ
[ ] 繰り返しクエリのためのキャッシュ層 (インメモリ / Redis)
[ ] プロバイダー間での関連性再ランキング
[ ] さらなるプロバイダーの追加: Bing (公式API)、Kagi、Tavily
[ ] バックオフを伴うプロバイダーごとのレート制限
[ ] 長い集約のためのストリーミングレスポンス (SSE)
[ ] DockerイメージとCompose設定
[ ] プロバイダーのヘルス監視エンドポイント
[ ] 結果のスコアリングと信頼度シグナル
ライセンス
MIT
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/reurinkkeano/serpent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server