Skip to main content
Glama
Ollama Web Search MCP

Ollama Web Search MCP

by me3o2024

Ollama Web Search MCP

A small, resilient STDIO MCP server for Ollama Cloud's official Web Search and Web Fetch APIs.

It is designed for LiteLLM, Claude Desktop/Cowork, Codex, Cline, and other MCP clients.

Tools

Tool

Purpose

web_search

Search the public web and return up to 10 results.

web_fetch

Extract the main content and links from one public page.

search_and_fetch

Search, then fetch the top pages concurrently in one tool call.

Related MCP server: Ollama Web Search

Why this wrapper?

  • Bounded retries for transient failures and rate limits

  • Configurable timeouts

  • Input and URL validation

  • Partial success in search_and_fetch

  • Safe error messages that do not expose the API key

  • Small dependency surface, tests, and CI

Requirements

  • Python 3.11+

  • An Ollama API key from ollama.com

  • uvx (recommended) or pip

Quick start

export OLLAMA_API_KEY="your-key"
uvx --from https://github.com/me3o2024/ollama-websearch-mcp/archive/refs/tags/v1.0.0.tar.gz ollama-websearch-mcp

LiteLLM UI: STDIO configuration

Add a new MCP server and paste:

{
  "mcpServers": {
    "ollama-websearch": {
      "command": "uvx",
      "args": [
        "--from",
        "https://github.com/me3o2024/ollama-websearch-mcp/archive/refs/tags/v1.0.0.tar.gz",
        "ollama-websearch-mcp"
      ],
      "env": {
        "OLLAMA_API_KEY": "your-ollama-api-key"
      }
    }
  }
}

Put the real key in env. ${OLLAMA_API_KEY} is not expanded here — LiteLLM interpolates ${...} placeholders in HTTP headers, not in the env block of a stdio server. A placeholder is passed to the subprocess verbatim, so the server sees the literal text ${OLLAMA_API_KEY} and fails with OLLAMA_API_KEY is required.

The LiteLLM container must have uvx installed and outbound HTTPS access to ollama.com and github.com. The URL above is a source archive, which needs no git — see the note below if you would rather install from a git+https:// URL.

Prefer a git+https:// URL?

It works, but only where git is installed: uvx shells out to git to resolve it, and minimal containers often ship without it. Either add git to the image:

RUN apk add --no-cache git

or keep using the source-archive URL, which has no such dependency.

git+https://github.com/me3o2024/ollama-websearch-mcp.git@v1.0.0

Other MCP clients

{
  "mcpServers": {
    "ollama-websearch": {
      "command": "uvx",
      "args": [
        "--from",
        "https://github.com/me3o2024/ollama-websearch-mcp/archive/refs/tags/v1.0.0.tar.gz",
        "ollama-websearch-mcp"
      ],
      "env": {
        "OLLAMA_API_KEY": "your-key"
      }
    }
  }
}

Optional settings

Variable

Default

Allowed

OLLAMA_TIMEOUT_SECONDS

30

Greater than 0, up to 300

OLLAMA_MAX_RETRIES

2

0 to 5

Local development

python -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
ruff check .
pytest

Privacy

Search queries and URLs are sent from your MCP host to Ollama Cloud. The GitHub repository is only the source of the code; it does not receive your searches. Do not place confidential information, credentials, or customer data in web-search queries.

API basis

This project uses Ollama's official endpoints:

  • POST https://ollama.com/api/web_search

  • POST https://ollama.com/api/web_fetch

See the official Ollama Web Search documentation.

License

MIT

Available Tools

3 tools
search_and_fetchA

Search the web and fetch the top results in one call.

This convenience tool reduces agent round trips. Individual fetch failures are returned beside successful pages instead of failing the whole operation.

Args: query: A concise search query. Do not include secrets or confidential data. max_results: Number of search results to return, from 1 to 10. fetch_top: Number of top result pages to fetch, from 1 to max_results.

Inputs: query (required), fetch_top, max_results. Returns: object

web_fetchB

Fetch and extract the main content of one public HTTP(S) web page.

Args: url: Absolute public HTTP or HTTPS URL to fetch.

Inputs: url (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clear distinct role: web_search retrieves results, web_fetch retrieves page content, and search_and_fetch combines both as an explicit convenience. The overlap of search_and_fetch with the pair is well-explained and does not cause ambiguity.

    Naming Consistency4/5

    All names use snake_case and are readable verb_noun or verb_pattern forms. The minor deviation is that web_search and web_fetch share a 'web_' prefix while search_and_fetch does not, but this is not confusing.

    Tool Count5/5

    Three tools is well-scoped for a web search and fetch server; each tool earns its place by covering a core operation. Adding more would likely introduce redundancy.

    Completeness5/5

    The surface covers search, single-page fetch, and combined search+fetch, which are the essential operations for this domain. No obvious lifecycle gaps are apparent for a web search utility.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers