You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ScrapeGraph MCP server can be integrated with [Google ADK (Agent Development Kit)](https://github.com/google/adk) to create AI agents with web scraping capabilities.
356
+
357
+
### Prerequisites
358
+
359
+
- Python 3.10 or higher
360
+
- Google ADK installed
361
+
- ScrapeGraph API key
362
+
363
+
### Installation
364
+
365
+
1.**Install Google ADK** (if not already installed):
366
+
367
+
```bash
368
+
pip install google-adk
369
+
```
370
+
371
+
2.**Set your API key**:
372
+
373
+
```bash
374
+
export SGAI_API_KEY=your-api-key-here
375
+
```
376
+
377
+
### Basic Integration Example
378
+
379
+
Create an agent file (e.g., `agent.py`) with the following configuration:
380
+
381
+
```python
382
+
import os
383
+
from google.adk.agents import LlmAgent
384
+
from google.adk.tools.mcp_tool.mcp_toolset import MCPToolset
385
+
from google.adk.tools.mcp_tool.mcp_session_manager import StdioConnectionParams
386
+
from mcp import StdioServerParameters
387
+
388
+
# Path to the scrapegraph-mcp server directory
389
+
SCRAPEGRAPH_MCP_PATH="/path/to/scrapegraph-mcp"
390
+
391
+
# Path to the server.py file
392
+
SERVER_SCRIPT_PATH= os.path.join(
393
+
SCRAPEGRAPH_MCP_PATH,
394
+
"src",
395
+
"scrapegraph_mcp",
396
+
"server.py"
397
+
)
398
+
399
+
root_agent = LlmAgent(
400
+
model='gemini-2.0-flash',
401
+
name='scrapegraph_assistant_agent',
402
+
instruction='Help the user with web scraping and data extraction using ScrapeGraph AI. '
403
+
'You can convert webpages to markdown, extract structured data using AI, '
404
+
'perform web searches, crawl multiple pages, and automate complex scraping workflows.',
405
+
tools=[
406
+
MCPToolset(
407
+
connection_params=StdioConnectionParams(
408
+
server_params=StdioServerParameters(
409
+
command='python3',
410
+
args=[
411
+
SERVER_SCRIPT_PATH,
412
+
],
413
+
env={
414
+
'SGAI_API_KEY': os.getenv('SGAI_API_KEY'),
415
+
},
416
+
),
417
+
timeout=300.0,)
418
+
),
419
+
# Optional: Filter which tools from the MCP server are exposed
0 commit comments