Gemini URL Context & Search MCP Server
Provides web search capabilities through Google Search API and extracts text content and images from web pages using Google AI Studio's URL context functionality
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gemini URL Context & Search MCP Serverextract text and images from https://news.ycombinator.com"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini URL Context & Search MCP Server
Google AI Studio の URL context 機能と Google Search を MCP (Model Context Protocol) サーバーとして実装し、Claude Code からWebページのテキスト抽出と検索を可能にします。
📁 プロジェクト構造
詳細なフォルダ・ファイル構成は PROJECT_STRUCTURE.md をご覧ください。
Related MCP server: Browser Automation MCP Server
🎯 機能
📄 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.sh3. 設定ファイル生成(他のクライアント)
# 各クライアント用設定ファイルを生成
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.jsonVS 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サーバーの完成です!
Available Tools
2 toolsgoogle_searchA
Search the web using Google Search grounding via Gemini API. Provides search results with sources and citations.
| Name | Required | Description | Default |
|---|---|---|---|
| instruction | No | Optional instruction for processing search results | |
| model | No | Gemini model name to use (optional, defaults to gemini-2.0-flash-exp) | |
| query | Yes | Search query to find information on the web |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It mentions that the tool 'Provides search results with sources and citations,' which gives some behavioral context, but does not disclose critical traits such as rate limits, authentication needs, error handling, or pagination. For a web search tool with no annotations, this leaves significant gaps in understanding its operational behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded and efficiently structured in two sentences: the first states the tool's purpose and method, and the second specifies the output. Every sentence adds value without redundancy, making it appropriately sized and easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's moderate complexity (web search with 3 parameters), no annotations, and no output schema, the description is partially complete. It covers the basic purpose and output format but lacks details on behavioral traits, error handling, and usage guidelines. This is adequate for a simple tool but has clear gaps in providing a full operational understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all parameters (query, instruction, model) with descriptions. The description adds minimal value beyond the schema, as it does not provide additional syntax, format details, or usage examples for the parameters. Baseline 3 is appropriate when the schema handles most of the parameter documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the specific action ('Search the web') using a specific resource ('Google Search grounding via Gemini API') and distinguishes from the sibling tool 'url_context_extract' by focusing on web search rather than URL extraction. It specifies what the tool provides ('search results with sources and citations').
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for web search tasks but does not explicitly state when to use this tool versus the sibling 'url_context_extract' or other alternatives. It provides basic context (searching the web) but lacks explicit guidance on exclusions or specific scenarios where this tool is preferred.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
url_context_extractC
Extract content from URLs using Gemini AI and return structured JSON with pages, answer, and metadata
| Name | Required | Description | Default |
|---|---|---|---|
| maxCharsPerPage | No | Maximum characters per page (optional, defaults to 8000) | |
| model | No | Gemini model name to use (optional, defaults to gemini-2.0-flash-exp) | |
| query | No | Optional query to guide content extraction and summary | |
| urls | Yes | Array of URLs to extract content from |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions using Gemini AI and returning structured JSON, but lacks details on rate limits, authentication needs, error handling, or what 'extract content' entails (e.g., web scraping, API calls). For a tool with no annotation coverage, this is a significant gap in transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that front-loads the core purpose. It avoids unnecessary words and directly communicates the tool's function. However, it could be slightly more structured by separating key components (e.g., input, process, output) for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity (AI-powered extraction with 4 parameters), lack of annotations, and no output schema, the description is incomplete. It doesn't explain the output structure (what 'pages, answer, and metadata' contain), error cases, or behavioral traits like rate limits. For a tool with no structured support, the description should provide more context to be fully helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema description coverage is 100%, so the schema already documents all four parameters (urls, query, model, maxCharsPerPage) with descriptions. The tool description adds no additional parameter semantics beyond what's in the schema, such as examples or constraints. With high schema coverage, the baseline score of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Extract content from URLs using Gemini AI and return structured JSON with pages, answer, and metadata.' It specifies the verb (extract), resource (content from URLs), technology used (Gemini AI), and output format (structured JSON). However, it doesn't explicitly differentiate from the sibling tool 'google_search', which likely serves a different purpose (searching vs. extracting).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention the sibling tool 'google_search' or any other tools, nor does it specify prerequisites, exclusions, or typical use cases. The agent must infer usage from the purpose alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
2 tool updates
v1.0.0- First observed
google_search - First observed
url_context_extract
TDQS
Scored across 2 tools
The two tools have clearly distinct purposes: one performs web searches, while the other extracts content from specific URLs. There is no overlap in functionality, making it easy for an agent to select the correct tool based on whether it needs general search results or URL-specific content extraction.
Both tool names follow a consistent verb_noun pattern: 'google_search' and 'url_context_extract'. The naming is clear, descriptive, and adheres to a uniform style, making the tools easily identifiable and predictable in their naming convention.
With only two tools, the server feels thin for its purpose of 'Gemini URL Context & Search'. While the tools cover search and extraction, the scope suggests potential for more operations, such as managing search history or handling multiple URLs, making the tool count insufficient for comprehensive coverage.
The tools cover basic search and URL content extraction, but there are notable gaps. For example, there's no tool for saving or managing extracted data, refining searches, or handling batch URL processing. This limits the server's ability to support more advanced workflows within its domain.
Related MCP Connectors
Search the web and extract clean, readable text from webpages. Process multiple URLs at once to sp…
Turns any URL into SEO metadata, contacts, tech stack, and AI-ready Markdown, in one call.
Web search, URL content extraction to Markdown, site mapping, and recursive web crawler.
Turn any URL into clean Markdown and structured data. Scrape, crawl, search and extract.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides web search capabilities using Google Custom Search API, enabling users to perform searches through a Model Context Protocol server.2219 npm68MIT
- FlicenseNot gradedqualityDmaintenanceEnables intelligent web scraping through a browser automation tool that can search Google, navigate to webpages, and extract content from various websites including GitHub, Stack Overflow, and documentation sites.1-
- AlicenseCqualityCmaintenanceA powerful tool for fetching and extracting text content from web pages and APIs, supporting web scraping, REST API requests, and Google Custom Search integration.510MIT
- AlicenseAqualityAmaintenanceExtract content from URLs, documents, videos, and audio files using intelligent auto-engine selection. Supports web pages, PDFs, Word docs, YouTube transcripts, and more with structured JSON responses.2172MIT