Skip to main content
Glama
me3o2024

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYes
fetch_topNo
max_resultsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the load and does disclose meaningful behavior: partial failures are returned alongside successes rather than aborting the whole call. It omits auth/rate-limit or caching behavior, but the failure-handling disclosure is a genuine addition beyond structured fields.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the one-line purpose before any detail, then a behavioral note, then a compact Args block. Slight redundancy between the intro and the Args restatements, but nothing wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists so return values need not be described, and the description adequately covers purpose, failure semantics, and all three parameters. For a simple 3-param convenience tool this is close to complete; only cross-cutting concerns like rate limits or auth are absent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does: it gives ranges (1-10 for max_results, 1 to max_results for fetch_top) that the schema lacks, plus a safety constraint on query ('Do not include secrets or confidential data'). It doesn't explain the interaction if fetch_top exceeds available results, but the core semantics are covered.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific compound verb+resource: 'Search the web and fetch the top results in one call.' The combining nature implicitly differentiates it from siblings web_search and web_fetch, but it never names them, so the distinction is left to inference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

'This convenience tool reduces agent round trips' gives clear context for when to prefer it over making separate search and fetch calls. No explicit when-not conditions or rate/permission caveats are stated, but the usage context is unambiguous.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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.

ParametersJSON Schema
NameRequiredDescriptionDefault
urlYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description carries the full burden. It usefully discloses that the target must be public and that content extraction strips to 'main content', but says nothing about redirects, JS rendering, auth-walled pages, truncation limits, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two lines, front-loaded with the verb and resource, with the parameter constraint immediately following. No filler sentences.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained. However, the lack of routing guidance against two closely related siblings leaves a real gap for an agent choosing between web_fetch, web_search, and search_and_fetch.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema only declares a bare string 'url' with 0% description coverage, so the description must compensate. It does, specifying that the URL must be absolute, public, and HTTP(S), which narrows valid inputs meaningfully beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb ('fetch and extract') and resource ('main content of one public HTTP(S) web page'), and the phrase 'main content' distinguishes it from a raw-HTML scraper. It does not differentiate itself from the siblings web_search or search_and_fetch, so it falls short of a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no statement of when to use this tool versus search_and_fetch, which also fetches pages, or web_search. The single-URL scope is only implied by 'one public HTTP(S) web page', leaving the agent to infer the boundary.

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.

  1. 3 tool updatesv1.0.0
    • First observedsearch_and_fetch
    • First observedweb_fetch
    • First observedweb_search

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

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers