Skip to main content

Ollama Web Search MCP Service

A MCP (Model Context Protocol) service for performing web searches using Ollama.

Features

  • Perform web searches using Ollama's search capabilities
  • Format search results for easy consumption
  • Official MCP Python SDK implementation
  • Environment-based configuration
  • Comprehensive error handling
  • Stdio-based communication interface

Installation & Usage

Install and run directly using uvx:

uvx ollama-websearch-mcp

This will automatically install the package and its dependencies, then start the MCP server.

Option 2: Local development

For local development, clone the repository and install dependencies:

git clone https://github.com/huangxinping/ollama-websearch-mcp.git
cd ollama-websearch-mcp
uv sync

Local usage commands

Run as MCP Server (for development):

python mcp_service.py

Build Package:

uv build

MCP Interface

Tools

  1. search
    • Description: Perform a web search using Ollama
    • Parameters:
      • query (string): The search query
      • max_results (integer, optional): Maximum number of results to return (default: 3, range: 1-10)

Example Output

Search result format:

1. Example Title
   URL: https://example.com
   Content: Example content from the search result...

2. Another Title
   URL: https://another-example.com
   Content: Another example content...

Project Structure

ollama-websearch-mcp/
├── mcp_service.py             # MCP service main program
├── README.md                  # Project documentation
├── .env                       # Environment variables
├── .gitignore                 # Git ignore file
├── pyproject.toml             # Project configuration file
├── setup.py                   # Package setup file
└── uv.lock                    # Dependency lock file

Tech Stack

  • Python 3.12+: Programming language
  • MCP: Model Context Protocol framework
  • Ollama: AI model API for web search
  • python-dotenv: Environment variable management
  • uv: Python package manager

Development Standards

  • Use uv native commands for package management
  • Follow Python PEP 8 coding standards
  • Include type hints and docstrings
  • Complete error handling and logging

Publishing to PyPI

To publish the package to PyPI, follow these steps:

  1. Install development dependencies:

    uv sync --group dev
    
  2. Build the package:

    uv build
    
  3. Check the built package:

    uv run twine check dist/*
    
  4. Upload to PyPI:

    uv run twine upload dist/*
    

Make sure you have your PyPI credentials configured before uploading.

AI IDE/CLI Configuration

Claude Code (CLI)

Add to your MCP configuration:

{
  "mcpServers": {
    "ollama-websearch": {
      "command": "uvx",
      "args": ["ollama-websearch-mcp"],
      "env": {
        "OLLAMA_API_KEY": "your_api_key_here"
      }
    }
  }
}

Cursor IDE

Add to your .cursorrules or MCP settings:

{
  "mcp": {
    "servers": {
      "ollama-websearch": {
        "command": "uvx",
        "args": ["ollama-websearch-mcp"],
        "env": {
           "OLLAMA_API_KEY": "your_api_key_here"
        }
      }
    }
  }
}

Windsurf IDE

Add to your Windsurf MCP configuration:

{
  "mcpServers": {
    "ollama-websearch": {
      "command": "uvx",
      "args": ["ollama-websearch-mcp"],
        "env": {
           "OLLAMA_API_KEY": "your_api_key_here"
        }
    }
  }
}

VS Code with Continue Extension

Add to your continue configuration:

{
  "mcp": {
    "servers": {
      "ollama-websearch": {
        "command": "uvx",
        "args": ["ollama-websearch-mcp"],
        "env": {
           "OLLAMA_API_KEY": "your_api_key_here"
        }
      }
    }
  }
}

Other MCP-Compatible Tools

For any MCP-compatible client, use:

# Command
uvx ollama-websearch-mcp

# Or with Python path
python -m mcp_service

License

MIT License

Metadata

Release files for ollama-websearch-mcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollama-websearch-mcp 0.1.3
File Size Uploaded Provenance
ollama_websearch_mcp-0.1.3.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for ollama-websearch-mcp 0.1.3
File Interpreter ABI Platform
ollama_websearch_mcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / ollama_websearch_mcp-0.1.3.tar.gz

Download URL ollama_websearch_mcp-0.1.3.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b363e98c7cd0b163cb8651217b1e8182f2e341c4763836c6ddb61a02b126e917
BLAKE2b-256 checksum
How to use checksums
579802bbaa597cda8a77a84167d063c42cd0211b5e1fa943a1e8b54845ee0246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / ollama_websearch_mcp-0.1.3-py3-none-any.whl

Download URL ollama_websearch_mcp-0.1.3-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c2c42df26c21df07796e2e5a4e23dd8a9e01c4e7f6f2a6e58eb9f548bef4392
BLAKE2b-256 checksum
How to use checksums
db5cd45b3dc12b2c77440aa0a837954c5b158de3fb5d8788be350762eea1ab06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for ollama-websearch-mcp 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page