Ollama MCP 伺服器 | PlugMCP
跳到正文
🦙 Ollama MCP Server
Supercharge your AI assistant with local LLM access
An MCP (Model Context Protocol) server that exposes the complete Ollama SDK as MCP tools, enabling seamless integration between your local LLM models and MCP-compatible applications like Claude Desktop and Cline.
把任意工具接入任意代理。面向非開發者的 MCP 伺服器目錄;閘道承載流量,n8n 承載應用。
產品
目錄
開發者
公司
✨ Features
☁️ Ollama Cloud Support - Full integration with Ollama's cloud platform
🔧 14 Comprehensive Tools - Full access to Ollama's SDK functionality
🔄 Hot-Swap Architecture - Automatic tool discovery with zero-config
🎯 Type-Safe - Built with TypeScript and Zod validation
📊 High Test Coverage - 96%+ coverage with comprehensive test suite
🚀 Zero Dependencies - Minimal footprint, maximum performance
🔌 Drop-in Integration - Works with Claude Desktop, Cline, and other MCP clients
🌐 Web Search & Fetch - Real-time web search and content extraction via Ollama Cloud
🔀 Hybrid Mode - Use local and cloud models seamlessly in one server
💡 Level Up Your Ollama Experience with Claude Code and Desktop
The Complete Package: Tools + Knowledge This MCP server gives Claude the tools to interact with Ollama - but you'll get even more value by also installing the Ollama Skill from the Skillsforge Marketplace :
🚗 This MCP = The Car - All the tools and capabilities
🎓 Ollama Skill = Driving Lessons - Expert knowledge on how to use them effectively
The Ollama Skill teaches Claude:
Best practices for model selection and configuration
Optimal prompting strategies for different Ollama models
When to use chat vs generate, embeddings, and other tools
Performance optimization and troubleshooting
Advanced features like tool calling and function support
Install both for the complete experience:
Result: Claude doesn't just have the car - it knows how to drive! 🏎️
📦 Installation
Quick Start with Claude Desktop Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp"]
}
}
}
Global Installation npm install -g ollama-mcp
For Cline (VS Code) Add to your Cline MCP settings (cline_mcp_settings.json):
{
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp"]
}
}
}
🛠️ Available Tools
Model Management
Model Operations
Web Tools (Ollama Cloud)
Note: Web tools require an Ollama Cloud API key. They connect to https://ollama.com/api for web search and fetch operations.
⚙️ Configuration
Environment Variables
Custom Ollama Host {
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp"],
"env": {
"OLLAMA_HOST": "http://localhost:11434"
}
}
}
}
Ollama Cloud Configuration To use Ollama's cloud platform with web search and fetch capabilities:
{
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp"],
"env": {
"OLLAMA_HOST": "https://ollama.com",
"OLLAMA_API_KEY": "your-ollama-cloud-api-key"
}
}
}
}
☁️ Access cloud-hosted models
🔍 Web search with ollama_web_search (requires API key)
📄 Web fetch with ollama_web_fetch (requires API key)
🚀 Faster inference on cloud infrastructure
Get your API key: Visit ollama.com to sign up and obtain your API key.
Hybrid Mode (Local + Cloud) You can use both local and cloud models by pointing to your local Ollama instance while providing an API key:
{
"mcpServers": {
"ollama": {
"command": "npx",
"args": ["-y", "ollama-mcp"],
"env": {
"OLLAMA_HOST": "http://127.0.0.1:11434",
"OLLAMA_API_KEY": "your-ollama-cloud-api-key"
}
}
}
}
✅ Runs local models from your Ollama instance
✅ Enables cloud-only web search and fetch tools
✅ Best of both worlds: privacy + web connectivity
🔄 Retry Behavior The MCP server includes intelligent retry logic for handling transient failures when communicating with Ollama APIs:
Automatic Retry Strategy Web Tools (ollama_web_search and ollama_web_fetch):
Automatically retry on rate limit errors (HTTP 429)
Maximum of 3 retry attempts (4 total requests including initial)
Request timeout: 30 seconds per request (prevents hung connections)
Respects the Retry-After header when provided by the API
Falls back to exponential backoff with jitter when Retry-After is not present
Retry-After Header Support The server intelligently handles the standard HTTP Retry-After header in two formats:
Waits exactly 60 seconds before retrying.
Retry-After: Wed, 21 Oct 2025 07:28:00 GMT
Calculates delay until the specified timestamp.
Exponential Backoff When Retry-After is not provided or invalid:
Initial delay: 1 second (default)
Maximum delay: 10 seconds (default, configurable)
Strategy: Exponential backoff with full jitter
Formula: random(0, min(initialDelay × 2^attempt, maxDelay))
1st retry: 0-1 seconds
2nd retry: 0-2 seconds
3rd retry: 0-4 seconds (capped at 0-10s max)
Error Handling Retried Errors (transient failures):
HTTP 429 (Too Many Requests) - rate limiting
HTTP 500 (Internal Server Error) - transient server issues
HTTP 502 (Bad Gateway) - gateway/proxy received invalid response
HTTP 503 (Service Unavailable) - server temporarily unable to handle request
HTTP 504 (Gateway Timeout) - gateway/proxy did not receive timely response
Non-Retried Errors (permanent failures):
Request timeouts (30 second limit exceeded)
Network timeouts (no status code)
Abort/cancel errors
HTTP 4xx errors (except 429) - client errors requiring changes
Other HTTP 5xx errors (501, 505, 506, 508, etc.) - configuration/implementation issues
The retry mechanism ensures robust handling of temporary API issues while respecting server-provided retry guidance and preventing excessive request rates. Transient 5xx errors (500, 502, 503, 504) are safe to retry for the idempotent POST operations used by ollama_web_search and ollama_web_fetch. Individual requests timeout after 30 seconds to prevent indefinitely hung connections.
🎯 Usage Examples
Chat with a Model // MCP clients can invoke:
{
"tool": "ollama_chat",
"arguments": {
"model": "llama3.2:latest",
"messages": [
{ "role": "user", "content": "Explain quantum computing" }
]
}
}
Generate Embeddings {
"tool": "ollama_embed",
"arguments": {
"model": "nomic-embed-text",
"input": ["Hello world", "Embeddings are great"]
}
}
Web Search {
"tool": "ollama_web_search",
"arguments": {
"query": "latest AI developments",
"max_results": 5
}
}
🏗️ Architecture This server uses a hot-swap autoloader pattern:
src/
├── index.ts # Entry point (27 lines)
├── server.ts # MCP server creation
├── autoloader.ts # Dynamic tool discovery
└── tools/ # Tool implementations
├── chat.ts # Each exports toolDefinition
├── generate.ts
└── ...
Add new tools by dropping files in src/tools/
Zero server code changes required
Each tool is independently testable
100% function coverage on all tools
🧪 Development
Prerequisites
Node.js v16+
npm or pnpm
Ollama running locally
Setup # Clone repository
git clone https://github.com/rawveg/ollama-mcp.git
cd ollama-mcp
# Install dependencies
npm install
# Build project
npm run build
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
Test Coverage Statements : 96.37%
Branches : 84.82%
Functions : 100%
Lines : 96.37%
Adding a New Tool
Create src/tools/your-tool.ts:
import { ToolDefinition } from '../autoloader.js';
import { Ollama } from 'ollama';
import { ResponseFormat } from '../types.js';
export const toolDefinition: ToolDefinition = {
name: 'ollama_your_tool',
description: 'Your tool description',
inputSchema: {
type: 'object',
properties: {
param: { type: 'string' }
},
required: ['param']
},
handler: async (ollama, args, format) => {
// Implementation
return 'result';
}
};
Create tests in tests/tools/your-tool.test.ts
Done! The autoloader discovers it automatically.
🤝 Contributing Contributions are welcome! Please follow these guidelines:
Fork the repository
Create a feature branch (git checkout -b feature/amazing-feature)
Write tests - We maintain 96%+ coverage
Commit with clear messages (git commit -m 'Add amazing feature')
Push to your branch (git push origin feature/amazing-feature)
Open a Pull Request
Code Quality Standards
All new tools must export toolDefinition
Maintain ≥80% test coverage
Follow existing TypeScript patterns
Use Zod schemas for input validation
📄 License This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
🔗 Related Projects
🙏 Acknowledgments
Ollama SDK - Official Ollama JavaScript library
MCP SDK - Model Context Protocol SDK
Zod - TypeScript-first schema validation
Scrapling MCP Server Web scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported. Serverless ⚡ Serverless Framework – Effortlessly build apps that auto-scale, incur zero costs when idle, and require minimal maintenance using AWS Lambda and other managed cloud services. Skills The open agent skills tool - npx skills Editor Open-source 3D architecture software for AECO, scan-to-BIM. Agent-friendly, browser-first, MCP, CLI. Trigger.dev Trigger.dev – build and deploy durable AI agents and workflows Open Saas A 100% free modern JS SaaS boilerplate (React, NodeJS, Prisma). Full-featured: Auth (email, google, github, slack, MS), Email sending, Background jobs, Landing page, Payments (Stripe, Polar.sh), Shadc Docker Android Android in docker solution with noVNC supported, video recording, mcp server and AI-agent Awesome Cloudflare ⛅️ 精选的 Cloudflare 工具、开源项目、指南、博客和其他资源列表。/ ⛅️ A curated list of Cloudflare tools, open source projects, guides, blogs and other resources. Casdoor An open-source Agent-first Identity and Access Management (IAM) /LLM MCP & agent gateway and auth server with web UI supporting OpenClaw, MCP, OAuth, OIDC, SAML, CAS, LDAP, SCIM, WebAuthn, TOTP, MFA, SeleniumBase 📊 Python APIs for Web Automation, Testing, and Scraping. CDP Mode launches a stealth browser that bypasses bot-detection/CAPTCHAs. Adds stealth to Playwright and has an MCP server for AI agents. Pal The power of Claude Code / GeminiCLI / CodexCLI + [Gemini / OpenAI / OpenRouter / Azure / Grok / Ollama / Custom Model / All Of The Above] working as one. Tyk Open Source API and AI Gateway supporting REST, GraphQL, TCP, gRPC and MCP (Model Context Protocol) Cloud infrastructure MCP 伺服器 最佳 Cloud infrastructure MCP 伺服器 agent-browser Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web a azure-aigateway Configure Azure API Management as an AI Gateway for AI models, MCP tools, and agents. WHEN: semantic caching, token limit, content safety, load balancing, AI model governance, MCP rate limiting, jailb
尚無工具清單。遠端伺服器會在首次健康檢查後取得工具清單。
如何安裝 Ollama? 在本頁複製適用於 Cursor、Claude Desktop、Claude Code 或 VS Code 的 stdio 設定。它使用發布者的安裝方式,而不是 PlugMCP 代理伺服器。
Ollama 需要 API 金鑰嗎? 這筆記錄未列出必要的環境變數。
Ollama 使用哪種傳輸方式? Ollama 透過 stdio 在本機執行。
Ollama 上次檢查是什麼時候? 上次檢查時間:2026-10-26。 An MCP Server for Ollama
azure-compute Azure VM/VMSS router. WHEN: create / provision / deploy / spin-up VM, recommend VM size, compare VM pricing, VMSS, scale set, autoscale, burstable, lightweight server, website, backend, GPU, machine l 工具
0 / 10