Skip to main content

Overview

LiteLLM ships a built-in MCP gateway that lets the LiteLLM Proxy connect to Model Context Protocol servers and surface their tools to any model you route through it. ScrapeGraphAI is available as a first-party MCP server, so a single config entry gives every LiteLLM client access to smart scraping, web crawling, search scraping, and agentic scraping workflows. LiteLLM ships ScrapeGraph in its default mcp_servers.json, pointing at the ScrapeGraph MCP server hosted on Smithery.

LiteLLM MCP docs

How LiteLLM connects to MCP servers

ScrapeGraph MCP server

The MCP server LiteLLM connects to

Prerequisites

pip install 'litellm[proxy]'

Configure the MCP server

Add ScrapeGraph to the mcp_servers block of your LiteLLM proxy config. This is the same entry LiteLLM ships in its default mcp_servers.json — the Smithery-hosted server exposes both HTTP and SSE transports.
config.yaml
model_list:
  - model_name: gpt-5
    litellm_params:
      model: openai/gpt-5
      api_key: os.environ/OPENAI_API_KEY

mcp_servers:
  scrapegraph:
    url: "https://smithery.ai/api/mcp/scrapegraph-mcp"
    description: "Smart scraping, web crawling, search scraping, and agentic scraping workflows."
The raw mcp_servers.json entry added in LiteLLM looks like this:
mcp_servers.json
{
  "scrapegraph": {
    "http_url": "https://smithery.ai/api/mcp/scrapegraph-mcp",
    "sse_url": "https://smithery.ai/api/mcp/scrapegraph-mcp/sse",
    "description": "The ScrapeGraph MCP server provides programmatic access to ScrapeGraph AI's web scraping capabilities, including smart scraping, web crawling, search scraping, and agentic scraping workflows."
  }
}
The ScrapeGraph MCP server reads your ScrapeGraphAI API key from SGAI_API_KEY. Set it in the environment where the proxy runs, or pass it through the Smithery config of your MCP server deployment.

Start the proxy

export OPENAI_API_KEY="your-openai-key"
export SGAI_API_KEY="your-scrapegraph-key"

litellm --config config.yaml
The proxy boots on http://localhost:4000 and registers the ScrapeGraph tools under the MCP gateway.

List the available tools

LiteLLM exposes connected MCP tools over its MCP endpoint. Point any MCP-aware client at http://localhost:4000/mcp to discover them:
curl -s http://localhost:4000/mcp \
  -H "Authorization: Bearer $LITELLM_API_KEY"
The ScrapeGraph server registers these tools:
ToolWhat it does
scrapeFetch a page as markdown, HTML, links, or a screenshot
extractExtract structured JSON from a URL with a prompt and optional schema
searchSearch the web and return ranked results
crawl_startStart an async multi-page crawl
crawl_get_statusPoll a crawl job’s progress
crawl_stop / crawl_resumeControl an active crawl
schemaGenerate or augment a JSON Schema from a prompt
monitor_*Create, list, pause, resume, and inspect scheduled jobs
creditsCheck remaining account credits
historyView paginated request history

Use it from a model

With the gateway running, any model routed through LiteLLM can call the ScrapeGraph tools during a completion. Pass the proxy’s MCP tools through your client of choice:
import openai

client = openai.OpenAI(
    base_url="http://localhost:4000",
    api_key="sk-1234",  # your LiteLLM proxy key
)

response = client.responses.create(
    model="gpt-5",
    input="Scrape https://scrapegraphai.com and summarize what the product does.",
    tools=[
        {
            "type": "mcp",
            "server_label": "scrapegraph",
            "server_url": "http://localhost:4000/mcp",
            "require_approval": "never",
        }
    ],
)

print(response.output_text)
The model decides when to call scrape, search, or extract, receives the structured result, and writes its final answer from the scraped data.

Support

GitHub Issues

Report bugs and request features

Discord Community

Get help from our community