Ollama MCP Server
Provides web search and URL content fetching capabilities through the Ollama API, enabling AI models to access real-time information.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Ollama MCP Serversearch the web for latest news on quantum computing"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ollama MCP Server
A production-grade Model Context Protocol (MCP) server that bridges Ollama's capabilities with MCP-compatible clients (like Cline, Codex, Goose). This server specifically provides web search and content fetching capabilities through the Ollama API, enabling AI models to access real-time information and reduce hallucinations.
✨ Features
✅ Web Search: Search the internet for current information using
ollama_web_search.✅ Content Fetching: specific URL content retrieval using
ollama_web_fetch.✅ Flexible Configuration: Supports both Ollama Cloud (default) and Local Ollama endpoints.
✅ Type-Safe: Built with
pydanticfor robust input validation.✅ Async I/O: High-performance, non-blocking operations using
httpx.✅ Easy Integration: Seamlessly works with any MCP-compliant client.
Related MCP server: Tavily Web Search MCP Server
🚀 Quick Start
Prerequisites
Python 3.8 or higher
An Ollama API key (get it from ollama.com/account)
Installation
Clone the repository:
git clone https://github.com/adrianpuiu/ollama-mcp-server.git cd ollama-mcp-serverInstall dependencies:
pip install -r requirements.txt
Configuration
You must set the OLLAMA_API_KEY environment variable for the server to authenticate.
# Linux/macOS
export OLLAMA_API_KEY="your_actual_api_key_here"
# Windows (Command Prompt)
set OLLAMA_API_KEY=your_actual_api_key_here
# Windows (PowerShell)
$env:OLLAMA_API_KEY="your_actual_api_key_here"🛠️ Usage
1. As a Standalone Server
You can run the server directly. It uses stdio for communication, so it will wait for input.
python ollama_mcp.py2. Integration with Gemini CLI
To add this server to your Gemini CLI configuration:
gemini mcp add ollama_mcp python /absolute/path/to/ollama_mcp.py \
-e OLLAMA_API_KEY=your_key_here \
-s user3. Integration with Cline / Codex
Add the following to your MCP configuration file (e.g., ~/.cline/config.json or ~/.codex/config.toml):
JSON (Cline):
{
"mcpServers": {
"ollama_mcp": {
"command": "python",
"args": ["/absolute/path/to/ollama_mcp.py"],
"env": {
"OLLAMA_API_KEY": "your_actual_api_key_here"
}
}
}
}⚠️ Important Note on Web Search
The Web Search (ollama_web_search) and Web Fetch (ollama_web_fetch) tools typically require the Ollama Cloud API.
Default Behavior: The server defaults to
https://ollama.com/api.Local Ollama: If you are running Ollama locally (
http://localhost:11434), note that the standard local installation does not usually include the web search endpoints (/api/web_search).Recommendation: Use the cloud endpoint for search features, even if you use a local instance for model inference.
If you encounter a 404 Not Found error when searching, ensure you are using the cloud endpoint:
export OLLAMA_API_BASE_URL="https://ollama.com/api"🧪 Testing
The project includes a comprehensive test suite.
# Run all tests
python test_ollama_mcp.pyManual Test with Python:
import asyncio
import os
from ollama_mcp import ollama_web_search, WebSearchInput
# Ensure API Key is set
os.environ["OLLAMA_API_KEY"] = "your_key_here"
async def main():
params = WebSearchInput(query="latest AI news", max_results=3)
result = await ollama_web_search(params)
print(result)
if __name__ == "__main__":
asyncio.run(main())🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/adrianpuiu/ollama-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server