Skip to main content
Glama
financesaur

ollama-web-tools-mcp

by financesaur
README.md
# Ollama Web Tools MCP

Python 3.12+ MCP server preserving the Ruby oracle's `web_search` and `web_fetch`
contracts and adding `cluesift_domain_fetch`. It uses the official Python MCP SDK,
stdio by default, and stateless JSON streamable HTTP at `/` with `--http`.

## Configuration

Production (`prod` or `production` in the first set of `ENVIRONMENT`,
`CLUESIFT_ENV`, or `ENV`) requires `OLLAMA_KEY_POOL_FILE`. The reloadable UTF-8
JSON document has exactly this useful shape; array order is strict priority and
duplicates are removed while preserving first occurrence:

```json
{"keys":["primary-ollama-tools-key","secondary-ollama-tools-key"]}
```

The file is re-read when its mtime changes or after a two-second TTL. Outside
production only, comma-separated `OLLAMA_CLOUD_API_KEYS`, then `OLLAMA_API_KEY`,
are fallback inputs. Keys are never logged; diagnostics identify them only by the
first 12 lowercase hex characters of SHA-256.

Optional Ollama timeouts: `OLLAMA_OPEN_TIMEOUT=10`, `OLLAMA_READ_TIMEOUT=60`,
`OLLAMA_WRITE_TIMEOUT=30`. ClueSift aliases use complete endpoint URLs (not base
URLs):

* `cluesift-test`: `CLUESIFT_ARTIFACT_TEST_URL` and `_TOKEN`
* `cluesift-prod`: `CLUESIFT_ARTIFACT_PROD_URL` and `_TOKEN`

Each pair must be wholly present or absent. Callback timeout defaults are
`CLUESIFT_ARTIFACT_OPEN_TIMEOUT=2`, `...READ_TIMEOUT=5`, and
`...WRITE_TIMEOUT=5`. Callback failures are content-free telemetry and never
replace a successful fetch result.
Callback URLs are complete absolute HTTP(S) endpoints, may use only their
scheme's default port, and may not contain userinfo, a query, or a fragment.
Fetched public URLs reject trailing-dot hosts rather than canonicalizing them.

## Run and develop

```bash
python -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/ollama-web-tools-mcp
.venv/bin/ollama-web-tools-mcp --http --port 8767
.venv/bin/ruff check .
.venv/bin/ruff format --check .
.venv/bin/pytest
```

The three tools are exactly `web_search`, `web_fetch`, and
`cluesift_domain_fetch`. The ClueSift tool accepts only `url`, `artifact_target`,
`request_id`, and `case_id`; see the copied implementation brief for its full
security and delivery contract.

TDQS

B3/5.0

Scored across 3 tools

Disambiguation4/5

web_search clearly differs from the fetch tools. web_fetch and cluesift_domain_fetch both fetch pages, but cluesift_domain_fetch has a distinct delivery target, reducing confusion. One or two could be confused but descriptions clarify.

Naming Consistency4/5

web_search and web_fetch follow a consistent noun-verb pattern. cluesift_domain_fetch deviates by adding a longer domain prefix, but still ends with a verb and uses consistent snake_case.

Tool Count4/5

3 tools is on the lower end but appropriate for a focused web search/fetch server; each tool has a clear purpose, though the server may seem slightly thin.

Completeness4/5

The core web operations of search and fetch are covered, plus a specialized fetch-to-target. Minor gaps exist (e.g., no tool for parsing or summarizing pages) but not critical for the primary use case.

Maintenance

ActivityMaintained
ResponsivenessSyncing