Gemini URL Context & Search MCP Server
Enables web content extraction and Google Search through Google AI Studio's URL context functionality. Supports batch processing of multiple URLs and returns structured JSON output for web page text and image analysis.
README
Gemini URL Context & Search MCP Server
Google AI Studio の URL context 機能と Google Search を MCP (Model Context Protocol) サーバーとして実装し、Claude Code からWebページのテキスト抽出と検索を可能にします。
📁 プロジェクト構造
詳細なフォルダ・ファイル構成は PROJECT_STRUCTURE.md をご覧ください。
🎯 機能
- 📄 URL Content Extract: Webページのテキストと画像URLを全抽出
- 🔍 Google Search: Webを検索して関連情報を取得
- 🏗️ 構造化出力: JSON形式でページ情報を整理
- 🔗 複数URL対応: 複数URLの一括処理
- ⚡ 高品質アーキテクチャ: ドメイン駆動設計とTDD
📦 インストール
npxで即座に使用(推奨)
# Claude Code で一発セットアップ
claude mcp add gemini-url-context -s user -e GEMINI_API_KEY="your-key" -- npx @yourcompany/gemini-url-context-mcp@latest
手動インストール
npm install -g @yourcompany/gemini-url-context-mcp
🔧 セットアップ
1. APIキー取得
- Google AI Studio にアクセス
- "Get API key" → "Create API key"
- キーをコピー
2. 自動セットアップ(Claude Code)
# セットアップスクリプトを実行
export GEMINI_API_KEY="your-api-key"
./scripts/setup-claude-code.sh
3. 設定ファイル生成(他のクライアント)
# 各クライアント用設定ファイルを生成
node scripts/generate-configs.js
🚀 使用方法
URL Content Extract
Claude Code で話しかけるだけ:
「https://example.com のテキストと画像を全部抽出して」
Google Search
Claude Code で話しかけるだけ:
「最新のAI技術について検索して」
応用例
「以下のサイトを比較分析して:
- https://site1.com
- https://site2.com」
「Next.js 14の最新情報を検索して、
関連記事の内容も抽出して」
🛠️ 対応クライアント
- Claude Code (CLI) - ワンライナーセットアップ
- Cursor -
.cursor/mcp.json - VS Code - MCP拡張
- Claude Desktop - 標準設定
- LM Studio - MCP Server追加
🏗️ アーキテクチャ
ドメイン駆動設計
- Domain Layer: Url, Page, ModelName 値オブジェクト
- Use Case Layer: ビジネスロジック分離
- Adapter Layer: 外部API統合
- Infrastructure: MCP プロトコル実装
品質保証
- TDD: テスト駆動開発
- 型安全: TypeScript厳密モード
- エラーハンドリング: 分類された例外処理
- Value Objects: 不変性保証
🔍 API仕様
url_context_extract
{
"urls": ["https://example.com"],
"query": "要約して",
"model": "gemini-2.0-flash-exp",
"maxCharsPerPage": 8000
}
google_search
{
"query": "検索キーワード",
"instruction": "処理指示",
"model": "gemini-2.0-flash-exp"
}
🎯 MCP作成のベストプラクティス
この実装から学べる要素:
🔥 必須要素
- npx対応:
"bin"でCLIツール化 - 複数クライアント対応: 設定ファイル自動生成
- ワンライナー セットアップ: ユーザビリティ最優先
- エラーハンドリング: 型付きエラーで安全性
🏗️ アーキテクチャ
- ドメイン駆動設計: ビジネスロジック分離
- Value Object: 型安全と不変性
- Adapter Pattern: 外部依存の抽象化
- Factory Pattern: 実装切り替え
🧪 品質管理
- TDD: テスト先行開発
- 統合テスト: 実動作確認
- 型安全: TypeScript活用
- lint/format: コード品質
📦 配布戦略
- npmパッケージ: 即座にインストール可能
- 設定自動化: スクリプトで一発セットアップ
- ドキュメント: 使用例とトラブルシューティング
- 段階的ロールアウト: パイロット→本格展開
🏆 他実装との差別化
| 項目 | この実装 | 一般的実装 |
|---|---|---|
| アーキテクチャ | DDD + Clean Architecture | 手続き型 |
| テスト | TDD + 統合テスト | テストなし |
| 型安全 | Value Object | 文字列ベース |
| エラー処理 | 型付きドメインエラー | try-catch |
| ユーザビリティ | ワンライナーセットアップ | 手動設定 |
開発者: あなた
アーキテクチャ: Claude Code AI
品質: エンタープライズ級
使いやすさ: コンシューマー級
🎉 完璧なMCPサーバーの完成です!
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.